0% found this document useful (0 votes)
10 views

Practise Script

The document contains examples of linear programming models for supply chain problems. It includes parameters, variables, and equations defining objectives and constraints for problems involving multiple plants and markets. Sample data and models are provided to maximize profit or minimize costs while meeting demand and capacity limits.

Uploaded by

Huỳnh Huỳnh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Practise Script

The document contains examples of linear programming models for supply chain problems. It includes parameters, variables, and equations defining objectives and constraints for problems involving multiple plants and markets. Sample data and models are provided to maximize profit or minimize costs while meeting demand and capacity limits.

Uploaded by

Huỳnh Huỳnh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

PRACTISE 1 – 15/04/2024 – video tutorial

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);

model example1 /OF,CR/


solve example1 maximizing F using lp;
display F.l, x.l, c, b, a;
Practise 1 – 16/04 – chapter 1 - ex

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;

model tutorial1 /OF,CR/


solve tutorial1 maximizing F using mip;
display x.l, F.l;
Practise 2 – 16-04 – chapter 1 - ex

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;

model knapsack /all/


solve knapsack maximizing F using mip;
display x.l, F.l;
Practise 3 – 16-04 – chapter 1 - ex

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;

model knapsack /all/


solve knapsack maximizing F using mip;
display x.l, F.l;
Practise 1 – 17-04-2024 – ex 1 – chap 2

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/
;

table c(i,j) cost of producing and shipping from i to j


Was Phi Atl
Bo 5 4 3
NY 4 7 2
De 2 3 8
;

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
;

variable TC total costs;

equations
OF objective function (sum of costs)
DS demand satisfaction from the market j
CR capacity restriciom from the plant i
;

OF .. TC =E= sum(i,f(i)*y(i)) + sum((i,j),c(i,j)*x(i,j));


DS(j) .. sum(i,x(i,j)) =E= b(j);
CR(i).. sum(j,x(i,j)) =L= k(i)*y(i);

model CPLM /all/;


solve CPLM using mip minimizing TC;
Practise 1 – 20-04-2024 – ex book

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)
;

OF .. TC =E= sum(i,f(i)*y(i)) + sum(i,froof(i)*yroof(i)) + sum((i,j),c(i,j)*x(i,j));


DS(j) .. sum(i,x(i,j)) =E= D(j);
CR(i) .. sum(j,x(i,j)) =L= K(i)*y(i) + Kroof(i)*yroof(i);
EO(i) .. y(i) + yroof(i) =L= 1;

model CPLM /all/;


solve CPLM using mip minimizing TC;
Practise 1 – 21-04-2024 – ex book

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/
;

table c(i,j) cost of producing and shipping from i to j


NorAm EU Japan SoAm Asia
USA 600 1300 2000 1200 1700
Germany 1300 600 1400 1400 1300
Japan 2000 1400 300 2100 900
Brazil 1200 1400 2100 800 2100
India 2200 1300 1000 2300 800
;

positive variable
x(i,j) quantity of producing and shipping from i to j
;

variable TC total costs;

Equations
OF objective function (sum of costs)
DS demand satisfaction
CR capacity restriction
K_Condition condition for each plant capacity
;

OF .. TC =E= sum(i,G(i)) + sum((i,j),c(i,j)*x(i,j));


DS(j) .. sum(i,x(i,j)) =E= D(j);
CR(i) .. sum(j, x(i,j)) =L= K(i);
K_Condition(i) .. sum(j, x(i,j)) =G= K(i)*0.5;

model CPLM /all/;


solve CPLM using mip minimizing TC;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy