Parameters
In Part Using the Mosel language the concept of parameters in Mosel has been introduced: when a Mosel model is executed from the command line, it is possible to pass new values for its parameters into the model. The same is possible with a model run in C. If, for instance, we want to run model `Prime' from Section Working with sets to obtain all prime numbers up to 500 (instead of the default value 100 set for the parameter LIMIT in the model), we may start a program with the following lines:
XPRMmodel mod; int result; if(XPRMinit()) /* Initialize Mosel */ return 1; if((mod=XPRMloadmod("prime.bim",NULL))==NULL) /* Load a BIM file */ return 2; if(XPRMrunmod(mod,&result,"LIMIT=500")) /* Run the model */ return 3;
To use function XPRMexecmod instead of the compile/load/run sequence we have:
int result; if(XPRMinit()) /* Initialize Mosel */ return 1; /* Execute with new parameter settings */ if(XPRMexecmod(NULL,"prime.mos","LIMIT=500",&result,NULL)) return 2;
© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.