Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
OPTIMIZATION
MODELS
The art of modeling
7. Display results
Use .l
Choosing solvers
Choosing solvers
In our example we use CPLEX
You can use different solvers for different types of problems
Linear Programming: CPLEX, XPRESS, COINIPOPT, . . .
Mixed Integer Programming: CPLEX, XPRESS, . . .
Mixed Integer Quadratic Programs: CPLEX, . . .
Nonlinear Programming (local): CONOPT, MINOS, SNOPT, . . .
Nonlinear Programming (global): BARON, LINDOGLOBAL, . . .
Nonlinear Mixed Integer Programming: BARON, LINDOGLOBAL,
COINBONMIN, . . .
Instead of using the command option lp=cplex;" inside of
your GAMS code, you can set your default choice of solvers.
GAMS solution
Model 2. Feed Mix Problem
An agricultural mill produces animal feed mix by combining limestone, corn and
soybean meal. The price (in cents) per kg of limestone, corn and soybean are
10, 30.5 and 90 respectively. The final product must contain:
At least 0.8% of calcium
No more than 1.2% of calcium
At least 22% of protein
At most 5% of fiber
The nutrient contents of the ingredients are as follows:
1kg of limestone contains 0.38kg of calcium, negligible amounts of protein
and fiber.
1kg of corn contains 0.001kg of calcium, 0.09kg of protein and 0.02kg of
fiber
1kg of soybean meal contains 0.002kg of Calcium, 0.5kg of protein and
0.08kg of fiber.
Find the composition of the feed mix that satisfies these conditions and
minimize the cost
Model 2. Feed Mix Problem
Un Agricultor produce la mezcla de alimentacin mediante la combinacin de piedra
caliza, maz y harina de soja. El precio (en centavos de dlar) por kg de piedra caliza,
el maz y la soja son 10, 30.5 y 90, respectivamente. El producto final debe contener:
Al menos 0,8% de calcio
No ms de 1,2% de calcio
Al menos 22% de la protena
A lo sumo 5% de fibra
Machines
Jobs
How to assign jobs to every machine?
Machines
Jobs
Model 4. Job Machine Assignment
problem
Mathematical formulation:
6 3
j=1 m=1 rjm xjm
s.t.
3
m=1 xjm 1 j = 1,2,,6
6
j=1 pj xjm PAm m = 1,2,3
x1m + x3m 1 m = 1,2,3
x52 + x62 1
6
j=1 xj3 2
xjm 0,1 j = 1,2,,6 m = 1,2,3
Model 4. Job Machine Assignment
problem
This is an assignment problem
We use indexing or subscripts to represent a
collection of similar quantities with a single symbol
We use only binary variables
This is an Integer Programming model (IP)
What is the difference between binary variables
and discrete variables?. Give examples
Now, we will learn how to use sets in GAMS
GAMS model for Job Machine
Assignment problem
GAMS model for Job Machine
Assignment problem
GAMS results for Job Machine
Assignment problem
Model 5. Production-Delivery Problem
Fordco produces cars in Detroit and Dallas. The Detroit plant can
produce up to 6,500 cars. Producing a car costs $2,000 in Detroit. The
Dallas plant can produce up to 6,000 cars. Producing a car costs
$1,800 in Dallas. Cars must be shipped to three cities: New Orleans
(NO), Chicago (C) and New York (NY). Car demands are 2,000 at
(NO), 4,000 at (C) and 3,000 at (NY). The cost of shipping a car is
presented in the following table:
From/To NO C NY
Detroit $800 $600 $300
Dallas $500 $200 $200
At most 2,700 cars can be shipped from a given plant to a given city.
Fordco wishes to minimize the cost of meeting demand.
Model 5. Production-Delivery Problem
Fordco produce automviles en Detroit y Dallas. La planta de Detroit
puede producir hasta 6.500 coches. La produccin de un coche cuesta $
2,000 en Detroit. La planta de Dallas puede producir hasta 6.000
coches. La produccin de un coche cuesta $ 1.800 en Dallas. Los
vehculos deben ser enviados a tres ciudades: Nueva Orleans (NO),
Chicago (C) y Nueva York (NY). demandas de coches son 2.000 al
(NO), 4.000 en (C) y 3.000 al (NY). El costo de envo de un automvil
se presenta en la siguiente tabla:
From/To NO C NY
Detroit $800 $600 $300
Dallas $500 $200 $200
Mathematical formulation
2 3
=1 =1 +
s.t.
3
=1 = 1,2
2
=1 = 1,2,3
2,700 = 1,2 = 1,2,3
+ = 1,2 = 1,2,3
Model 5. Production-Delivery Problem
Road or
connections
(edges)
Cities
(nodes)
GAMS model for Production-Delivery
Problem
GAMS model for Production-Delivery
Problem
GAMS results for Production-Delivery
Problem