SCIP_ReaderData
149(*hasspare) =
FALSE;
150 returnmean + stdDev * (*spare);
159 while( (s >= 1.0) || (s == 0.0) );
161s = sqrt(-2.0 * log(s) / s);
164 returnmean + stdDev * u * s;
176assert(readerdata !=
NULL);
179(*readerdata)->usebenders =
TRUE;
192assert(readerdata !=
NULL);
193assert(*readerdata !=
NULL);
213assert(reader !=
NULL);
262nscenarios = readerdata->nscenarios;
276sprintf(name,
"SCFLP");
284 if(
SCIPfgets(buffer, (
int)
sizeof(buffer), file) ==
NULL)
288nread = sscanf(buffer,
" %d %d\n", &nfacilities, &ncustomers);
295 SCIPdebugMsg(
scip,
"number of facilities = <%d> number of customers = <%d>\n", nfacilities, ncustomers);
305 for( i = 0; i < nfacilities; i++ )
315 while( !
SCIPfeof(file) && !error && facility < nfacilities )
317 if(
SCIPfgets(buffer, (
int)
sizeof(buffer), file) ==
NULL)
321nread = sscanf(buffer,
" %lf %lf\n", &facilitycap, &facilitycost);
329 SCIPdebugMsg(
scip,
"facility %d capacity = <%f>, fixed cost = <%f>\n", facility, facilitycap, facilitycost);
330capacity[facility] = facilitycap;
331fixedcost[facility] = facilitycost;
333assert(facility <= nfacilities);
342 for( i = 0; i < ncustomers; i++ )
347 for( j = 0; j < nfacilities; j++ )
350 for( j = 0; j < nscenarios; j++ )
361 while( !
SCIPfeof(file) && !error )
364 if(
SCIPfgets(buffer, (
int)
sizeof(buffer), file) ==
NULL)
370nread = sscanf(buffer,
" %lf\n", &demand);
379detdemands[customer] = demand;
381 else if( lineno <= ncostlines )
385nread = sscanf(buffer,
" %lf %lf %lf %lf %lf %lf %lf\n", &tmpcosts[0], &tmpcosts[1], &tmpcosts[2],
386&tmpcosts[3], &tmpcosts[4], &tmpcosts[5], &tmpcosts[6]);
395 for( i = 0; i < nread; i++ )
397 SCIPdebugMsg(
scip,
"(%d, %d) found cost <%e>\n", customer, facility, tmpcosts[i]);
398costs[customer][facility] = tmpcosts[i]/demand;
403 if( lineno == ncostlines )
422 for( i = 0; i < ncustomers; i++ )
424mean = detdemands[i];
427 for( j = 0; j < nscenarios; j++ )
431 SCIPdebugMsg(
scip,
"Scenario %d: customer %d demand <%f>\n", j, i, demands[i][j]);
437nscenarios, readerdata->usebenders, readerdata->quadcosts) );
442 for( i = ncustomers - 1; i >= 0; i-- )
489assert(reader !=
NULL);
495 "reading/" READER_NAME "/usebenders",
"Should Benders' decomposition be used to solve the problem?",
500 "the number of scenarios that will be randomly generated",
505 "the random seed used to generate the scenarios",
509 "reading/" READER_NAME "/quadcosts",
"should the problem be formulated with quadratic costs",
SCIP_FILE * SCIPfopen(const char *path, const char *mode)
int SCIPfeof(SCIP_FILE *stream)
int SCIPfclose(SCIP_FILE *fp)
char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
SCIP_READERDATA * SCIPreaderGetData(SCIP_READER *reader)
SCIP_RETCODE SCIPsetReaderFree(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERFREE((*readerfree)))
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
void SCIPfreeRandom(SCIP *scip, SCIP_RANDNUMGEN **randnumgen)
SCIP_Real SCIPrandomGetReal(SCIP_RANDNUMGEN *randnumgen, SCIP_Real minrandval, SCIP_Real maxrandval)
SCIP_RETCODE SCIPcreateRandom(SCIP *scip, SCIP_RANDNUMGEN **randnumgen, unsigned int initialseed, SCIP_Bool useglobalseed)
void SCIPprintSysError(const char *message)
SCIP_RETCODE SCIPprobdataCreate(SCIP *scip, const char *probname, int *demands, SCIP_Real *rints, SCIP_Real *rexts, int ntypes, SCIP_Real width, SCIP_Real height)
Problem data for Stochastic Capacitated Facility Location problem.
struct SCIP_File SCIP_FILE
#define DEFAULT_USEBENDERS
SCIP_RETCODE SCIPincludeReaderScflp(SCIP *scip)
static SCIP_Real generateGaussianNoise(SCIP_RANDNUMGEN *randomgen, SCIP_Real mean, SCIP_Real stdDev, SCIP_Real *spare, SCIP_Bool *hasspare)
static SCIP_DECL_READERREAD(readerReadScflp)
#define DEFAULT_QUADCOSTS
static SCIP_RETCODE readerdataFree(SCIP *scip, SCIP_READERDATA **readerdata)
#define DEFAULT_NUMSCENARIOS
static SCIP_RETCODE readerdataCreate(SCIP *scip, SCIP_READERDATA **readerdata)
static SCIP_DECL_READERFREE(readerFreeScflp)
#define DEFAULT_RANDOMSEED
SCFLP problem reader file reader.
struct SCIP_ReaderData SCIP_READERDATA
enum SCIP_Retcode SCIP_RETCODE
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