`
cookoo
  • 浏览: 648828 次
  • 性别: Icon_minigender_1
  • 来自: Shanghai
社区版块
存档分类
最新评论

The most beautiful modeling language

J# 
阅读更多
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.
分享到:
评论

相关推荐

    The unified modeling language reference manual

    -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精粹:标准对象建模语言简明指南》是一本深受欢迎的UML学习资料,由Martin Fowler等作者撰写。UML(统一建模语言)是软件工程领域中用于系统建模的一种标准化语言,它提供了一种图形化的方式来描述、可视化和...

    The Unified Modeling Language Reference Manual, Second Edition

    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 ...

    Unified Modeling Language ppt

    Unified Modeling Language (UML)又称统一建模语言或标准建模语言. This is a PPT about UML introduction.

    The.Unified.Modeling.Language.User.Guide.2nd.Edition

    Addison.Wesley.The.Unified.Modeling.Language.User.Guide.2nd.Edition 这是一本对于UML系统介绍的书,名称叫导引,因为对于初学者不会太晦涩,语言很生动易懂。但这不代表本书点到即止。对于UML的介绍其实非常...

    UML Distilled A Brief Guide to the Standard Object Modeling Language

    UML,即统一建模语言(Unified Modeling Language),是一种标准化的图形化语言,用于对软件系统进行可视化、详述、构造以及文档化。该书不仅详细介绍了UML的基础概念和高级应用,还提供了实用的指导原则,帮助读者...

    The Unified Modeling Language User Guide SECOND EDITION

    该压缩包包含两份文件:一本是《The Unified Modeling Language User Guide, 2nd Edition》的CHM格式电子书,这是一种常见的Windows帮助文档格式,便于读者查阅和检索;另一份是BBL.nfo文件,通常在分享的压缩包中,...

    The Unified Modeling Language User Guide - Second Edition

    统一建模语言(UML)用户指南第二版是一本专门为UML学习者提供的指南,它详尽地介绍了UML的核心概念及其应用。由UML的三位创始人Grady Booch、James Rumbaugh和Ivar Jacobson共同编写。本书作为行业标准的参考指南,...

    The Unified Modeling Language Reference Manual Second Edition

    统一建模语言(Unified Modeling Language,简称UML)是一种标准化的图形化语言,用于软件系统的设计、建模、文档化以及分析。它提供了一套统一的符号和规则,帮助软件工程师在设计阶段更清晰、更准确地表达和交流...

    OMG Unified Modeling Language

    OMG统一建模语言(Unified Modeling Language,UML)是由对象管理组织(Object Management Group,OMG)所提出的一种标准的建模语言。UML主要被用于软件开发领域,它是软件工程中一种可视化的建模语言,用于对软件...

    OMG Systems Modeling Language

    ### OMG Systems Modeling Language (SysML) #### 概述 OMG Systems Modeling Language(简称SysML)是一种基于模型的系统工程语言,它由对象管理组织(Object Management Group, OMG)开发并标准化。SysML的设计...

    Addison Wesley - The Unified Modeling Language User Guide.chm

    Addison Wesley - The Unified Modeling Language User Guide.chm

    The Unified Modeling Language Reference Manual 2nd

    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

    ISO IEC19501---Unified Modeling Language Specification

    ISO/IEC19501:2005(E) 是一个正式的标准文档,定义了统一建模语言(Unified Modeling Language, UML)的规范版本1.4.2。UML是一种广泛使用的图形化建模语言,旨在为软件密集型系统的开发提供一套标准化的方法论。该...

    Unified Modeling Language Infrastructure V2.1.2

    统一建模语言 (Unified Modeling Language, UML) 是一种面向对象的标准化建模语言,用于软件系统的规格描述、可视化处理、构造及文档化。UML不仅支持面向对象的分析与设计(OOA&D),同时也适用于其他的系统开发方法论...

    UML (Unified Modeling Language)统一建模语言

    UML (Unified Modeling Language) 统一建模语言 UML (Unified Modeling Language) 是一种标准化的建模语言,用于描述软件系统的结构、行为和架构。UML 提供了一种通用的语言,用于描述系统的需求、设计和实现。UML ...

    《UML参考手册(第二版)》(The Unified Modeling Language Reference Manual(2nd Edition))

    《UML参考手册》在第1版的基础上进行了重大更新和扩展。UML的创建者James Rumbaugh、Ivar Jacobson和Grady Booch,清晰完整地讲述了UML的所有概念,包括对序列图、活动模型、状态机、组件、类和组件的内部结构以及...

    OMG 统一建模语言(UML) V2.51 英文版

    This specification defines the Unified Modeling Language (UML), revision 2. The objective of UML is to provide system architects, software engineers, and software developers with tools for analysis, ...

    UML规范 Unified Modeling Language Specification

    统一建模语言(Unified Modeling Language,简称UML)是一种用于软件工程的标准图形化语言,它支持面向对象技术的分析、设计与实现过程。UML 2.0规范是该语言的一个重大版本更新,发布于2005年8月,由多个国际知名...

Global site tag (gtag.js) - Google Analytics