Professional Documents
Culture Documents
Optimization In GAMS®
Compilation and
Input GAMS file expansion in Output GAMS file
(NAME.gms) (NAME.lst)
Solver
• Problem formulation:
min 𝐹(𝑥, 𝑦)
𝑥,𝑦
s. t. ℎ 𝑥, 𝑦 = 0
𝑔 𝑥, 𝑦 ≤ 0
𝑥 𝜖 ℝ, 𝑦 𝜖 ℤ
• Sorts of problems: Solvers
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.
Department of Chemical Engineering / Process Optimization Workshop / IQUI – 3042
GAMS®
GAMS® Structure
-------------------------------------------------------------
Problem formulation The objective function and the constraints are
formulated here;
-------------------------------------------------------------
• 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.
Sets:
𝑇 = 𝐴, 𝐵, 𝐶 Let be 𝑇 the set containing the types of truck. Index 𝑡
Scalars
𝐶_𝑡𝑜𝑡: Maximum resources, [$]
𝑀𝑎𝑥_𝑡: Maximum of trucks, [-]
𝑀𝑎𝑥_𝑑: Maximum of drivers, [-]
Parameters
𝑇_𝑐𝑜𝑠𝑡 𝑡 : Purchase cost by truck type, 𝑡 ∈ 𝑇 [$]
𝑇_𝑑𝑟𝑖𝑣𝑒𝑟 𝑡 : Drivers required for each type of truck, 𝑡 ∈ 𝑇 [-]
𝑇_𝑝𝑟𝑜𝑑 𝑡 : Production by truck type, 𝑡 ∈ 𝑇 [ton-miles per day]
Variables:
𝑁 𝑡 ∈ ℤ+ : Number of trucks by truck type, 𝑡 ∈ 𝑇 [-]
𝑍: Total production per day, [ton-miles/day]
Constraints:
𝐷𝑚𝑎𝑥_𝑒𝑞: Maximum drivers; [-]
𝑇_𝑑𝑟𝑖𝑣𝑒𝑟 𝑡 ∗ 𝑁 𝑡 ≤ 𝑀𝑎𝑥_𝑑
𝑡∈𝑇
𝑇𝑚𝑎𝑥_𝑒𝑞: Maximum of trucks; [-]
𝑁 𝑡 ≤ 𝑀𝑎𝑥_𝑡
𝑡∈𝑇
𝐶𝑚𝑎𝑥_𝑒𝑞: Maximum cost; [$]
𝑇_𝑐𝑜𝑠𝑡 𝑡 ∗ 𝑁 𝑡 ≤ 𝐶_𝑡𝑜𝑡
𝑡∈𝑇
Objective function:
𝑃𝑟𝑜𝑑_𝑡𝑜𝑡: Total Maximum production, [ton-miles per day]
max 𝑍 = 𝑇_𝑝𝑟𝑜𝑑 𝑡 ∗ 𝑁 𝑡
𝑡∈𝑇
Sets:
𝑇 = 𝐴, 𝐵, 𝐶 Let be 𝑇 the set containing the types of truck.
Scalars
𝐶_𝑡𝑜𝑡: Maximum resources, [$]
𝑀𝑎𝑥_𝑡: Maximum of trucks, [-]
𝑀𝑎𝑥_𝑑: Maximum of drivers, [-]
Variables:
𝑁 𝑡 ∈ ℤ+ : Number of trucks by truck type, 𝑡 ∈ 𝑇 [-]
Variables:
𝑍: Total production per day, [ton-miles/day]
Constraints:
𝐷𝑚𝑎𝑥_𝑒𝑞: 𝑡 ∈ 𝑇 𝑇_𝑑𝑟𝑖𝑣𝑒𝑟 𝑡 ∗ 𝑁 𝑡 ≤ 𝑀𝑎𝑥_𝑑
𝑇𝑚𝑎𝑥_𝑒𝑞: 𝑡 ∈ 𝑇 𝑁 𝑡 ≤ 𝑀𝑎𝑥_𝑡
𝐶𝑚𝑎𝑥_𝑒𝑞: 𝑡 ∈ 𝑇 𝑇_𝑐𝑜𝑠𝑡 𝑡 ∗ 𝑁 𝑡 ≤ 𝐶_𝑡𝑜𝑡
Objective function:
𝑃𝑟𝑜𝑑_𝑡𝑜𝑡: Total Maximum production, [ton-miles per day]
max 𝑍 = 𝑇_𝑝𝑟𝑜𝑑 𝑡 ∗ 𝑁 𝑡
𝑡∈𝑇
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.
Parcial 1. 2013-10
Department of Chemical Engineering / Process Optimization Workshop / IQUI – 3042
GAMS®
References