( i = 0; i < nscenarios; i++)
211 for( j = 0; j < ncustomers; j++ )
212sumdemand += demands[j][i];
214 if( sumdemand > maxdemand )
215maxdemand = sumdemand;
224 for( i = 0; i < nfacilities; i++ )
226 for( j = 0; j < nscenarios; j++ )
233capconss[i][j] = cons;
238 for( i = 0; i < ncustomers; i++ )
240 for( j = 0; j < nscenarios; j++ )
247demandconss[i][j] = cons;
251 for( i = 0; i < nfacilities; i++ )
259facilityvars[i] = var;
262 for( j = 0; j < nscenarios; j++ )
270 for( i = 0; i < ncustomers; i++ )
272 for( j = 0; j < nfacilities; j++ )
274 for( k = 0; k < nscenarios; k++ )
276custcoeff = costs[i][j]/(
SCIP_Real)nscenarios;
293customervars[i][j][k] = var;
295 if( costs[i][j] > 0 )
316&one, -
SCIPinfinity(
scip), 0.0,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
FALSE,
FALSE,
FALSE,
FALSE) );
353 "Creating the master problem\n============\n");
357 for( i = 0; i < nscenarios; i++)
360 for( j = 0; j < ncustomers; j++ )
361sumdemand += demands[j][i];
363 if( sumdemand > maxdemand )
364maxdemand = sumdemand;
373 for( i = 0; i < nfacilities; i++ )
381facilityvars[i] = var;
388 "master problem has %d binary variables and 1 constraint\n\n", nfacilities);
429 "Creating the subproblems\n============\n");
432 for( i = 0; i < nfacilities; i++ )
434 for( j = 0; j < nscenarios; j++ )
441capconss[i][j] = cons;
446 for( i = 0; i < ncustomers; i++ )
448 for( j = 0; j < nscenarios; j++ )
455demandconss[i][j] = cons;
459 for( i = 0; i < nfacilities; i++ )
461 for( j = 0; j < nscenarios; j++ )
469subfacilityvars[i][j] = var;
477 for( i = 0; i < ncustomers; i++ )
479 for( j = 0; j < nfacilities; j++ )
481 for( k = 0; k < nscenarios; k++ )
483custcoeff = costs[i][j]/(
SCIP_Real)nscenarios;
489coeff = custcoeff / 10000.0;
500customervars[i][j][k] = var;
502 if( costs[i][j] > 0 )
524 SCIP_CALL(
SCIPcreateConsQuadraticNonlinear(subproblems[k], &cons, name, 1, &sqrvar, &minusone, 1, &var, &var, &one, -
SCIPinfinity(subproblems[k]), 0.0,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
FALSE,
FALSE,
FALSE,
FALSE) );
537 "%d subproblems have been created.\neach subproblem has %d continuous variables and %d constraint\n\n",
538nscenarios, ncustomers*nfacilities + nfacilities, nfacilities + ncustomers);
571assert(probdata !=
NULL);
582 for( i = 0; i < nfacilities; i++ )
589 for( i = 0; i < ncustomers; i++ )
592 for( j = 0; j < nfacilities; j++ )
599 for( i = 0; i < nfacilities; i++ )
603 for( i = 0; i < ncustomers; i++ )
608 for( i = 0; i < ncustomers; i++ )
612 for( i = 0; i < ncustomers; i++ )
618(*probdata)->sufficientcap = sufficientcap;
619(*probdata)->ncustomers = ncustomers;
620(*probdata)->nfacilities = nfacilities;
621(*probdata)->nscenarios = nscenarios;
622(*probdata)->usebenders = usebenders;
623(*probdata)->quadcosts = quadcosts;
640assert(probdata !=
NULL);
644 for( i = 0; i < (*probdata)->nfacilities; i++ )
647 for( i = 0; i < (*probdata)->nscenarios; i++ )
650 if( (*probdata)->usebenders )
651varscip = (*probdata)->subproblems[i];
655 for( j = 0; j < (*probdata)->nfacilities; j++ )
657 for( k = 0; k < (*probdata)->ncustomers; k++ )
663 for( i = 0; i < (*probdata)->nscenarios; ++i )
666 if( (*probdata)->usebenders )
667consscip = (*probdata)->subproblems[i];
671 for( j = 0; j < (*probdata)->ncustomers; j++ )
675 for( i = 0; i < (*probdata)->nscenarios; ++i )
678 if( (*probdata)->usebenders )
679consscip = (*probdata)->subproblems[i];
683 for( j = 0; j < (*probdata)->nfacilities; ++j )
694 for( i = (*probdata)->ncustomers - 1; i >= 0; i-- )
698 for( i = (*probdata)->ncustomers - 1; i >= 0; i-- )
703 for( i = (*probdata)->ncustomers - 1; i >= 0; i-- )
707 for( i = (*probdata)->nfacilities - 1; i >= 0; i-- )
712 for( i = (*probdata)->ncustomers - 1; i >= 0; i-- )
714 for( j = (*probdata)->nfacilities - 1; j >= 0; j-- )
724 if( (*probdata)->usebenders )
727 for( i = 0; i < (*probdata)->nscenarios; i++ )
729 for( j = 0; j < (*probdata)->nfacilities; j++ )
733 for( i = (*probdata)->nfacilities - 1; i >= 0; i-- )
738 for( i = (*probdata)->nscenarios - 1; i >= 0 ; i-- )
761assert(probdata !=
NULL);
800 const char* probname,
836 for( i = 0; i < ncustomers; i++ )
839 for( i = 0; i < nfacilities; i++ )
844 for( i = 0; i < ncustomers; i++ )
847 for( j = 0; j < nfacilities; j++ )
851sufficientcap =
NULL;
854subfacilityvars =
NULL;
870 for( i = 0; i < nfacilities; i++ )
874 for( i = 0; i < nscenarios; i++ )
887nfacilities, nscenarios) );
889demandconss, costs, demands, capacity, fixedcost, ncustomers, nfacilities, nscenarios, quadcosts) );
905demands, capacity, fixedcost, ncustomers, nfacilities, nscenarios, quadcosts) );
910demandconss, sufficientcap, costs, demands, capacity, fixedcost, ncustomers, nfacilities, nscenarios,
911usebenders, quadcosts) );
921 for( i = nfacilities - 1; i >= 0; i-- )
926 for( i = ncustomers - 1; i >= 0; i-- )
928 for( j = nfacilities - 1; j >= 0; j-- )
935 for( i = nfacilities - 1; i >= 0; i-- )
939 for( i = ncustomers - 1; i >= 0; i-- )
951assert(probdata !=
NULL);
953 returnprobdata->nfacilities;
961assert(probdata !=
NULL);
963 returnprobdata->ncustomers;
971assert(probdata !=
NULL);
973 returnprobdata->facilityvars;
SCIP_RETCODE SCIPcreateBendersDefault(SCIP *scip, SCIP **subproblems, int nsubproblems)
SCIP_RETCODE SCIPaddCoefLinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
SCIP_RETCODE SCIPcreateConsBasicLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs)
SCIP_RETCODE SCIPcreateConsQuadraticNonlinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadterms, SCIP_VAR **quadvars1, SCIP_VAR **quadvars2, SCIP_Real *quadcoefs, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable)
SCIP_RETCODE SCIPfree(SCIP **scip)
SCIP_RETCODE SCIPcreate(SCIP **scip)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
SCIP_RETCODE SCIPsetProbDeltrans(SCIP *scip, SCIP_DECL_PROBDELTRANS((*probdeltrans)))
SCIP_RETCODE SCIPsetProbTrans(SCIP *scip, SCIP_DECL_PROBTRANS((*probtrans)))
SCIP_RETCODE SCIPsetProbDelorig(SCIP *scip, SCIP_DECL_PROBDELORIG((*probdelorig)))
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPsetObjsense(SCIP *scip, SCIP_OBJSENSE objsense)
SCIP_RETCODE SCIPcreateProbBasic(SCIP *scip, const char *name)
SCIP_RETCODE SCIPsetProbData(SCIP *scip, SCIP_PROBDATA *probdata)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
SCIP_VERBLEVEL SCIPgetVerbLevel(SCIP *scip)
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_RETCODE SCIPcreateVarBasic(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype)
int SCIPsnprintf(char *t, int len, const char *s,...)
void SCIPmessagePrintVerbInfo(SCIP_MESSAGEHDLR *messagehdlr, SCIP_VERBLEVEL verblevel, SCIP_VERBLEVEL msgverblevel, const char *formatstr,...)
int SCIPprobdataGetNCustomers(SCIP_PROBDATA *probdata)
SCIP_RETCODE SCIPprobdataCreate(SCIP *scip, const char *probname, SCIP_Real **costs, SCIP_Real **demands, SCIP_Real *capacity, SCIP_Real *fixedcost, int ncustomers, int nfacilities, int nscenarios, SCIP_Bool usebenders, SCIP_Bool quadcosts)
static SCIP_RETCODE createMasterproblem(SCIP *scip, SCIP_VAR **facilityvars, SCIP_CONS **sufficientcap, SCIP_Real *capacity, SCIP_Real *fixedcost, SCIP_Real **demands, int ncustomers, int nfacilities, int nscenarios)
SCIP_VAR ** SCIPprobdataGetFacilityVars(SCIP_PROBDATA *probdata)
static SCIP_RETCODE createSubproblems(SCIP *scip, SCIP **subproblems, SCIP_VAR **facilityvars, SCIP_VAR ***subfacilityvars, SCIP_VAR ****customervars, SCIP_CONS ***capconss, SCIP_CONS ***demandconss, SCIP_Real **costs, SCIP_Real **demands, SCIP_Real *capacity, SCIP_Real *fixedcost, int ncustomers, int nfacilities, int nscenarios, SCIP_Bool quadcosts)
static SCIP_RETCODE createOriginalproblem(SCIP *scip, SCIP_VAR **facilityvars, SCIP_VAR ****customervars, SCIP_CONS ***capconss, SCIP_CONS ***demandconss, SCIP_CONS **sufficientcap, SCIP_Real **costs, SCIP_Real **demands, SCIP_Real *capacity, SCIP_Real *fixedcost, int ncustomers, int nfacilities, int nscenarios, SCIP_Bool quadcosts)
static SCIP_DECL_PROBDELTRANS(probdeltransScflp)
#define DEFAULT_SCALINGFACTOR
int SCIPprobdataGetNFacilities(SCIP_PROBDATA *probdata)
static SCIP_RETCODE probdataFree(SCIP *scip, SCIP_PROBDATA **probdata)
static SCIP_DECL_PROBDELORIG(probdelorigScflp)
static SCIP_RETCODE probdataCreate(SCIP *scip, SCIP_PROBDATA **probdata, SCIP **subproblems, SCIP_VAR **facilityvars, SCIP_VAR ***subfacilityvars, SCIP_VAR ****customervars, SCIP_CONS ***capconss, SCIP_CONS ***demandconss, SCIP_CONS *sufficientcap, SCIP_Real **costs, SCIP_Real **demands, SCIP_Real *capacity, SCIP_Real *fixedcost, int ncustomers, int nfacilities, int nscenarios, SCIP_Bool usebenders, SCIP_Bool quadcosts)
static SCIP_DECL_PROBTRANS(probtransScflp)
Problem data for Stochastic Capacitated Facility Location problem.
SCIP_RETCODE SCIPincludeDefaultPlugins(SCIP *scip)
struct SCIP_ProbData SCIP_PROBDATA
enum SCIP_Retcode SCIP_RETCODE
@ SCIP_VARTYPE_CONTINUOUS
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4