SlideShare a Scribd company logo
1 of 12
Download to read offline
An tutorial to AMPL




1
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


2
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?

3
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

4
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


5
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;

6
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 <=




7
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

8
A linear programming model

       Figure 1-1 shows the production problem in algebraic notation




9
The linear programming model in AMPL




10
The linear programming model in AMPL




11
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




12

More Related Content

Viewers also liked

investigacion de operaciones
investigacion de operacionesinvestigacion de operaciones
investigacion de operacionesManuel Yara
 
Unidad 6. Análisis del CVU
Unidad 6.  Análisis del CVUUnidad 6.  Análisis del CVU
Unidad 6. Análisis del CVUcloperaq
 
Clase solver
Clase solverClase solver
Clase solverjmnvit
 
Transparent electronics
Transparent electronicsTransparent electronics
Transparent electronicsAakash Varma
 
programacion lineal con analisis de sensibilidad
programacion lineal con analisis de sensibilidadprogramacion lineal con analisis de sensibilidad
programacion lineal con analisis de sensibilidadsmalicett
 
A presentation on electronic wallet
A presentation on electronic walletA presentation on electronic wallet
A presentation on electronic walletNitish Xavier Tirkey
 
Analisis de sensibilidad 2222222 (1)
Analisis de sensibilidad   2222222 (1)Analisis de sensibilidad   2222222 (1)
Analisis de sensibilidad 2222222 (1)Irene Sarcos
 
Análisis de sensibilidad.
Análisis de sensibilidad.Análisis de sensibilidad.
Análisis de sensibilidad.Hebzi01
 
Análisis de sensibilidad y riesgo
Análisis de sensibilidad y riesgoAnálisis de sensibilidad y riesgo
Análisis de sensibilidad y riesgoLBenites
 
EVO - Gamification in healthcare - Manu Melwin Joy
EVO - Gamification in healthcare - Manu Melwin JoyEVO - Gamification in healthcare - Manu Melwin Joy
EVO - Gamification in healthcare - Manu Melwin Joymanumelwin
 
Blockchain: The Information Technology of the Future
Blockchain: The Information Technology of the FutureBlockchain: The Information Technology of the Future
Blockchain: The Information Technology of the FutureMelanie Swan
 

Viewers also liked (16)

investigacion de operaciones
investigacion de operacionesinvestigacion de operaciones
investigacion de operaciones
 
HBase Lightning Talk
HBase Lightning TalkHBase Lightning Talk
HBase Lightning Talk
 
Unidad 6. Análisis del CVU
Unidad 6.  Análisis del CVUUnidad 6.  Análisis del CVU
Unidad 6. Análisis del CVU
 
Artificial Brain - Overview 2013
Artificial Brain - Overview 2013Artificial Brain - Overview 2013
Artificial Brain - Overview 2013
 
Clase solver
Clase solverClase solver
Clase solver
 
Digital wallet
Digital walletDigital wallet
Digital wallet
 
Transparent electronics
Transparent electronicsTransparent electronics
Transparent electronics
 
programacion lineal con analisis de sensibilidad
programacion lineal con analisis de sensibilidadprogramacion lineal con analisis de sensibilidad
programacion lineal con analisis de sensibilidad
 
A presentation on electronic wallet
A presentation on electronic walletA presentation on electronic wallet
A presentation on electronic wallet
 
Analisis de sensibilidad 2222222 (1)
Analisis de sensibilidad   2222222 (1)Analisis de sensibilidad   2222222 (1)
Analisis de sensibilidad 2222222 (1)
 
Análisis de sensibilidad.
Análisis de sensibilidad.Análisis de sensibilidad.
Análisis de sensibilidad.
 
Análisis de sensibilidad y riesgo
Análisis de sensibilidad y riesgoAnálisis de sensibilidad y riesgo
Análisis de sensibilidad y riesgo
 
seminar on invisible eye
seminar on invisible eyeseminar on invisible eye
seminar on invisible eye
 
EVO - Gamification in healthcare - Manu Melwin Joy
EVO - Gamification in healthcare - Manu Melwin JoyEVO - Gamification in healthcare - Manu Melwin Joy
EVO - Gamification in healthcare - Manu Melwin Joy
 
Blockchain: The Information Technology of the Future
Blockchain: The Information Technology of the FutureBlockchain: The Information Technology of the Future
Blockchain: The Information Technology of the Future
 
Lifi
LifiLifi
Lifi
 

Similar to Tutorial ampl

Network Planning and Optimization
Network Planning and OptimizationNetwork Planning and Optimization
Network Planning and OptimizationEM Legacy
 
Bba 3274 qm week 10 integer programming
Bba 3274 qm week 10 integer programmingBba 3274 qm week 10 integer programming
Bba 3274 qm week 10 integer programmingStephen Ong
 
chapter 2 revised.pptx
chapter 2 revised.pptxchapter 2 revised.pptx
chapter 2 revised.pptxDejeneDay
 
Linear Programming 1
Linear Programming 1Linear Programming 1
Linear Programming 1irsa javed
 
chapter 2 revised.pptx
chapter 2 revised.pptxchapter 2 revised.pptx
chapter 2 revised.pptxDejeneDay
 
chapter 2 revised.pptx
chapter 2 revised.pptxchapter 2 revised.pptx
chapter 2 revised.pptxDejeneDay
 
