| |||||||||||||||||||
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 batch2.c /******************************************************* Mosel Example Problems ====================== file batch2.c ````````````` Looping over program executions coupled with parameterized data in- and output. (c) 2008 Fair Isaac Corporation author: S.Heipcke, Oct. 2002 *******************************************************/ #include <stdio.h> #include <stdlib.h> #include "xprm_mc.h" #include "xprm_rt.h" int main() { int i, result; char params[60]; XPRMmodel mod; XPRMinit(); /* Initialize Mosel */ XPRMcompmod(NULL,"batch2.mos",NULL,"");/* Compile the model batch2.mos */ mod=XPRMloadmod("batch2.bim",NULL); /* Load the BIM file */ XPRMrunmod(mod,&result,NULL); /* Run the model */ for(i=1;i<=2;i++) { sprintf(params,"INFILE=batchdata%d.dat, OUTFILE=batchdata%d.dat, LIM=%d", i,i+1, 100+i*10); XPRMrunmod(mod,&result,params); /* Re-run the model with other data */ } return 0; } | |||||||||||||||||||
© Copyright 2023 Fair Isaac Corporation. |