Presentation is loading. Please wait.

Presentation is loading. Please wait.

Michal Koháni Department of Transportation Networks Faculty of Management Science and Informatics University of Zilina, Slovakia XPRESS – IVE Seminary.

Similar presentations


Presentation on theme: "Michal Koháni Department of Transportation Networks Faculty of Management Science and Informatics University of Zilina, Slovakia XPRESS – IVE Seminary."— Presentation transcript:

1 Michal Koháni Department of Transportation Networks Faculty of Management Science and Informatics University of Zilina, Slovakia XPRESS – IVE Seminary

2  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 2 XPRESS – IVE Basic Features

3  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 3 XPRESS – IVE Student Version

4 4 XPRESS – IVE

5 5

6 6

7 7

8 8

9 9

10  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 Production Problem

11 11 Production Problem Model

12 ◦ Name of the model ◦ Options ◦ Parameters ◦ Declarations (variables, arrays) ◦ External Data Entry ◦ Objective Function ◦ Structural Constraints ◦ Output and solution 12 Production Problem

13 model Production_Problem uses “mmxprs” declarations x1,x2 : mpvar end-declarations 13 Production Problem Model Name, Declarations

14 ! Objective function Profit:= 80*x1 + 50*x2 ! constraints 2*x1 + 1.5*x2 <= 100 0.4*x1 + 0.2*x2 <= 16 maximize(Profit) 14 Production Problem Objective Function, Contraints

15 ! Value of objective function - getobjval writeln(“Total Profit: “, getobjval) ! Values of variables – getsol() writeln(“x1 = “,getsol(x1)) writeln(“x2 = “,getsol(x2)) end-model 15 Production Problem Output, Solution

16 16 The Transportation Problem Demands b j tons of cement of customers j = 1, 2, 3, 4 are to be satisfied as cheap as possible, where the values of b j are 7, 8, 10 a 11 respectively. The demands can be satisfied only from warehouses i = 1, 2, 3, which disposes with supplies a i tons of cement, where the values of a i 10, 15, 11 respectively. The unit costs for transportation of one ton of cement from warehouse i to customer j are c ij (see the table). c ij 1234 14553 26678 35775

17 17 The Transportation Problem Model

18 18 The Transportation Problem Model

19 ◦ Name of the model ◦ Options ◦ Parameters ◦ Declarations (variables, arrays) ◦ Data Entry ◦ Objective Function ◦ Structural Constraints ◦ Output and solution 19 The Transportation Problem

20 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 The Transportation Problem Model Name, Declarations

21 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) <= a(i) forall (j in 1..4) sum (i in 1..3) x(i,j) = b(j) minimize(Cost) 21 The Transportation Problem Objective Function, Contraints

22 ! 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 The Transportation Problem Output, Solution

23 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. 23 Producer P Customers 1 1 1 1 1 1 1 1

24 24 Producer P =s Customers 1 1 1 1 1 1 1 1 The prime cost e 0 is 2000 and e 1 is 1000 per km. Handling cost g i =0 and b j =1. P1P1 P2P2 C1C1 C2C2 C3C3 C4C4 d ij PP1P1 P2P2 C1C1 C2C2 C3C3 C4C4 P 0344455 P1P1 3011122 P2P2 4102211

25 25 Producer P=s Customers 1 1 1 1 1 1 1 1 P1P1 P2P2 C1C1 C2C2 C3C3 C4C4 d ij PP1P1 P2P2 C1C1 C2C2 C3C3 C4C4 P 0344455 P1P1 3011122 P2P2 4102211 c ij PP1P1 P2P2 C1C1 C2C2 C3C3 C4C4 P 8810 P1P1 5577 P2P2 8866

26 26 Producer P=s Customers 1 1 1 1 1 1 1 1 P1P1 P2P2 C1C1 C2C2 C3C3 C4C4

27 ◦ Name of the model ◦ Options ◦ Parameters ◦ Declarations (variables, arrays) ◦ External Data Entry ◦ Objective Function ◦ Structural Constraints ◦ Output and solution 27 XPRESS – IVE

28 model ToyExample uses “mmxprs” … !other sections end-model 28

29 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 29

30 ! Objective function Cost:=6*y2+6*y3+8*z11+5*z21+8*z31+8*z12+5*z22+8*z32+ 10*z13+7*z23+6*z33+10*z14+7*z24+6*z34 ! constraints z11+z21+z31=1 z12+z22+z32=1 z13+z23+z33=1 z14+z24+z34=1 z11<=y1 … z34<=y3 minimize(Cost) !you don’t need to declare Cost 30

31 ! 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)) 31

32 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 32

33 33

34 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 34

35 initializations from “ToyData.txt” f;c; end-initializations Structure of the input file “ToyData.txt”: f:[0,6,6] c:[8, 8,10,10, 5, 5, 7, 7, 8, 8, 6, 6] 35

36 ! Objective function Cost:=sum(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)<=y(i) minimize(Cost) !you don’t need to declare Cost 36

37 ! 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))) 37

38 38 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. 12 34 5 6 7 8 9 10 22 26 10 12 10 16 26 10 1210 12 14 10 12 10 20 customers i i’ D j a ij =1 a i’j =0

39 39 d ij 12345678910 101224382210 262234 2120 26341020202622 32412014484822 2010 43826140626236 222412 a ij 12345678910 11110111010 21110011011 31111011111 40011000111 Distance matrix Incidental matrix

40 40 Mathematic model of the Maximum distance problem

41 41 Let us consider that local authorities want to locate p=2 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. 12 34 5 6 7 8 9 10 22 26 10 12 10 16 26 10 1210 12 14 10 12 10 20

42 42 d ij 12345678910 101224382210 262234 2120 26341020202622 32412014484822 2010 43826140626236 222412 Distance matrix

43 43

44 44 Let us consider that local authorities want to locate p=2 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. 12 34 5 6 7 8 9 10 22 26 10 12 10 16 26 10 1210 12 14 10 12 10 20

45 45  The 2-Centre Problem consists in minimizing the maximum distance between customer and the nearest located facility: d ij 12345678910 101224382210 262234 2120 26341020202622 32412014484822 2010 43826140626236 222412 Distance matrix

46 46

47 47 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 b j, but only when its distance from some located facility is less or equal than 25 km. Each customer’s demand is equal to 10 (b j =10) 12 34 5 6 7 8 9 10 22 26 10 12 10 16 26 10 1210 12 14 10 12 10 20

48 48 d ij 12345678910 101224382210 262234 2120 26341020202622 32412014484822 2010 43826140626236 222412 a ij 12345678910 11110111010 21110011011 31111011111 40011000111 Distance matrix Incidental matrix

49 49


Download ppt "Michal Koháni Department of Transportation Networks Faculty of Management Science and Informatics University of Zilina, Slovakia XPRESS – IVE Seminary."

Similar presentations


Ads by Google