1 / 8

How to write a model in Mosel Xpress-IVE

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. How to write a model (1) Name of the model & options. model ModelName options … uses “mmxprs”

parry
Download Presentation

How to write a model in Mosel Xpress-IVE

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

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

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

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

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

  6. How to write a model (5) Objective function 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

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

  8. How to write a model (7) Output & results ! 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(iin 1..M) writeln(" Y(“,i,") = “,getsol(Y(i)))

More Related