This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: MthSc 810: Mathematical Programming Lecture 6 Pietro Belotti Dept. of Mathematical Sciences Clemson University September 13, 2011 Sep. 13: AMPL . Reading: Bob Fourers notes, Chapters 1-2 Reading for Sep. 15: textbook, Sections 3.1 and 3.2 AMPL a modeling language for optimization problems an interface between problems and solvers easy, intuitive syntax its interpreted 1 that means errors are spotted as soon as they are executed. can be used from a command line interface or by editing command files and submitting them 1 As opposed to compiled . Example r h If we knew radius r and height h , the volume would be r 2 h qty of tin would be 2 r 2 + 2 rh r 2 h must be V = 20in 3 h = V r 2 Variables r : radius of the cans base h : height of the can Objective 2 rh + 2 r 2 ( minimize ) Constraints r 2 h = V h > r > The tin can problem var r >= 0; var h >= 0; minimize tin_foil: 2*3.14*r2 + 2*3.14*r*h; vol_fixed: 3.14 * r2 * h = 20; AMPL: Variables The command var specifies a variable of the problem, its bounds, its type, and (possibly) an initial value. var x1 >= 0 <= 4; var numtrucks >= 3 integer default 5; var buyObj1 binary; AMPL: Constraints Constraints are preceded by a name and a : myconstr1: x1 + 3*x2 + x3 <= 4; c2: numtrucks >= ntr_AZ + ntr_NY + ntr_PA; at_most_1: buyObj1 + buyObj2 + buyObj3 <= 1; AMPL: Objective function Preceded by either minimize or maximize , name of the objective, and : minimize xpense: 10*numtrucks + 3*numcars; minimize myfun: x1*x2 - 2*x3; maximize distance: x1 + 2*cos(x3); Caveats the semicolon : all commands must end with one 2 ; comments: # this wont be interpreted...
View Full Document
This note was uploaded on 03/14/2012 for the course MTHSC 810 taught by Professor Staff during the Fall '08 term at Clemson.
- Fall '08