GAMS_軟件介紹_第1頁
GAMS_軟件介紹_第2頁
GAMS_軟件介紹_第3頁
GAMS_軟件介紹_第4頁
GAMS_軟件介紹_第5頁
已閱讀5頁,還剩28頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領

文檔簡介

1、GAMS簡介主要內(nèi)容agamsA統(tǒng)及特點AGAMS模型整體結(jié)構(gòu)A GAMS語言分析A工程應用實例OGAMS系統(tǒng)及特點 GAMS一 “ General Algebraic ModelingSystem (一般桂代藪仿煮紊統(tǒng))的縮寫, 最早是1992年由美國的世界銀行(WorldBank)的 Meeraus 和 Brooke 所發(fā)展。 GAMS是一種面向應用的構(gòu)造模型的高級計 算機語言,融合了關(guān)系數(shù)據(jù)庫技術(shù)與數(shù)學規(guī) 劃理論,使數(shù)學模型與數(shù)據(jù)彼此獨立,為用 戶在模型、算法和數(shù)據(jù)之間提供了一個便捷 的接口。包含了編譯器和高效能的求解引擎 GAMS提供的描述大型復雜模型的語舌 體系十分簡潔,并將算法封裝

2、于系統(tǒng)內(nèi) 部輸入文件形式與模型描述的自然語言一致,便于理解和掌握。|易于操作,封裝的算法均可直接調(diào)用, 無須改變用戶的模型描述。可求解各種類型的實際問題,女口LP (線 性規(guī)劃)、NLP、ILP、MLP等OChemical Ensineerine:No.NameModel TypeAlkylation Process Optimization20processnipChemical Equilibrium Problem21diemnipChemical Equilibrium Pioblem76wallnipStmctiiral Optiimzation of Process Plowsli

3、eets116procseimiiilpSimultaneous Optimization for Hen Sitliesis117svnheat>1mmlpHeat hitegi'ated Distillation Sequences118minlphinip, impOptimal Design for Chemical Batch Processing119batchdesmmlpSynthesis of General Distillation Sequences120lions harpnip, mipLogical Infeience for Reaction pat

4、h synthesis121reaction1POptimum Feed Plate Location122feedtravmmlpSynthesis: Hvdrodealkvlation of Toluene123hda*liiinlpChemical Equilibrium Problem as MCP127wallmcpmcpSimplified Alkylation Process16?alkvlnip舉一個線性規(guī)劃的例子Shipping DistancesSuppliesMarketsPlantsNew YorkChicagoTopekaSeattle151.71.8350San D

5、ieaoZ5L81.4600Demands325300275矩陣為供銷地區(qū)的距離(單位:千公里)每公里運費為$90/千公里Supplies一供應商的生產(chǎn)量 Demands一采購商的需求量優(yōu)化曰標:運斎最低運輸問題數(shù)學語言描述Indices:i = plantsj = marketsGiven Data:%= supply of commodity of plant i (in cases)bj = demand for commodity at market / (cases)Qj = cost per unil shipment between plant i and market j ($

6、/case)Decision Variables:X/j amount of comnuxlily Io ship from plant i to market j (casesX where t > 0, for all ijConstraints:Observe supply limit al plant i:.仏 < a. for all i (cases)Satisfy demand at market j產(chǎn)打 > /br all J (cases)Objective l unction:Minimi空工工£兒($K)i canning pl ants- /

7、 E-eatt le., £an-Diegi /j market.!/ New- York r Ch.icagar Topelta / ;GAMS 語言描述FoK-3n»=t>=17£7a (i capac i Dy of pl ant ./Seattle2ari Diegoin cacec3&06DQ /b < j demand at narket/York«Zhiaago Top-skain cases3253002T5 / ;lV=w- YorkiZhicago£-eattle25L 丁S-an-Die-go25L.P

8、Table d (i. j di stance i n thcusan«ds of n i Lenin dz-llarc percace perTopekal.E1.4 ;Scalar f freightthousand miles790/Parameter c ( i r j ltrannpz-rt ods tin 1000sof -dollars p-=r casecCi. j) f*dd, jJ/LODO ;Xr3fiableflx(ij shipment quantities in casesztotal tranorportation costs in lODOs of c

9、3ollars ;Equationsods tsupply l: i) di-mand (j )Positive variable x ;z -e- sun( (i r j ).define objec:t:ive function obsein/e supply Lin it at plant i satisfy demsnd at market j -ODStsupply I: i) aum f j r x»:i, j :» -1- a : i ;demand (j ). nun : i , x (i r j Jg b (j );hfodel transport /al

10、l/ ;solve transport timing Ip minimizing 工 - display sc.l.工.n ;GAMS模型整體結(jié)構(gòu)Inputs Sets (指定) Data (Parameters, Tables, Scalar) Variables Equations Model and Solve statements Displav statement (opfionQl)GAMS模型整體結(jié)構(gòu)OutputsEcho PrintEiror MessagesReference MapsEcho PrintReference Maps Equation Listings Mod

11、el Statistics Status Reports Solution R 已 portsRemarks先定義,再引用每條語句由分號結(jié)束 GAMS編譯器不區(qū)分大小寫標注由星號引出,或?qū)俗⒅苯硬迦氲?語句中Equations包含等式和不等式約束GAMS語言分析 Sets用于指定數(shù)學模型中的下標i canning plants / Seattle, Edn-Di亡go /j marketsJ Hew-York. Chi cage P Topck-a /)即定義:i代表生產(chǎn)地,j代表銷售地 Data(1) ListsFaranetersa (i)of plan七 Sea t七.亡 San-Di

12、eaoin ca.5es350600 Qin cases300b (j ) demand at market j/New-YorkChicago TopekaRemarks:所有參數(shù)默認初值為0多字情況,例如,New York需要加連字符標量的定義如下:Scalar>f freight- in dollars per cass per thousand rr.iles / 9 0 / ;(2) TablesTopekaTable d( i. j 1 distance in thousands c-f riilec tfew- YorkiZhicagoSeattle2.51.7£

13、-3n-Dii&gD2.51 . E(3) Direct assignment (直接定義)Parameter c(i r j) tranopz-rt cost in IDDQs of dolliara peir cafse <ij - fM(iJ)/10D0 ;1 Variables(1) 變量類型Variable TypeAllowed Range of anableFreet o 十00Positive0 to + 8Negative8 tO 0Einaiy0 or 1Integer0,1100(2) 自變量和優(yōu)化變量Variablesx (1 f j ) shlpir.e

14、nt quantities Ln casesztotal tr&nspcrt凰二士on costs in 1000s oz dollars ;(3) 對自變量定義類型Positive variable x ; Equations(1)常用符號Suit, (index of suimationf 5t:mT.and)jXij. Suir.( j , x (ir j )j巧. prod (j r x (i< j )(2)定義步驟定義等式的名稱一運算的控制維一控制維的約束(可選) 一 標記“ 一-左邊表達 一符 一-右邊表達式符號類型=1=*3=e=less than or equal

15、 to greater than or equal to equal to(4)舉例Zquationscost supply (i) deir.a.nd (j )define objective function observe supply limit at plant i sa.-isfy demand at market j ;cost. -z 二己二 suir.( (ir j ) r c (1/ j )(iz j );supply (i) . . sum( j x (l,j) ) =1= a (i);demand(j) . - sum (1f x(i z j) =g-;Remark:在

16、約束式的兩邊均可以出現(xiàn)變量,而且同一變量可以出現(xiàn)多次(1) 模型定義(2) 模型求解(3) 求解方法 Model And Solven-.odel transport /all/ ; all:包括所有的變量和等式rr.cdel transport / ccstf supply, derriand / ;solve transport us ing Ipz ;lp for lineal* programmingnip for nonlinear programming mip for mixed integer programming rnip for relaxed mixed integer

17、 piogrammiiig ir.inlp for mixed integer nonlinear progranuning rrninlp for relaxed mixed mteger nonlmear progranuning ir.cp for mixed cmpleiiieiitarify' problems cns for constrained nonlinear systems Display(1)結(jié)果輸出display x.lr x.m ;(2)輸出類型丄 o=lower bound丄=level or primal value up=upper bound m=m

18、arginal or dual value.lo表示輸出變量的下限.1表示輸出變量的最終結(jié)果up表示輸出變量的上限j . m表示輸?shù)倪呺H效應OutputsEcho PrintEiror MessagesReference Maps27Echo PrintReference MapsEquation ListingsModel StatisticsStatus ReportsSolution ReportsEcho Prints3284厶sets295i canning plart5 / sestcle, san-diegc /306j markets/ new-york, chicagor t

19、opeks / ;317328parameters33aJ3410a(i) c&pscLty of plant i in cases3511/ 3cS3tlc 35D3612san-diegc GOO /37133814b(j) cenand a二 market in case33915/ newyork 3254016Chicago 3004117topeka 275 / ;42184319table d(i,j) distance i.r thousancs of iciles4420new-ycrkChicago topeka4521seattlE4622san

20、diEgo /47248r A 鎳scalar z freight in collars per qasz per 100C ir.iles“0/ ;49255026paxametEi c(i,j) trarspcrz cost in lOQGs cf dollarsper case;51c(ij)二 fM(irj)/1000 ;variablesx(if j) shipment quanin essesz total transportution costs in 1000s of dollars;positiv己 variable x ;equationscost def

21、ine objictiv己 functionsupply (i) observe supply limit at plant idemand (j) satisfy demand at market j ;cost z =e= sum(i,j), c(1,j)(1,j);supply(i) . sumjr x(i,j) =1= a(i);demand (j) 5um(ir x(ir j) =g= b (j);model transport /all/ ;solve transport- using Ip zninimizing z ;display xl< x.m ;27Error Ma

22、ssagesset q quarterly time periods / spring, sum, £allz wtr / ;results in tlie echo1set. q quarterly time periods / spring, sum, fall 4 wtr / ;* $160(2 parameter c (i,j) transport cost in 1000s of dollars per case )C (i,j) = £ * a(i,j)/ 1000 ;16 parameter c (ir j) transport cost in 1000s o

23、f dollars per case17 c(i7j) = f*d(irj)/1000*$97$195$96$L94$1ERROR MESSAGES1 REAL NUMBER EXPECTED96 BLANK NEEDED BETWEEN IDENTIFIER AND TEXT(-OR-ILLEGAL CHARACTER IN IDENTIFIER)(0R-CHECK FOR HISSING ;r ON PREVIOUS LINE)97 EXPLANATORY TEXT CAN NOT START WITHor ,(0R-CHECK FOR MISSING ';r ON PREVIOUS LINE)194 SYhEOL REDEFINED195 SYMBOL REDEFINED WITH A DIFFERENT TYPEError Massages4 sets5 i canning plants /seattie, san/6 j markets /new-york, Chicago, topeka / ;77 tabledistance in thousand of miles8 new-york Chicagotopeka9 seatie*$17011gan-diego Status

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論