Workshop 08 - Introduction to Process Optimization in GAMS
Short Description
optimization...
Description
Works or ksho hop p 08 – Introductio ntrod uction n to Process Process Optim pt imiza izati tion on In GAMS® AMS®
Jorge Mario Gómez R., Ph.D. Associate Professor
OPTIMIZATION OF CHEMICAL PROCESSES WORSHOP Contents GAMS® Workshop 08 •
•
•
–
Introduction to Process Optimization In GAMS®
Introduction to o ptimization in GAMS® GAMS® •
GAMS Structure
•
Precedents in GAMS optimization
•
Syntax of an input file (name.gms)
Trucks problem •
Problem
•
Problem formulation
•
Solution
Bonus
References
GAMS® Introduction to Optimization in GAMS®
•
General Algebraic Modeling System (GAMS)
•
Modeling system for mathematical programming and optimization.
•
Free licence limited to 300 variables and 300 constraints.
•
A large amount of availiable solvers.
•
It has a large library with a lot of examples.
•
It allows to solve most of the problems that arise in optimization.
•
Intuitive transcription of the “ paper formulation into the GAMS code.
•
http://www.gams.com
”
GAMS® GAMS® Structure
Input GAMS file (NAME.gms)
Compilation and expansion in
Output GAMS file (NAME.lst)
Solver
•
Common language through platforms and versions.
•
Easy application of different solvers.
•
Sintax and logic revision previous to solving.
•
Easy interpretation of the output files.
•
Almost none interaction of the user and the solver .
GAMS® GAMS® Structure •
Problem formulation:
•
Sorts of problems: Solvers
min , (,) s.t. ℎ , = 0 , ≤ 0 ℝ, ℤ
LP: CPLEX, XPRESS, CBC. MIP: CPLEX, XPRESS, CBC. NLP: CONOPT, IPOPT, KNITRO, MINOS. MINLP: DICOPT, BONMIN,SCIP. •
Focus: It takes advantage of the power of the existing solvers.
Less emphasis in the building of algorithms. More emphasis in the formulation of the model and its refinement.
GAMS® GAMS® Structure “…This task requires the
following elements:
Sets Parameters Variables Constraints Objective function…” Page 1 in [1]
Parts of an optimization problem Sets indexes Given data Decision variables Constraints Objective function
•
•
•
•
•
Input in GAMS SET PARAMETERS VARIABLES EQUATIONS EQUATION
GAMS® Syntax of in Input File Essential parts of a *.gms file SETS PARAMETERS VARIABLES EQUATIONS
Problem sets; Problem parameters; Problem variables; Problem equations;
------------------------------------------------------------Problem formulation The objective function and the constraints are formulated here; ------------------------------------------------------------MODEL name of the model /equations included in the model/; SOLVE name of the model USING sort of problem MINIMIZING/MAXIMIZING objective variable;
GAMS® Syntax of in Input File •
All declarations finish with a “;”.
•
“EQUATIONS” stands for equality and inequality constraints o o o
•
=E= =G= =L=
equal than. greater or equal than. less or equal than.
Take a look at the GAMS User’s Guide at Google for information about Mathematical functions. For example: Exponentiation power(x,n); o o x**m; o sqr(x);
ℝ, ℤ → ∗ ∗ ⋯∗ > 0, ℝ → exp ∗ ln ℝ → ∗ 2
•
•
Variable attributes: x.LO, x.UP, x.L. These attributes are used to define the variable bounds and their o initialization, except for the objective variable variable_funobj. Comments with ‘*’ at the begining of the line
GAMS® Syntax of in Input File SOLVE name of the model USING sort of problem MINIMIZING/MAXIMIZING objective variable lp qcp nlp dnlp mip rmip miqcp minlp rmiqcp rminlp mcp mpec cns
For linear programming For quadratic constraint programming For nonlinear programming For nonlinear programming with discontinuous derivatives For mixed integer programming For relaxed mixed integer programming For mixed integer quadratic constraint programming For mixed integer nonlinear programming For relaxed mixed integer quadratic constraint programming For relaxed mixed integer nonlinear programming For mixed complementarity problems For mathematical programs with equilibrium constraints For constrained nonlinear systems
GAMS® Syntax of in Input File SOLVE name of the model USING sort of problem MINIMIZING/MAXIMIZING objective variable
GAMS® Syntax of in Input File SOLVE name of the model USING sort of problem MINIMIZING/MAXIMIZING objective variable
Default solver for nlp is ipopt;
GAMS® Trucks Problem - Problem Before starting!!! Create a new project (File/Project/New Project).
GAMS® Trucks Problem - Problem A tracking company has borrowed $600.000 for new equipment and is contemplating three kinds of trucks. Truck A costs $10.000, truck B $20.000, and truck C $23.000. How many trucks of each kind should be ordered to obtain the greatest capacity in ton-mile per day base on the following data? •
•
•
•
Truck A requires one driver per day and produces 2.100 ton-miles per day Truck B requires two drives per day and produces 3.600 ton-miles per day Truck C requires two drives per day and produces 3.780 ton-miles per day There is a limit of 30 trucks and 145 drives. Reference [1], Problem 1.8, Page 29.
GAMS® Trucks Problem – Problem Formulation Sets:
= ,,
Let be
the set containing the types of truck. Index
Scalars
_: _: _: Parameters
_ : _ : _ : Variables:
∈ ℤ+ : :
Maximum resources, [$] Maximum of trucks, [-] Maximum of drivers, [-]
∈ ∈
Purchase cost by truck type, [$] Drivers required for each type of truck, [-] Production by truck type, [ton-miles per day]
∈
∈
Number of trucks by truck type, [-] Total production per day, [ton-miles/day]
GAMS® Trucks Problem – Problem Formulation Constraints:
_: _: _:
Maximum drivers; [-]
_ ∗ ≤ _
∈
Maximum of trucks; [-]
≤ _
∈
Maximum cost; [$]
_ ∗ ≤ _
∈ Objective function:
_:
Total Maximum production, [ton-miles per day]
max = _ ∗ ∈
GAMS® Trucks Problem – Solution Sets:
= ,,
Let be
the set containing the types of truck.
Scalars
_: _: _:
Maximum resources, [$] Maximum of trucks, [-] Maximum of drivers, [-]
GAMS® Trucks Problem – Solution Parameters
_ : _ : _ :
∈ ∈
Purchase cost by truck type, [$] Drivers required for each type of truck, [-] Production by truck type, [ton-miles per day]
∈
GAMS® Trucks Problem – Solution
Variables:
∈ ℤ+ :
Number of trucks by truck type,
∈ [-]
Variables:
:
Total production per day, [ton-miles/day]
GAMS® Trucks Problem – Solution Constraints:
_: _: _ :
∈ _ ∗ ≤ _ ∈ ≤ _ ∈ _ ∗ ≤ _
GAMS® Trucks Problem – Solution
Objective function:
_:
Total Maximum production, [ton-miles per day]
max = _ ∗ ∈
GAMS® Trucks Problem – Solution
GAMS® Trucks Problem – Solution
GAMS® Trucks Problem – Solution
GAMS® Trucks Problem – Solution
GAMS® Trucks Problem – Solution
GAMS® Trucks Problem – Solution
GAMS Bonus 8 In the Optibeer brewery are four different kinds of beers: light, lager, ale and premium. Each kind of beer uses different amounts of the four main components of beer: water, malt, hops and yeast. Each kind of beer has a different utility in dollars. Maximize the revenue of the Optibeer brewery based on the fact that each raw material has certain availability. “
”
“
”
Required amount of component in each beer (lb/L) Light
Lager
Ale
Premium
Availability (lb)
Water
7
6
5
4
Unlimited
Malt
1
1
0
3
50
Hops
2
1
2
1
150
Yeast
1
1
1
4
80
Utility ($/L)
6
5
3
7
Adapted from Reference [4]
GAMS Practice The Fresh Milk cooperative supplies milk in gallon jugs from its two warehouses located in Buffalo (New York) and Williamsport (Pennsylvania). It has a capacity of 2000 gallons per day at Buffalo and 1600 gallons per day at Williamsport. It delivers 800 gallons/day to Rochester (New York). Syracuse (New York) requires 1440 gallons/day and the remainder (1360 gallons) are trucked to New York City. The cost to ship the milk to each of the destinations is different and is given in the following table. Establish the shipping strategy for minimum cost.
GAMS® References
[1] E. Thomas F, D. Himmelblau, and L. Lasdon, OPTIMIZATION OF CHEMICAL PROCESSES, Second Edition. New York: McGraw-Hill, 2001. [2] Rosenthal, R.E. (2015) A GAMS Tutorial, in GAMS – A User’s Guide [3] GAMS Homepage. Recovered from http://www.gams.com/ [4] Dantzig G. B., Linear Programming and Extensions, Princeton University Press, Princeton, New Jersey, 1963, Chapter 3-3.
View more...
Comments