Presentation is loading. Please wait.

Presentation is loading. Please wait.

Name of the model & options Parameters Declarations (decision variables, arrays, etc.) Data input Objective function Constraints Output & results How to.

Similar presentations


Presentation on theme: "Name of the model & options Parameters Declarations (decision variables, arrays, etc.) Data input Objective function Constraints Output & results How to."— Presentation transcript:

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

2 model ModelName options … uses “mmxprs” … !other sections end-model For comment write “!” before the commented word How to write a model (1) Name of the model & options 2

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

4 declarations Variable : mpvar VariableArray : array() of mpvar IntegerVariable : mpvar BinaryVariable : mpvar end-declarations IntegerVariable is_integer !when integer variable BinaryVariable is_binary !when binary variable 4 How to write a model (3) Declarations (variables, arrays, etc.)

5 declarations UnitCost : array(1..10) of integer end-declarations initializations from “Filename” UnitCost; end-initializations 5 How to write a model (4) Data input – optional section

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

7 ! simple constraint X1+3*X2-5*X3<=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 7 How to write a model (6) Constraints

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


Download ppt "Name of the model & options Parameters Declarations (decision variables, arrays, etc.) Data input Objective function Constraints Output & results How to."

Similar presentations


Ads by Google