| |||||||||||||||||||
Looping over optimization runs (within a model, batch executions, and multiple models/submodel) Description This example shows different possibilities of looping over a series of optimization runs using different data sets.
Source Files By clicking on a file name, a preview is opened at the bottom of this page.
Data Files batch1.mos (!******************************************************* Mosel Example Problems ====================== file batch1.mos ``````````````` Looping in the Mosel program over optimization runs coupled with data in- and output. (c) 2008 Fair Isaac Corporation author: S.Heipcke, 2002, rev. 2017 *******************************************************!) model "batch 1" uses "mmxprs" declarations LIM=100 R=1..10 A,B: array(R) of real x: array(R) of mpvar ACtr,AnObj: 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 as "a" B as "b" end-initializations if(i>0) then forall(r in R) B(r)+=1 end-if ! (Re-)assign constraints ACtr:= sum(r in R) B(r)*x(r) <= LIM+i*10 AnObj:=sum(r in R) A(r)*x(r) maximize(AnObj) 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 as "b" end-initializations end-if end-do end-model | |||||||||||||||||||
© Copyright 2024 Fair Isaac Corporation. |