(!******************************************************* Mosel Example Problems ====================== file batch1.mos ``````````````` Looping in the Mosel program over optimization runs coupled with data in- and output. (c) 2002 Dash Associates author: S. Heipcke *******************************************************!) model "batch 1" uses "mmxprs" declarations LIM=100 R=1..10 a,b: array(R) of real x: array(R) of mpvar ctr,obj: linctr end-declarations forall(r in R) x(r) is_binary forall(i in 0..2) do ! (Re-)initialize data from file initializations from "batchdata"+i+".dat" a b end-initializations if(i>0) then forall(r in R) b(r)+=1 end-if ! (Re-)assign constraints ctr:=sum(r in R) b(r)*x(r) <= LIM+i*10 obj:=sum(r in R) a(r)*x(r) maximize(obj) writeln("Objective: ", getobjval) ! Write out data to a file to be read at the next round if(i<2) then initializations to "batchdata"+(i+1)+".dat" b end-initializations end-if end-do end-model