I happen to find AMPL, "a computer language for describing production, distribution, blending, scheduling and many other kinds of problems known generally as large-scale optimization or mathematical programming." (from
www.ampl.com) Here's an exmaple on the transportation allocation proving its elegance.:
set ORIG; # origins
set DEST; # destinations
param supply {ORIG} >= 0; # amounts available at origins
param demand {DEST} >= 0; # amounts required at destinations
check: sum {i in ORIG} supply[i] = sum {j in DEST} demand[j];
param cost {ORIG,DEST} >= 0; # shipment costs per unit
var Trans {ORIG,DEST} >= 0; # units to be shipped
minimize total_cost:
sum {i in ORIG, j in DEST} cost[i,j] * Trans[i,j];
subject to Supply {i in ORIG}:
sum {j in DEST} Trans[i,j] = supply[i];
subject to Demand {j in DEST}:
sum {i in ORIG} Trans[i,j] = demand[j];
data; ############ DATA STARTS HERE ############
param: ORIG: supply := # defines set "ORIG" and param "supply"
GARY 1400
CLEV 2600
PITT 2900 ;
param: DEST: demand := # defines "DEST" and "demand"
FRA 900
DET 1200
LAN 600
WIN 400
STL 1700
FRE 1100
LAF 1000 ;
param cost:
FRA DET LAN WIN STL FRE LAF :=
GARY 39 14 11 14 16 82 8
CLEV 27 9 12 9 26 95 17
PITT 24 14 17 13 28 99 20 ;
As you see, there's a clear seperation between the model and the data. Without using this natural mathmatical language, it takes 2-3 times of lines of code to program in other language APIs.
分享到:
相关推荐
-Perry Cole, MCIWorldComThe Unified Modeling Language (UML) has rapidly become the standard notation for modeling software-intensive systems. This book provides the definitive description of UML from ...
UML Distilled: A Brief Guide to the Standard Object Modeling Language中文版本,扫描版,比较清晰,是学习UML的经典书籍
The Unified Modeling Language Reference Manual, Second Edition by James Rumbaugh, Ivar Jacobson, and Grady Booch Published 2005 by Addison-Wesley ISBN 0-321-24562-8 File UMLRefCD.pdf contains an ...
The Unified Modeling Language User Guide - Second Edition, some basic knowledge about the UML, it is suitable for beginner.
The Unified Modeling Language Reference Manual Second Edition
Unified Modeling Language (UML)又称统一建模语言或标准建模语言. This is a PPT about UML introduction.
Addison.Wesley.The.Unified.Modeling.Language.User.Guide.2nd.Edition 这是一本对于UML系统介绍的书,名称叫导引,因为对于初学者不会太晦涩,语言很生动易懂。但这不代表本书点到即止。对于UML的介绍其实非常...
最畅销的UML入门书籍,引领你进入UML设计。
OMG Systems Modeling Language
UML Distilled - A Brief Guide to the Standard Object Modeling Language 3rd,2003.rar
UML2.0规范 Unified Modeling Language Specification
UML官方标准,ISO IEC19501---Unified Modeling Language Specification
统一建模语言标准,对象管理组织最新版,Unified Modeling Language
Introduction to the Unified Modeling Language.pdf
Addison Wesley - The Unified Modeling Language User Guide.chm
Addison Wesley - The Unified Modeling Language Reference Manual 中文版.pdf
UML UML用户手册 英文版本的电子书 绝对值得收藏
UML (Unified Modeling Language) Visualizing 可视化 Specifying 详述 Constructing 构造 Documenting 文档化
The authors have done an ... The Unified Modeling Language (UML) has rapidly become the standard notation for modeling software-intensive systems. This book provides the definitive description of UML