AMPL Presentation 1 By Raymond Kleinberg Outline AMPL - Ugh! - What is it good for? Basics Starting a Problem Running the Problem Example.

Slides:



Advertisements
Similar presentations
Algorithm Design Methods (I) Fall 2003 CSE, POSTECH.
Advertisements

Solving LP Models Improving Search Special Form of Improving Search
Lecture 3 Linear Programming: Tutorial Simplex Method
Linear programming: lp_solve, max flow, dual CSC 282 Fall 2013.
Linear Programming (LP) (Chap.29)
What is GAMS?. While they are not NLP solvers, per se, attention should be given to modeling languages like: GAMS- AIMMS-
LPs and MIPs background and solution approaches Dr. Greg Bernstein Grotto Networking
EE 553 Integer Programming
Lecture 10: Integer Programming & Branch-and-Bound
CSCI 573 Linear and Mixed Integer Programming Sven Koenig.
Progress in Linear Programming Based Branch-and-Bound Algorithms
GAMS/GAMSIDE AGEC 641 Lab, Fall 2011 Mario Andres Fernandez Based on material written by Gillig and McCarl and improved upon by previous lab instructors.
Linear Programming and CPLEX Ting-Yuan Wang Advisor: Charlie C. Chen Department of Electrical and Computer Engineering University of Wisconsin-Madison.
AMPL An Introduction. Outline AMPL - What is it (good for)? Basics Starting a Problem Running the Problem Example.
Dealing with NP-Complete Problems
Computational Methods for Management and Economics Carla Gomes
Program Design and Development
Optimization for Network Planning Includes slide materials developed by Wayne D. Grover, John Doucette, Dave Morley © Wayne D. Grover 2002, 2003 E E 681.
QM B Linear Programming
MAE 552 – Heuristic Optimization Lecture 26 April 1, 2002 Topic:Branch and Bound.
1 An tutorial to AMPL. 2 Introduction Mathematical programming is a technique for solving certain kinds of problems --- notably maximizing profits and.
Lecture outline Support vector machines. Support Vector Machines Find a linear hyperplane (decision boundary) that will separate the data.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Branch and Bound Algorithm for Solving Integer Linear Programming
Computational Methods for Management and Economics Carla Gomes Module 4 Displaying and Solving LP Models on a Spreadsheet.
1 Contents college 3 en 4 Book: Appendix A.1, A.3, A.4, §3.4, §3.5, §4.1, §4.2, §4.4, §4.6 (not: §3.6 - §3.8, §4.2 - §4.3) Extra literature on resource.
Chapter 3 Introduction to Optimization Modeling
456/556 Introduction to Operations Research Optimization with the Excel 2007 Solver.
How to Play Sudoku & Win Integer Programming Formulation of a Popular Game Sven LeyfferSven Leyffer, Argonne, Feb. 15, 2005 (windoze powerpoint sumi painting.
START EXCEL BUILD OR RETRIEVE YOUR OPTIMIZATION MODEL SAVE YOUR WORKBOOK!! CHOOSE “Solver…” IN THE “Tools” MENU SPECIFY IN SOLVER DIALOG BOX: 1.CELL TO.
Network Models II Shortest Path Cross Docking Enhance Modeling Skills Modeling with AMPL Spring 03 Vande Vate.
Integer Programming Key characteristic of an Integer Program (IP) or Mixed Integer Linear Program (MILP): One or more of the decision variable must be.
1 ILOG CPLEX CPLEX is a product developed by ILOG to solve  LPs  MIPs  QPs  MIQPs  Network Flow problems CPLEX technologies  CPLEX callable library.
1 Lecture 26 – Problem Page 617 Military Problem with Three Commanders Six Radar Stations Each Commander Should Be Assigned Two Radar Stations C1C2C3.
CP Summer School Modelling for Constraint Programming Barbara Smith 2. Implied Constraints, Optimization, Dominance Rules.
Linear Programming with Excel Solver.  Use Excel’s Solver as a tool to assist the decision maker in identifying the optimal solution for a business decision.
DAY 10: EXCEL CHAPTER 8, 9, 10 Tazin Afrin September 23,
Goal Seek and Solver. Goal seeking helps you n Find a specific value for a target cell by adjusting the value of one other cell whose value is allowed.
WOOD 492 MODELLING FOR DECISION SUPPORT
Chapter 24 – Multicriteria Capital Budgeting and Linear Programming u Linear programming is a mathematical procedure, usually carried out by computer software,
WOOD 492 MODELLING FOR DECISION SUPPORT Lecture 3 Basics of the Simplex Algorithm.
1 Lagrangean Relaxation --- Bounding through penalty adjustment.
1.224J Recitation #2 Integer Programs. Topics Questions & office hrs Sensitivity analysis review Importance of linear IP formulation –Branch and bound.
15.053Tuesday, April 9 Branch and Bound Handouts: Lecture Notes.
1 Iterative Integer Programming Formulation for Robust Resource Allocation in Dynamic Real-Time Systems Sethavidh Gertphol and Viktor K. Prasanna University.
CPS Brief introduction to linear and mixed integer programming
FATCOP: A Mixed Integer Program Solver Michael FerrisQun Chen Department of Computer Sciences University of Wisconsin-Madison Jeff Linderoth, Argonne.
WOOD 492 MODELLING FOR DECISION SUPPORT Lecture 18 Branch and Bound Algorithm.
1 Lecture 24 – HW #10 Discrete Optimization Models Problem on page 619 We need to move our natural gas from two fields to our main terminal. F1 F2S2.
FATCOP: A Mixed Integer Program Solver Michael FerrisQun Chen University of Wisconsin-Madison Jeffrey Linderoth Argonne National Laboratories.
CPS Computational problems, algorithms, runtime, hardness (a ridiculously brief introduction to theoretical computer science) Vincent Conitzer.
Anytime Planning of Optimal Schedules for a Mobile Sensing Robot JINGJIN YU JAVED ASLAM SERTAC KARAMAN DANIELA RUS SPEAKER: SANKALP ARORA.
Linear Programming Wyndor Glass Co. 3 plants 2 new products –Product 1: glass door with aluminum framing –Product 2: 4x6 foot wood frame window.
Chapter 6 Optimization Models with Integer Variables.
Exploring Microsoft Office Exploring Excel Appendix C
CPS Brief introduction to linear and mixed integer programming
Stat 261 Two phase method.
Lecture 11: Tree Search © J. Christopher Beck 2008.
Excel Solver.
Linear Programming Wyndor Glass Co. 3 plants 2 new products
EMIS 8373: Integer Programming
MIP Tools Branch and Cut with Callbacks Lazy Constraint Callback
Using WinQSB to solve Linear Programming Models
A Mathematical Programming Language
Coding Concepts (Basics)
Brief introduction to linear and mixed integer programming
CPS 173 Computational problems, algorithms, runtime, hardness
Applied Statistical and Optimization Models
Applied Statistical and Optimization Models
Presentation transcript:

AMPL Presentation 1 By Raymond Kleinberg

Outline AMPL - Ugh! - What is it good for? Basics Starting a Problem Running the Problem Example

AMPL Ugh! - What is it good for?

AMPL does: Solves simple LP’s (Slightly older than CDs) Solves not-so-simple LP’s Solves hard LP’s Solves IP’s Solves MIP’s (that does not include Will Smith!) You’ll see how much it can do!!

Basics Files you will need How to write them How to save them

Writing the.mod file Open up OxEdit and type the file - we’ll learn how to do that later.

Saving the file Save the file as a mod file e.g. helloworld.mod

Syntax of File As with any computer language, AMPL requires the file it reads to be a certain way. The first set of problems we will do will only require one file and the format is very simple and natural. Here’s how it goes.

Order of entry Enter the variables first: var x1 >=0; var Sally >=4.5; var smileyface <=-1; var happy integer >=0;

Order of Entry- Cont. Next enter the objective: maximize OBJ: 3*x1 - happy + 2*Sally; minimize COST: 3*x3 + 2*x1 - Sally; maximize WHOCARES: 0;

Order of Entry - Cont. Next enter the constraints: subject to WOOD: 2*x1 - 40*happy<=27; subject to WORK: x *Sally<=34; subject to MACHINE: happy - Sally<=14;

Put it all together: var x1 >=0; var Sally >=4.5; var smileyface <=-1; var happy integer >=0; maximize OBJ: 3*x1 - happy + 2*Sally + 4.5*smileyface; subject to WOOD: 2*x1 - 40*happy<=27; subject to WORK: x *Sally<=34; subject to MACHINE: happy - 3*smileyface<=14;

Running the File Once you have the file written and saved, we need to run it to get our solution.

How to Run AMPL Open up AMPL Tell AMPL what you want solved by: “model data\project1.mod;” If you want to use a different solver: “option solver ;” Tell AMPL to solve it: “solve;”

Getting the variables This will only give you the optimal value, if it exists. How do you know the variable values that give this objective? Tell AMPL to give them to you: “display x1,x3,Sally,happy,smileyface;” This will display the variable values Remember, AMPL is case sensitive.

Put it all together ampl: model data\ampl1.mod; ampl: option solver cplex; ampl: solve; CPLEX 8.0.0, optimal integral solution found, objective value 712.2, 0 MIP iterations, 0 branch and bound nodes display x1,x3,Sally,smileyface,happy; x1 = 0 x3 = -1 Sally = happy = 11 smileyface = 0

That’s it. You’ve seen that AMPL can solve many types of programming problems with lots of variables and constraints. Later you will see more of its power when it comes to streamlining the problem and running it more efficiently.