Practise Script
Practise Script
sets
I restrictions /1,2,3/
J columns /1*4/
;
parameter
c(j) coefficient of objective function /1 90, 2 50, 3 70, 4 40/
b(i) capacity restriction /1 30
2 24
3 36/
;
table a(i,j) parameter of capacity usage
1 2 3 4
1 2 -1 1 2
2 1 2 3 -1
3 3 2 -1 2
;
free Variables
F variable of objective function
;
positive Variables
x(j) quantity of j
;
Equations
OF objective function
CR capacity restriction
;
OF..F=E=sum(j, c(j)*x(j));
CR(i).. sum(j,a(i,j)*x(j)) =L= b(i);
sets
I columns /1,2,3,4,5/
;
Parameter
b(i) coefficient of objective function /1 1, 2 2, 3 3, 4 4, 5 5/
K capacity restriction /5/
w(i) parameter of capacity usage /1 1, 2 2, 3 3, 4 4, 5 5/
;
free Variables
F variables of objective function
;
binary Variables
x(i) quantity of i
;
Equations
OF objective function
CR capacity restriction
;
OF..F=E=sum(i, b(i)*x(i));
CR.. sum(i,w(i)*x(i)) =L= K;
sets
i columns /1,2,3,4,5/
;
Parameter
b(i) coefficient of objective function /1 1, 2 2, 3 3, 4 4, 5 5/
w(i) parameter of capacity usage /1 1, 2 2, 3 3, 4 2, 5 1/
K capacity /5/
;
free Variables
F variable of objective function
;
binary Variables
x(i) quantity of item i
;
equations
OF objective function
CC capacity constraint
;
OF .. F =E= sum(i,b(i)*x(i));
CC .. sum(i,w(i)*x(i)) =L= K;
sets
i columns /1,2,3,4,5/
;
Parameter
b(i) coefficient of objective function /1 1, 2 2, 3 3, 4 4, 5 5/
w(i) parameter of capacity usage /1 1, 2 2, 3 1, 4 2, 5 1/
K capacity /5/
;
free Variables
F variable of objective function
;
binary Variables
x(i) quantity of item i
;
equations
OF objective function
CC capacity constraint
;
OF .. F =E= sum(i,b(i)*x(i));
CC .. sum(i,w(i)*x(i)) =L= K;
set
I potential plant /Bo, NY, De/
J market /Was, Phi, Atl/
;
Parameter
f(i) fixed cost plant i opening /Bo 20, NY 25, De 15/
b(j) demand from market j /Was 10, Phi 12, Atl 14/
k(i) capacity restriction of plant i /Bo 25, NY 23, De 20/
;
positive variable
x(i,j) quantity of producing and shipping from i to j
;
binary Variable
y(i) 1 if plant is built and 0 is otherwise
;
equations
OF objective function (sum of costs)
DS demand satisfaction from the market j
CR capacity restriciom from the plant i
;
Set
I potential plants /NY, At, Chi, San/
J markets /East, South, Midwest, West/
;
Parameter
D(j) demand from market j /East 110000, South 180000, Midwest 120000, West 100000/
K(i) capacity of low capacity plant i
Kroof(i) capacity of high capacity plant i
f(i) fixed cost of low capacity plant i opening /NY 6, At 5.5, Chi 5.6, San 6.1/
froof(i) fixed cost of high capacity plant i opening /NY 10, At 9.2, Chi 9.3, San 10.2/
;
K(i)=200000;
Kroof(i)=400000;
table c(i,j) cost of producing and shipping one unit from plant i to market j
East South Midwest West
NY 211 232 240 300
At 232 212 230 280
Chi 238 230 215 270
San 299 280 270 225
;
positive variable
x(i,j) quantity of producing and shipping from plant i to market j
;
binary variable
y(i) 1 if plant is built with low capacity and 0 is otherwise
yroof(i) 1 if plant is built with high capacity and 0 is otherwise
;
variable TC total costs;
Equations
OF objective function (sum of costs)
DS demand satisfaction for each market j
CR capacity restriction for each market i
EO either y(i) or g(i)
;
set
I potential plants /USA, Germany, Japan, Brazil, India/
J markets /NorAm, EU, Japan, SoAm, Asia/
;
parameter
G(i) cost of production of each plant i /USA 10000, Germany 7530, Japan 16740, Brazil 7306,
India 9200/
D(j) demand for each market j /NorAm 270, EU 200, Japan 120, SoAm 199, Asia 100/
K(i) capacity for each plant i /USA 185, Germany 475, Japan 50, Brazil 200, India 80/
;
positive variable
x(i,j) quantity of producing and shipping from i to j
;
Equations
OF objective function (sum of costs)
DS demand satisfaction
CR capacity restriction
K_Condition condition for each plant capacity
;