Service System Design in Uncertain Environment Computer Seminaries

  • Slides: 50
Download presentation
Service System Design in Uncertain Environment Computer Seminaries, part 1 Michal Koháni Departement of

Service System Design in Uncertain Environment Computer Seminaries, part 1 Michal Koháni Departement of Transportation Networks Faculty of Management Science and Informatics University of Zilina, Slovakia Høgskolen i Molde, September 17 - 21, 2012

Exam & Grading Exam on Friday afternoon – at 1 PM in A 076

Exam & Grading Exam on Friday afternoon – at 1 PM in A 076 Solving of simple service system problem ◦ Analyze the problem ◦ Construction of mathematical model of the problem ◦ Solve the model using IP solver Xpress Final grade is PASS or FAIL Consultation before the exam on Friday morning at 10 AM in A 076 2

Xpress IVE (basic features) Universal tool for solving various MP problems ◦ ◦ Linear

Xpress IVE (basic features) Universal tool for solving various MP problems ◦ ◦ Linear programming Integer programming Quadratic programming Heuristics Uses the high-level language MOSEL Libraries for embedding ◦ Mosel libraries – solving procedures, … ◦ Connection between XPRESS Ive and other programming languages (C, C++, C#, Java, Visual Basic) www. fico. com 3

Xpress IVE (basic features) Getting started with XPRESS, release 7 4

Xpress IVE (basic features) Getting started with XPRESS, release 7 4

MOSEL Language (basic features) is an advanced modeling and solving language and environment, where

MOSEL Language (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, … 5

Xpress-IVE (student restricted version) Maximum number of constraints (rows): 400 Maximum number of variables

Xpress-IVE (student restricted 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 6

FICO Xpress-IVE Start > Programs > Xpress IVE 7

FICO Xpress-IVE Start > Programs > Xpress IVE 7

FICO Xpress-IVE 8

FICO Xpress-IVE 8

FICO Xpress-IVE 9

FICO Xpress-IVE 9

FICO Xpress-IVE 10

FICO Xpress-IVE 10

FICO Xpress-IVE 11

FICO Xpress-IVE 11

Mosel Xpress-IVE 12

Mosel Xpress-IVE 12

Transportation Problem Toy example Let us consider two producers (bakery) (B 1, B 2

Transportation Problem Toy example Let us consider two producers (bakery) (B 1, B 2 ) and four customers (C 1, C 2, C 3, C 4). Bakery B 1 can produce max. 800 pcs of bread per day, bakery B 2 can produce max. 600 pcs of bread per day. Customers need 150, 250, 350 and 450 pcs of bread per day. Transportation costs for transport of one bread from bakery to customer are in the table. Find the cheapest delivery plan. 13

Transportation Problem Mathematical model Decision variable: xij How many pcs. of bread we will

Transportation Problem Mathematical model Decision variable: xij How many pcs. of bread we will transport from bakery i to customer j Constraints: - Each bakery has limits for producing bread - Each customer must get enough of bread 14

Transportation Problem Mathematical model 15

Transportation Problem Mathematical model 15

How to write a model in Mosel Xpress-IVE Name of the model & options

How to write a model in Mosel Xpress-IVE Name of the model & options Parameters Declarations (decision variables, arrays, etc. ) Data input Objective function Constraints Output & results 16

Writing a model in Mosel Name of the model & options model Toy. Example

Writing a model in Mosel Name of the model & options model Toy. Example uses "mmxprs" … !other sections (Text in green = Comment only) end-model 17

Writing a model in Mosel Declarations of decision variables declarations x 11, x 12,

Writing a model in Mosel Declarations of decision variables declarations x 11, x 12, x 13, x 14, x 21, x 22, x 23, x 24 : mpvar end-declarations x 11 is_integer x 12 is_integer x 13 is_integer x 14 is_integer x 21 is_integer x 22 is_integer x 23 is_integer x 24 is_integer 18

Writing a model in Mosel Objective function & constraints ! Objective function Cost: =2*x

Writing a model in Mosel Objective function & constraints ! Objective function Cost: =2*x 11+4*x 12+5*x 13+6*x 24+7*x 21+5*x 22+3*x 23+x 24 ! constraints x 11+x 12+x 13+x 14<=800 x 21+x 22+x 23+x 24<=600 x 11+x 21>=150 x 12+x 22>=250 x 13+x 23>=350 x 14+x 24>=450 minimize(Cost) !you don’t need to declare Cost 19

Writing a model in Mosel Output & results ! Value of objective function -

Writing a model in Mosel Output & results ! Value of objective function - getobjval writeln(" Total cost: ", getobjval) ! Value of decision variable writeln(" x 11 = ", getsol(x 11)) writeln(" x 12 = ", getsol(x 12)) writeln(" x 13 = ", getsol(x 13)) writeln(" x 14 = ", getsol(x 14)) writeln(" x 21 = ", getsol(x 21)) writeln(" x 22 = ", getsol(x 22)) writeln(" x 23 = ", getsol(x 23)) writeln(" x 24 = ", getsol(x 24)) 20

Transportation Problem Mathematical model Capacity of bakery i We will denote it as ai

Transportation Problem Mathematical model Capacity of bakery i We will denote it as ai Demand of customer j We will denote it as bj 21

Transportation Problem Mathematical model 22

Transportation Problem Mathematical model 22

Writing a model in Mosel Declarations of decision variables declarations a: array (1. .

Writing a model in Mosel Declarations of decision variables declarations a: array (1. . 2) of integer b: array (1. . 4) of integer c: array (1. . 2, 1. . 4) of integer x: array (1. . 2, 1. . 4) of mpvar end-declarations forall (i in 1. . 2) forall (j in 1. . 4) x(i, j) is_integer a: : [800, 600] b: : [150, 250, 350, 450] c: : [2, 4, 5, 6, 7, 5, 3, 1] 23

Writing a model in Mosel Objective function & constraints ! Objective function Cost: =sum

Writing a model in Mosel Objective function & constraints ! Objective function Cost: =sum (i in 1. . 2, j in 1. . 4) c(i, j)*x(i, j) ! Constraints forall (i in 1. . 2) sum (j in 1. . 4) x(i, j) <= a(i) forall (j in 1. . 4) sum (i in 1. . 2) x(i, j) >= b(j) minimize(Cost) !you don’t need to declare Cost 24

Writing a model in Mosel Output & results ! Value of objective function -

Writing a model in Mosel Output & results ! Value of objective function - getobjval writeln(" Total cost: ", getobjval) ! Value of decision variable forall (i in 1. . 2, j in 1. . 4) writeln(" x (", i, ", ", j, ") = ", getsol(x(i, j))) 25

How to write a model in Mosel Xpress-IVE Name of the model & options

How to write a model in Mosel Xpress-IVE Name of the model & options Parameters Declarations (decision variables, arrays, etc. ) Data input Objective function Constraints Output & results 26

How to write a model (1) Name of the model & options model Model.

How to write a model (1) Name of the model & options model Model. Name options … uses "mmxprs" … !other sections end-model For comment write “!” before the commented words 27

How to write a model (2) Parameters – optional section model Model. Name !parameters

How to write a model (2) Parameters – optional section model Model. Name !parameters section first parameters MAXTIME=300 USE_LOG=false !. . . end-parameters !Rest of the model (declarations, statements, etc. ) end-model 28

How to write a model (3) Declarations (variables, arrays, etc. ) declarations Variable :

How to write a model (3) Declarations (variables, arrays, etc. ) declarations Variable : mpvar Variable. Array : array() of mpvar Integer. Variable : mpvar Binary. Variable : mpvar end-declarations Integer. Variable is_integer !when integer variable Binary. Variable is_binary !when binary variable 29

How to write a model (4) Data input – optional section declarations Unit. Cost

How to write a model (4) Data input – optional section declarations Unit. Cost : array(1. . 10) of integer end-declarations initializations from "Filename" Unit. Cost; end-initializations 30

How to write a model (5) Objective function Cost: =2*x 1+3*x 2 !. .

How to write a model (5) Objective function Cost: =2*x 1+3*x 2 !. . . constraints minimize(Cost) !you don’t need to declare Cost or Profit: =2*x 1+3*x 2 !. . . constraints miximize(Profit) !you don’t need to declare Profit 31

How to write a model (6) Constraints ! simple constraint X 1+3*X 2 -5*X

How to write a model (6) Constraints ! simple constraint X 1+3*X 2 -5*X 3<=8 ! multiple constraints using loop forall(i in 1. . 10) Z(i)=1 ! sum constraint sum(i in 1. . 10) X(i)<=B ! multiple sum constraints using loop forall(i in 1. . 5) sum (j in 1. . 10) X(i, j)=1 32

How to write a model (7) Output & results ! Value of objective function

How to write a model (7) Output & results ! Value of objective function - getobjval writeln("Objective value: ", getobjval) ! Value of decision variable writeln("X 1 = ", getsol(X 1)) ! Values of decision variables in array using loop forall(i in 1. . M) writeln(" Y(", i, ") = ", getsol(Y(i))) 33

Uncapacited Facility Location Problem Toy example n Producer P =s n The prime cost

Uncapacited Facility Location Problem Toy example n Producer P =s n The prime cost e 0 is 2000 and e 1 is 1000 per km. Handling cost gi =0 and bj=1. 1 1 C 3 1 1 1 P 2 1 C 2 Customers dij P P 1 P 2 C 1 C 2 C 3 C 4 P 0 3 4 4 4 5 5 P 1 3 0 1 1 1 2 2 P 2 4 1 0 2 2 1 1 C 4 34

Uncapacited Facility Location Problem Toy example Producer P 1 1 1 1 Customers Let

Uncapacited Facility Location Problem Toy example Producer P 1 1 1 1 Customers 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. 35

Uncapacited Facility Location Problem Toy example n Producer P =s n The prime cost

Uncapacited Facility Location Problem Toy example n Producer P =s n The prime cost e 0 is 2000 and e 1 is 1000 per km. Handling cost gi =0 and bj=1. 1 1 C 3 1 1 1 P 2 1 C 2 Customers dij P P 1 P 2 C 1 C 2 C 3 C 4 P 0 3 4 4 4 5 5 P 1 3 0 1 1 1 2 2 P 2 4 1 0 2 2 1 1 C 4 36

Uncapacited Facility Location Problem Toy example cij Producer P (1) 1 1 C 3

Uncapacited Facility Location Problem Toy example cij Producer P (1) 1 1 C 3 1 1 1 (2) 1 1 (3) 1 Customers C 4 (2) (3) (1) (2) (3) dij C 2 (1) (1) 0 (2) 3 (3) 4 C 1 C 2 C 3 C 4 8 8 10 10 5 5 7 7 8 8 6 6 (2) (3) C 1 C 2 C 3 C 4 3 4 4 4 5 5 0 1 1 1 2 2 1 0 2 2 1 1 37

Uncapacited Facility Location Problem Toy example Producer P (1) 1 1 C 3 1

Uncapacited Facility Location Problem Toy example Producer P (1) 1 1 C 3 1 1 1 (2) 1 1 (3) 1 C 2 Customers C 4 38

Writing a model in Mosel Name of the model & options model Toy. Example

Writing a model in Mosel Name of the model & options model Toy. Example uses "mmxprs" … !other sections end-model 39

Writing a model in Mosel Declarations of decision variables declarations y 1, y 2,

Writing a model in Mosel Declarations of decision variables declarations y 1, y 2, y 3 : mpvar z 11, z 12, z 13, z 14, z 21, z 22, z 23, z 24 : mpvar z 31, z 33, z 34 : mpvar end-declarations y 1 is_binary y 2 is_binary y 3 is_binary z 11 is_binary z 12 is_binary … z 34 is_binary 40

Writing a model in Mosel Objective function & constraints ! Objective function Cost: =6*y

Writing a model in Mosel Objective function & constraints ! Objective function Cost: =6*y 2+6*y 3+8*z 11+5*z 21+8*z 31+8*z 12+5*z 22+8*z 32+ 10*z 13+7*z 23+6*z 33+10*z 14+7*z 24+6*z 34 ! constraints z 11+z 21+z 31=1 z 12+z 22+z 32=1 z 13+z 23+z 33=1 z 14+z 24+z 34=1 z 11<=y 1 … z 34<=y 3 minimize(Cost) !you don’t need to declare Cost 41

Writing a model in Mosel Output & results ! Value of objective function -

Writing a model in Mosel Output & results ! Value of objective function - getobjval writeln("Total cost: ", getobjval) ! Value of decision variable writeln("y 1 = ", getsol(y 1)) writeln("y 2 = ", getsol(y 2)) writeln("y 3 = ", getsol(y 3)) writeln("z 11 = ", getsol(z 11)) writeln("z 21 = ", getsol(z 21)) writeln("z 31 = ", getsol(z 31)) … writeln("z 34 = ", getsol(z 34)) 42

Writing a model in Mosel Results Total cost: 30 y 1= 1 y 2=

Writing a model in Mosel Results Total cost: 30 y 1= 1 y 2= 1 y 3= 0 z 11= 0 z 12= 0 z 13= 0 z 14= 0 z 21= 1 z 22= 1 z 23= 1 z 24= 1 z 31= 0 z 32= 0 z 33= 0 z 34= 0 43

Writing a model in Mosel Loops, sums & data from file 44

Writing a model in Mosel Loops, sums & data from file 44

Writing a model in Mosel Structure of the input file “Toy. Data. txt”: m:

Writing a model in Mosel Structure of the input file “Toy. Data. txt”: m: [3] n: [4] f: [0, c: [8, 5, 8, 6, 6] 8, 10, 5, 7, 7, 8, 6, 6] 45

Writing a model in Mosel Declarations of variables using arrays & loops declarations m,

Writing a model in Mosel Declarations of variables using arrays & loops declarations m, n: integer end-declarations initializations from "Toy. Data. txt" m n end-initializations 46

Writing a model in Mosel Declarations of variables using arrays & loops declarations I

Writing a model in Mosel Declarations of variables using arrays & loops declarations I = 1. . m J = 1. . n y : array (I) of mpvar z : array (I, J) of mpvar f : array (I) of integer c : array (I, J) of integer end-declarations 47

Writing a model in Mosel Data input initializations from "Toy. Data. txt" f c

Writing a model in Mosel Data input initializations from "Toy. Data. txt" f c end-initializations 48

Writing a model in Mosel Objective function & constraints ! Objective function Cost: =sum(i

Writing a model in Mosel Objective function & constraints ! 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 49

Writing a model in Mosel Output & results ! Value of objective function writeln("Total

Writing 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))) 50