mthsc810-lecture06-1x2

mthsc810-lecture06-1x2 - MthSc 810: Mathematical...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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

Page1 / 12

mthsc810-lecture06-1x2 - MthSc 810: Mathematical...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online