/******************************************************* Mosel Example Problems ====================== file scenar.c ````````````` Executing different scenarios. (c) 2008 Fair Isaac Corporation author: S. Heipcke, 2002 ********************************************************/ #include #include #include "xprm_mc.h" int execscenar(const char *FILENAME, double WEIGHT); #define NSUP 6 double obj, capuse[NSUP], CAP[NSUP]; char SUPNAME[NSUP][64]; int main() { int NSCENAR = 5; const char *DEMDATA[] = {"dem1.dat", "dem2.dat", "dem3.dat", "dem4.dat", "dem5.dat"}; double WEIGHT[] = {0.4, 0.15, 0.1, 0.25, 0,1}; int i,s; double fact = 0; if(XPRMinit()) /* Initialize Mosel */ return 1; /* Execute all scenarios */ for(i=0;istring); XPRMgetarrval(darr, indices, &(CAP[indices[0]-1])); } while(!XPRMgetnextarrentry(darr, indices)); /* Get the next index tuple */ } /* At every execution: get the solution for variables 'x' */ XPRMfindident(mod, "x", &rvalue); /* Get the model object 'x' */ varr = rvalue.array; XPRMgetfirstarrtruentry(varr, indices); /* Get the first entry of array varr (we know that the array is sparse and has two dimensions) */ do { XPRMgetarrval(varr, indices, &x); /* Get the corresponding variable */ capuse[indices[0]-1] += WEIGHT*XPRMgetvsol(mod,x); /* Save the sol. value */ /* printf("<%d,%d:%g>\n", indices[0], indices[1], XPRMgetvsol(mod,x)); */ } while(!XPRMgetnextarrtruentry(varr, indices)); /* Get the next index tuple */ return 1; }