Title: Michal Kohni
1XPRESS IVE Seminary
- Michal Koháni
- Department of Transportation Networks
- Faculty of Management Science and Informatics
- University of Zilina, Slovakia
2XPRESS IVE Basic Features
- is an advanced modeling and solving language and
environment, where optimization problems can be
specified and solved with the utmost precision
and clarity - enables you to gather the problem data from text
files and a range of popular spreadsheets and
databases, and gives you access to a variety of
solvers, which can find optimal or near-optimal
solutions to your model - Some features easy syntax, supports dynamic
objects, - More information www.dashoptimization.com
3XPRESS IVE Student Version
- Maximum number of constraints (rows) 400
- Maximum number of variables (columns) 800
- Maximum number of matrix coefficients (elements)
5000 - Maximum number of binary and integer variables,
etc (global elements) 400
4XPRESS IVE
5XPRESS IVE
6XPRESS IVE
7XPRESS IVE
8XPRESS IVE
9XPRESS IVE
10Production Problem
- An enterpriser produces and sells chips and
French-fries at unit profits of 80 and 50 crowns
per kilogram of the products respectively. - To produce 1 kg of chips, there is necessary 2 kg
of potatoes and 0.4 kg of oils. To produce 1 kg
of French-fries, it is necessary 1.5 kg of
potatoes and 0.2 kg of oil. - The enterpriser bought 100 kg of potatoes and 16
kg of oils, when they were on stock. Which
quantities of the particular products should the
enterpriser produce to maximize his profit and
not to exceed the limited quantities of potatoes
and oil?
10
11Production Problem Model
11
12Production Problem
- Name of the model
- Options
- Parameters
- Declarations (variables, arrays)
- External Data Entry
- Objective Function
- Structural Constraints
- Output and solution
12
13Production Problem Model Name, Declarations
- model Production_Problem
- uses mmxprs
- declarations
- x1,x2 mpvar
- end-declarations
13
14Production Problem Objective Function, Contraints
- ! Objective function
- Profit 80x1 50x2
- ! constraints
- 2x1 1.5x2 lt 100
- 0.4x1 0.2x2 lt 16
- maximize(Profit)
14
15Production Problem Output, Solution
- ! Value of objective function - getobjval
- writeln(Total Profit , getobjval)
- ! Values of variables getsol()
- writeln(x1 ,getsol(x1))
- writeln(x2 ,getsol(x2))
- end-model
15
16The Transportation Problem
Demands bj tons of cement of customers j 1, 2,
3, 4 are to be satisfied as cheap as possible,
where the values of bj are 7, 8, 10 a 11
respectively. The demands can be satisfied only
from warehouses i 1, 2, 3, which disposes with
supplies ai tons of cement , where the values of
ai 10, 15, 11 respectively. The unit costs for
transportation of one ton of cement from
warehouse i to customer j are cij (see the
table).
16
17The Transportation Problem Model
17
18The Transportation Problem Model
18
19The Transportation Problem
- Name of the model
- Options
- Parameters
- Declarations (variables, arrays)
- Data Entry
- Objective Function
- Structural Constraints
- Output and solution
19
20The Transportation Problem Model Name,
Declarations
- model Transportation_Problem
- uses mmxprs
- declarations
- x array (1..3, 1..4) of mpvar !variables
- a array (1..3) of integer !supplies
- b array (1..4) of integer !demands
- c array (1..3, 1..4) of integer !Trans.unit
cost - end-declarations
20
21The Transportation Problem Objective Function,
Contraints
- a 10, 15, 11
- b 7, 8, 10, 11
- c 4, 5, 5, 3,
- 6, 6, 7, 8,
- 5, 7, 7, 5
- ! Objective function
- Cost sum (i in 1..3, j in 1..4) c(i,j)x(i,j)
- ! constraints
- forall (i in 1..3) sum (j in 1..4) x(i,j) lt a(i)
- forall (j in 1..4) sum (i in 1..3) x(i,j) b(j)
- minimize(Cost)
21
22The Transportation Problem Output, Solution
- ! Value of objective function - getobjval
- writeln(Total Cost , getobjval)
- ! Values of variables with loop getsol()
- forall (i in 1..3, j in 1..4)
- writeln ( x ,i,,,j, , getsol (x(i,j)))
- end-model
22
23Uncapacited Facility Location ProblemToy example
from Wednesday
- Let us consider one producer P and four
customers, which are supplied each day with one
item of product each. Customers can be supplied
only by trucks and each truck can carry exactly
one item of the product at transportation cost
2000 crowns per unit distance. But, there is a
railway, which starts from P and goes near to the
customers through two places, where transshipment
places may be constituted (each for 6000 crown
per day) . This transportation means is able to
transports one item at 1000 crowns per distance
unit.
24Uncapacited Facility Location Problem Toy
example from Wednesday
- The prime cost e0 is 2000 and e1 is 1000 per km.
- Handling cost gi 0 and bj1.
1
1
1
C1
C2
1
1
P1
1
Customers
1
1
P2
C3
C4
25Uncapacited Facility Location Problem Toy
example from Wednesday
1
1
1
C1
C2
1
1
P1
1
Customers
1
1
P2
C3
C4
26Uncapacited Facility Location Problem Toy
example from Wednesday
1
1
1
C1
C2
1
1
P1
1
Customers
1
1
P2
C3
C4
27XPRESS IVE
- Name of the model
- Options
- Parameters
- Declarations (variables, arrays)
- External Data Entry
- Objective Function
- Structural Constraints
- Output and solution
28Writing a model in Mosel Name of the model
options
- model ToyExample
- uses mmxprs
- !other sections
- end-model
29Writing a model in Mosel Declarations of
decision variables
- declarations
- y1,y2,y3 mpvar
- z11,z12,z13,z14,z21,z22,z23,z24 mpvar
- z31,z31,z33,z34 mpvar
- end-declarations
- y1 is_binary
- y2 is_binary
- y3 is_binary
- z11 is_binary
- z12 is_binary
-
- z34 is_binary
30Writing a model in Mosel Objective function
constraints
- ! Objective function
- Cost6y26y38z115z218z318z125z228z3
2 - 10z137z236z3310z147z246z34
- ! constraints
- z11z21z311
- z12z22z321
- z13z23z331
- z14z24z341
- z11lty1
-
- z34lty3
- minimize(Cost) !you dont need to declare Cost
31Writing a model in Mosel Output results
- ! Value of objective function - getobjval
- writeln(Total cost , getobjval)
- ! Value of decision variable
- writeln(y1 ,getsol(y1))
- writeln(y2 ,getsol(y2))
- writeln(y3 ,getsol(y3))
- writeln(z11 ,getsol(z11))
- writeln(z21 ,getsol(z21))
- writeln(z31 ,getsol(z31))
-
- writeln(z34 ,getsol(z34))
32Writing a model in Mosel Results
- Total cost 30
- y1 1
- y2 1
- y3 0
- z11 0
- z12 0
- z13 0
- z14 0
- z21 1
- z22 1
- z23 1
- z24 1
- z31 0
- z32 0
- z33 0
- z34 0
33Writing a model in Mosel Loops, sums data
from file
34Writing a model in Mosel Declarations of
variables using arrays loops
- declarations
- y array (1..3) of mpvar
- z array (1..3,1..4) of mpvar
- f array (1..3) of integer
- c array (1..3,1..4) of integer
- end-declarations
- forall (i in 1..3) y(i) is_binary
- forall (i in 1..3,j in 1..4) z(i,j) is_binary
35Writing a model in Mosel Data input
- initializations from ToyData.txt
- fc
- end-initializations
- Structure of the input file ToyData.txt
- f0,6,6
- c8, 8,10,10,
- 5, 5, 7, 7,
- 8, 8, 6, 6
36Writing a model in Mosel Objective function
constraints
- ! Objective function
- Costsum(i in 1..3) f(i)y(i) sum(i in 1..3,j
in 1..4) - c(i,j)z(i,j)
- ! Constraints
- forall (j in 1..4) sum(i in 1..3) z(i,j)1
- forall (i in 1..3, j in 1..4) z(i,j)lty(i)
- minimize(Cost) !you dont need to declare Cost
37Writing a model in Mosel Output results
- ! Value of objective function
- writeln(Total cost , getobjval)
- ! Values of decision variable
- forall(i in 1..3) writeln(y(,i,)
,getsol(y(i))) - forall(i in 1..3, j in 1..4)
- writeln(z(,i,,,j,) ,getsol(z(i,j)))
38Maximum distance problem Toy example
Let us consider that local authorities want to
locate ambulance vehicles at some places from the
set 1, 2, 3 and 4 so that a distance from the
worst located dwelling place from set 1, 2, ,
10 to an ambulance be at most 25 km.
i
i
aij1
aij0
customers
j
D
39Maximum distance problem Toy example
Distance matrix
Incidental matrix
40Maximum distance problem Toy example
Mathematic model of the Maximum distance problem
41p-Median Problem
Let us consider that local authorities want to
locate p2 facilities at some places from the set
1, 2, 3 and 4 so that an average distance
between customer and the nearest facility should
be minimized.
42p-Median Problem
Distance matrix
43p-Median ProblemToy example from Tuesday
44p-Centre ProblemToy example
Let us consider that local authorities want to
locate p2 fire brigades at some places from the
set 1, 2, 3 and 4 so that a distance from the
worst located dwelling place from set 1, 2, ,
10 to a fire brigade be minimal.
45p-Centre ProblemToy example
- The 2-Centre Problem consists in minimizing the
maximum distance between customer and the nearest
located facility
Distance matrix
46p-Centre ProblemToy example
47Maximum covering location problem Toy example
Let us consider that computer vendor want to
locate 1 shop at some places from the set 1, 2,
3 and 4 . The number p of facilities is fixed,
but not each customer must be served. Service of
customer j brings profit, which is proportional
to its demand bj , but only when its distance
from some located facility is less or equal than
25 km. Each customers demand is equal to 10
(bj10)
48Maximum covering location problem Toy example
Distance matrix
Incidental matrix
49Maximum covering location problem Toy example
from Tuesday