1 / 14

An tutorial to AMPL

An tutorial to AMPL. Introduction. Mathematical programming is a technique for solving certain kinds of problems --- notably maximizing profits and minimizing costs --- subject to constraints on resources, capacities, supplies, demands, and the like

dane
Download Presentation

An tutorial to AMPL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An tutorial to AMPL

  2. Introduction • Mathematical programming is a technique for solving certain kinds of problems --- notably maximizing profits and minimizing costs --- subject to constraints on resources, capacities, supplies, demands, and the like • AMPL is a language for specifying such optimization problems

  3. A two-variable linear program • Tons per hour : Bands 200 Coils 140 Profit per ton : Bands $25 Coils $30 Maximum tons : Bands 6000 Coils 4000 If 40 hours of production time are available, how many tons of bands and how many tons of coils should be produced to bring in the greatest total profit?

  4. A two-variable linear program • X : the number of tons of bands to be produced Y : the number of tons of coils to be produced • Maximize 25X+30Y Subject to : 0=<X<=6000 0=<Y<=4000 (X/200)+(Y/140)<=40

  5. The two-variable linear program in AMPL • Var X; Var Y; maximize Profit : 25*X+30*Y; subject to Time : (1/200)*X+(1/140)*Y<=40 subject to X_limit : 0<=X<=6000 subject to Y_limit : 0<=Y<=4000 • The file – call it prod0.mod

  6. The two-variable linear program in AMPL • Solve prod0.mod ampl : model prod0.mod; ampl : solve; MINOS 5.5 : optimal solution found. 2 iterations, objective 192000 ampl : display X, Y; X=6000 Y=1400 ampl : quit;

  7. The two-variable linear program in AMPL • Each variable is named in a var statement • Each constraint by a statement that begins with subject to and a name like X_limit or Time for the constraint • Multiplication requires an explicit * operator • ≦ relation is written <=

  8. The two-variable linear program in AMPL • model : reads the file into AMPL • solve : to have AMPL translate your linear program, sends it to a linear program solver, and then return the answer • MINOS 5.5 : indicates that AMPL uses version 5.5 of a solver called MINOS • Often there is more than one solution that achieves the optimal objectives, however, in which case different solvers may report different optimal values for the variables

  9. A linear programming model • Figure 1-1 shows the production problem in algebraic notation

  10. The linear programming model in AMPL

  11. The linear programming model in AMPL

  12. AMPL interfaces • Refer to AMPL web site, www.ampl.com, for more up to date information and resources • For GUI • http://www.ampl.com/GUI/expermt.html

  13. Connecting CPLEX Server • Step 1 連線 用Putty的SSH 或者 在有裝linux的機器上執行 ssh -l scc 140.116.247.232 • step 2 設定路徑 然後在自己家目錄下的.bash_profile檔案裡 在PATH=$PATH:$HOME/bin這一行之後加入以下四行 ILOG_LICENSE_FILE=/ILOG/ilm/access.ilm export ILOG_LICENSE_FILE PATH=$PATH:/ILOG/ampl2002 PATH=$PATH:/ILOG/ilm

  14. Connecting CPLEX Server • step 3 執行 ampl model 2.mod; data 2.dat; solve; quit; • Note Cplex Server一次只能一個人進去執行

More Related