Tutorial ampl

ggpalomi 1,504 views 12 slides Aug 16, 2012
Slide 1
Slide 1 of 12
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12

About This Presentation

No description available for this slideshow.


Slide Content

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
Tags