Power Quality Systems and Power Factor Correction Presentation
Power Quality Systems and Power Factor Correction PresentationPower Quality Systems and Power Factor Correction Presentation
Power Quality Systems and Power Factor Correction PresentationMircea Gingu
 
Vcs slides on or 2014
Vcs slides on or 2014Vcs slides on or 2014
Vcs slides on or 2014Shakti Ranjan
 
Economic Dispatch of Generated Power Using Modified Lambda-Iteration Method
Economic Dispatch of Generated Power Using Modified Lambda-Iteration MethodEconomic Dispatch of Generated Power Using Modified Lambda-Iteration Method
Economic Dispatch of Generated Power Using Modified Lambda-Iteration MethodIOSR Journals
 
Multiobjective load flow problem by whale optimization
Multiobjective load flow problem by whale optimizationMultiobjective load flow problem by whale optimization
Multiobjective load flow problem by whale optimizationRohit vijay
 
Lecture: Introduction to Linear Programming for Natural Resource Economists a...
Lecture: Introduction to Linear Programming for Natural Resource Economists a...Lecture: Introduction to Linear Programming for Natural Resource Economists a...
Lecture: Introduction to Linear Programming for Natural Resource Economists a...Daniel Sandars
 
CH-2 Linear Programing.pptx
CH-2 Linear Programing.pptxCH-2 Linear Programing.pptx
CH-2 Linear Programing.pptxRobiel1
 
Recent advances on large scheduling problems in CP Optimizer
Recent advances on large scheduling problems in CP OptimizerRecent advances on large scheduling problems in CP Optimizer
Recent advances on large scheduling problems in CP OptimizerPhilippe Laborie
 

Similar to Tutorial ampl (20)

Network Planning and Optimization
Network Planning and OptimizationNetwork Planning and Optimization
Network Planning and Optimization
 
Bba 3274 qm week 10 integer programming
Bba 3274 qm week 10 integer programmingBba 3274 qm week 10 integer programming
Bba 3274 qm week 10 integer programming
 
Ees 300
Ees 300Ees 300
Ees 300
 
chapter 2 revised.pptx
chapter 2 revised.pptxchapter 2 revised.pptx
chapter 2 revised.pptx
 
Unit.2. linear programming
Unit.2. linear programmingUnit.2. linear programming
Unit.2. linear programming
 
linear programming
linear programming linear programming
linear programming
 
Integer programming
Integer programmingInteger programming
Integer programming
 
Linear Programming 1
Linear Programming 1Linear Programming 1
Linear Programming 1
 
chapter 2 revised.pptx
chapter 2 revised.pptxchapter 2 revised.pptx
chapter 2 revised.pptx
 
chapter 2 revised.pptx
chapter 2 revised.pptxchapter 2 revised.pptx
chapter 2 revised.pptx
 
Recent progress in CPLEX 12.6.2
Recent progress in CPLEX 12.6.2Recent progress in CPLEX 12.6.2
Recent progress in CPLEX 12.6.2
 
Pooling optimization problem
Pooling optimization problemPooling optimization problem
Pooling optimization problem
 
Power Quality Systems and Power Factor Correction Presentation
Power Quality Systems and Power Factor Correction PresentationPower Quality Systems and Power Factor Correction Presentation
Power Quality Systems and Power Factor Correction Presentation
 
Vcs slides on or 2014
Vcs slides on or 2014Vcs slides on or 2014
Vcs slides on or 2014
 
Economic Dispatch of Generated Power Using Modified Lambda-Iteration Method
Economic Dispatch of Generated Power Using Modified Lambda-Iteration MethodEconomic Dispatch of Generated Power Using Modified Lambda-Iteration Method
Economic Dispatch of Generated Power Using Modified Lambda-Iteration Method
 
PRODUCTION CONCEPT
PRODUCTION CONCEPTPRODUCTION CONCEPT
PRODUCTION CONCEPT
 
Multiobjective load flow problem by whale optimization
Multiobjective load flow problem by whale optimizationMultiobjective load flow problem by whale optimization
Multiobjective load flow problem by whale optimization
 
Lecture: Introduction to Linear Programming for Natural Resource Economists a...
Lecture: Introduction to Linear Programming for Natural Resource Economists a...Lecture: Introduction to Linear Programming for Natural Resource Economists a...
Lecture: Introduction to Linear Programming for Natural Resource Economists a...
 
CH-2 Linear Programing.pptx
CH-2 Linear Programing.pptxCH-2 Linear Programing.pptx
CH-2 Linear Programing.pptx
 
Recent advances on large scheduling problems in CP Optimizer
Recent advances on large scheduling problems in CP OptimizerRecent advances on large scheduling problems in CP Optimizer
Recent advances on large scheduling problems in CP Optimizer
 

Recently uploaded

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationAadityaSharma884161
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 

Recently uploaded (20)

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint Presentation
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 

Tutorial ampl

  • 1. An tutorial to AMPL 1
  • 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 2
  • 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? 3
  • 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 4
  • 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 5
  • 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; 6
  • 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 <= 7
  • 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 8
  • 9. A linear programming model  Figure 1-1 shows the production problem in algebraic notation 9
  • 10. The linear programming model in AMPL 10
  • 11. The linear programming model in AMPL 11
  • 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 12