Professional Documents
Culture Documents
Lecture 2
September 14, 2016
Last class
Todays agenda
Decisions
I
I
The model
max
s.t.
25xB + 30xC
(1/200)XB + (1/140)XC 40
0 XB 6000
0 XC 4000
Given:
I
I
I
I
I
P - a set of products
aj - tons per hour of product j, for each j P
b - hours available at the mill
cj - profit per ton of product j, for each j P
uj - maximum tons of product j, for each j P
The model
max
cj Xj
jP
s.t.
(1/aj )Xj b
jP
0 Xj uj , for each j P
Elements
sets
parameters
variables
an objective
constraints
AMPL keywords
set
param
var
maximize or minimize
subject to or s.t.
Files
I
Meaning
for every j in P
declare variables Xj for j in P
theP
coefficient cj
jP cj Xj
0 Xj uj for every j in P
steel.mod
Let index i denote the oil type and j denote the product
type (1 for gasoline and 2 for heating oil)
Decision variables
I
I
I
max
s.t.
10x11 + 5x21
8
x11 + x21
10x12 + 5x22
6
x12 + x22
x11 + x21 = 5y1
x12 + x22 = 10y2
xij 0, i = 1, 2, j = 1, 2
yj 0, j = 1, 2
Technical issues: x11 and x21 (x12 and x22 ) cannot both be
zero in the model, but it is a feasible decision for the
problem. (Try to solve the model in AMPL)
An abstract model
Suppose you need to solve the blending problem multiple times
with different products and parameters, how would you build
the abstract model?
I Define sets
I
I
Identify parameters
I
I
I
I
Sets
I
I
parameters
I
I
I
I
Decision variables
I
I
max
X
jJ
s.t.
X
X
pj (
xij )
yj
iI
jJ
xij bi , i I
qi xij rj
iI
xij , j J
iI
xij = dj yj , j J
iI
xij 0, i I, j J
yj 0, j J
I
I
Sets
I
I
Parameters
I
I
I
Set of vertices V
Set of arcs A {(i, j) | i V , j V }
max
xsj
X
j:(j,i)A
xjs
j:(j,s)A
j:(s,j)A
s.t.
xji
xij = 0, i V \ {s, t}
j:(i,j)A
(Bound constraints)
We will learn how to transcribe the model above to AMPL code later (we need sets of
ordered pairs in AMPL).
Sets
I
I
Set of vertices V
Set of arcs A {(i, j) | i V , j V }
I
I
max
xi
iV
s.t.
xi + xj 1, (i, j) A
(conflict constraints)
xi {0, 1}, i V
(Binary constraints)