Ana Vaz
Ana Vaz

Reputation: 1

Xpress Mosel Parallel Solving

Is it possible to have two submodles (.mos) running in parallel as input data for a master problem?

Is it correct to repeat twice the next code, one for each sub model? Because I have one bim file for each sub model, in my case 2 bim files.

declarations A = 1..10 modPar: array(A) of Model end-declarations

if compile("rtparams.mos")<>0 then exit(1) end-if

forall(i in A) do load(modPar(i), "rtparams.bim")
run(modPar(i), "PARAM1=" + i) end-do

forall(i in A) do wait dropnextevent

end-model

Upvotes: 0

Views: 80

Answers (1)

Daniel Junglas
Daniel Junglas

Reputation: 5940

Yes, that should work. However, it is probably better to not just drop the event but capture it (via getnextevent) and then check the type exit status/code to make sure the submodel did not stop with an error.

You have detailed examples for this in the user manual here.

Basically, what you do instead of dropnextevent is this:

 event:=getnextevent
 writeln("Exit status: ", getvalue(event))
 writeln("Exit code  : ", getexitcode(modPar(i)))

(and then of course handle errors).

Upvotes: 0

Related Questions