Documente Academic
Documente Profesional
Documente Cultură
Real
Problem
OR Methodology Linear Programming
Scenarios
and techniques to analyze ► Combinatorial Optimization (next)
the consequences of decisions
Make a decision before their introduction to
reality.
LP & ILP introduction 3 LP & ILP introduction 4
OR Methodology OR Methodology
► Understand the solution the real context ► Linear programming (LP) is a widely used mathematical
§ Does the solution obtained makes sense in the real life? modeling technique designed to help managers in
§ Did we have considered all relevant components? planning and decision making relative to resource
► Take the decision allocation.
§ Evaluate the impact of the solution
§ Evaluate the decision process (model + method)
§ Review frequently the impact of the decision.
► The Linear Programming Models have 4 properties in ► Formulating a linear program involves developing a
common: mathematical model to represent the managerial problem.
§ All problems seek to maximize or minimize some quantity (the ► The steps in formulating a linear program are:
objective function). § Completely understand the managerial problem being faced.
§ Restrictions or constraints that limit the degree to which we can
§ Identify the objective and the constraints.
pursue our objective are present.
§ Define the decision variables.
§ There must be alternative courses of action from which to choose.
§ Use the decision variables to write mathematical expressions for
§ The objective and constraints in problems must be expressed in the objective function and the constraints.
terms of linear equations or inequalities.
► Understand well the problem (by words) ► A call center is hiring personnel since it is
§ What is the problem expanding to a 24h working period.
§ What is the decision we have to take? Can we make quantitative?
§ The call center works 24h a day, and needs personnel to
§ What are the constraints on the decisions?
attend the customers every hour.
§ What is the objective or how we are going to evaluate the solution?
§ The human recourses and the operations directors have
► Define the decision variables (math) estimate the number of persons in each interval of time.
► Define the constraints on the variables (math) § There are 6 intervals of time (4 hours each).
► Define the objective function (math) § The contract of the new employees is for 8h in a row.
► Solve it!!!
► Obtain the optimal solution of the LP Model ► LINEAR PROGRAMMING SOFTWARE SURVEY
► Exact Method § https://www.informs.org/ORMS-Today/Public-Articles/June-
Volume-44-Number-3/Linear-Programming-Software-Survey
§ The PL models are “easy” to be solved
§ June 2017
§ Simplex Method (Dantzig 1947)
* https://www.informs.org/ORMS-Today/OR-MS-Today-Software-
* Primal simplex
Surveys/Linear-Programming-Software-Survey
* Dual simplex
§ Vendors
§ Interior Point Method (Karmarkar 1984)
* GLPK (GNU Linear Programming Kit), Gurobi Optimizer, IBM ILOG
§ ALGORITMS / SOFTWARE CPLEX Optimization Studio, LINDO & LINGO, Premium Solver Pro,
* Excel Solver etc
* Commercial Software § Prices
* Open Software * Free to $4000/licence
LP & ILP introduction 23 LP & ILP introduction 24
Step 3. Adjacent
solution(2,6) with Step 4. Adjacent
z=360 solution (3,5) with
z=380
Excel Solver
► Sujeto a:
X2 0
X3 0
locate …
X1 0
X4 0 X2 0
X5 Constraints
0 X6 + X1 ≥ 9 X3 0
X6 0
§ parameters Parameters
X1 + X2 ≥ 8
X4
X5
0
0
Restricciones
Constraints X6 0
Parameters
§ variables X6 + X1 ≥ 9
X1 + X2 ≥ 8
0 >=
0 >=
9
8 X2 + X3 ≥ 3 Restricciones
X2 + X3 ≥ 3 0 >= 3 X6 + X1 ≥ 9 0 >= 9
§ constraints X3 + X4 ≥ 7 0 >= 7 X3 + X4 ≥ 7 X1 + X2 ≥ 8 0 >= 8
X4 + X5 ≥ 5 0 >= 5 X2 + X3 ≥ 3 0 >= 3
X5 + X6 ≥ 4 0 >= 4
X4 + X5 ≥ 5 X3 + X4 ≥ 7 0 >= 7
§ Objective function X4 + X5 ≥ 5 0 >= 5
X5 + X6 ≥ 4 X5 + X6 ≥ 4 0 >= 4
X j ≥ 0, j= 1,...,6.
=B4+B5
► Excel file
Objetivo min ∑ X
min 0 X1 8
X2 0
X1
X2
0
0 § callcenter.xlsx X3 5
X3 0 X4 2
X4 0 X5 3
X5 0
X6 1
X6 0
Restricciones Constraints
X6 + X1 ≥ 9 0 >= 9 X6 + X1 ≥ 9 9 >= 9
X1 + X2 ≥ 8 0 >= 8
X1 + X2 ≥ 8 8 >= 8
X2 + X3 ≥ 3 0 >= 3
X3 + X4 ≥ 7 0 >= 7
X2 + X3 ≥ 3 5 >= 3
X4 + X5 ≥ 5 0 >= 5
Minimize X3 + X4 ≥ 7 7 >= 7
X5 + X6 ≥ 4 0 >= 4 X4 + X5 ≥ 5 5 >= 5
X5 + X6 ≥ 4 4 >= 4
Empoyees
working
8+1 0+8 5+0 2+5 3+2 1+3
P0
Z = 8,5; 2,6 X1
► Solve the LP relaxation and round-off values X1 = 2,6 X2 = 4,2
X2 P1 X2 P2
§ Rounding may provide with a non-optimal solution. P1 P2 4,5
3,8
P0 + X 1 £ 2 P0 + X 1 ³ 3
§ Rounding may provide non-feasible solutions. Z1 = 8,3 Z2 = 8,3
X1 = 2 X2 = 4,5 X1 = 3 X2 = 3,8
§ Enumeration is generally not possible for large problems. P11 P12 P21 P22
X2 P11 X2
5
P12 X2 P21 X2 P22
P1 + X 2 £ 4 P1 + X2 ³ 5 P2 + X 2 £ 3 P1 + X 2 ³ 4 4 No
► Use Branch-and-bound algorithm Z11 = 7,6
X1 = 2 X2 = 4
Z12 = 8,0
X1 = 1 X2 = 5
Z21 = 8,0
X1 = 3,8 X2 = 3
3 factible
► You’re the manager of an airplane plant and you want to ► The profit and fixed costs are given in the following table:
determine the best product-mix of your six models to
Plane Profit Setup
produce. The six models currently under production are
Rocket 30 35
the Rocket, Meteor, Streak, Comet, Jet, and Biplane.
Meteor 45 20
Each plane has a known profit contribution. There is also
Streak 24 60
a fixed cost associated with the production of any plane in
Comet 26 70
a period.
Jet 24 75
Biplane 30 30
Source: Optimization Modeling with Lingo. LP & ILP introduction 55 Source: Optimization Modeling with Lingo. LP & ILP introduction 56
► Each plane is produced using six raw materials—steel, ► The problem is to determine the final mix of products that
copper, plastic, rubber, glass, and paint. maximizes net profit (gross profit – setup costs) without
► The units of these raw materials required by the planes as exceeding the availability of any raw material.
well as the total availability of the raw materials are: ► Your brand new Meteor model has the highest profit per
Rocket Meteor Streak Comet Jet Biplane Available unit of anything you’ve ever manufactured and the lowest
Steel 1 4 0 4 2 1 800 setup cost.
Copper 4 5 3 0 1 0 1160
► Maybe you should build nothing but Meteors? Then again,
Plastic 0 3 8 0 1 0 1780
Rubber 2 0 1 2 1 5 1050
maybe not.
Glass 2 4 2 2 2 4 1360
Paint 1 4 1 4 3 4 1240
► www.ampl.com
Symbolic model file Data file
§ http://ampl.com/products/ampl/ampl-for-students/
(.mod) (.dat)
§ Student version is limited to 300 variables and 300 constraints and
objectives
► Download the student version (amplcml.zip)
AMPL Solution
§ AMPL program (ampl.exe)
(.run) Report
§ Solver Gurobi (gurobi.exe) LP & MIP
§ Solver CPLEX (cplex.exe) LP & MIP & QP
§ Solver MINOS (minos.exe) NLP
SOLVER
(Cplex, Gurobi, Minos, …)
LP & ILP introduction 63 LP & ILP introduction 64
► A call center is hiring personnel since it is ► Need of additional employees for ofinterval
Interval times of time:
expanding to a 24h working period.
Period 1 2 3 4 5 6
§ The call center works 24h a day, and needs personnel to
0:00 – 4:00 – 8:00 – 12:00 – 16:00 – 20:00 –
attend the customers every hour. 4:00 h 8:00 h 12:00 h 16:00 h 20:00 h 24:00 h
§ The human recourses and the operations directors have Employees
estimate the number of persons in each interval of time. needed
9 8 3 7 5 4
§ There are 6 intervals of time (4 hours each).
§ The contract of the new employees is for 8h in a row.
► Which is the minimal number of employees that should be
hired?
# Symbolic model
# Variables
var production{i in PRODUCT} >= 0;
# Objective
maximize Profit: sum{i in PRODUCT} profit[i]*production[i];
# Constraints
subject to ResourcesAvailable{j in PROCESS}:
sum{i in PRODUCT} hours[j,i]*production[i] <= maxHours[j];
LP & ILP introduction 73 LP & ILP introduction 74
► highnote2.dat ► highnote2.run
data;
set PRODUCT:= CDplayer stereoRecv; # High Note Sound Company - Example 2
set PROCESS:= Electrician Technician; # Commands file ----------------------------------
► Objectives: ► show;
§ Displays the names of the sets, parameters, variables, constraints, and
§ maximize objective function of current LP model.
§ minimize ► reset;