{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

mthsc810-lecture06-2x2

# mthsc810-lecture06-2x2 - AMPL MthSc 810 Mathematical...

This preview shows pages 1–3. Sign up to view the full content.

MthSc 810: Mathematical Programming Lecture 6 Pietro Belotti Dept. of Mathematical Sciences Clemson University September 13, 2011 Sep. 13: AMPL . Reading: Bob Fourer’s 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 it’s 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 Ifweknew 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 can’s base h : height of the can Objective 2 π rh + 2 π r 2 ( minimize ) Constraints π r 2 h = V h > 0 r > 0 The tin can problem var r >= 0; var h >= 0; minimize tin_foil: 2*3.14*rˆ2 + 2*3.14*r*h; vol_fixed: 3.14 * rˆ2 * h = 20;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
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 won’t be interpreted to solve a problem, choose a
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

mthsc810-lecture06-2x2 - AMPL MthSc 810 Mathematical...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online