Scippy

SCIP

Solving Constraint Integer Programs

probdata_scflp.c File Reference

Detailed Description

Problem data for Stochastic Capacitated Facility Location problem.

Author
Stephen J. Maher

This file handles the main problem data used in that project. For more details see The global problem data page.

Definition in file probdata_scflp.c.

#include <string.h>
#include "probdata_scflp.h"
#include "scip/scip.h"
#include "scip/scipdefplugins.h"

Go to the source code of this file.

Macros

#define DEFAULT_SCALINGFACTOR   5000.0
 

Functions

Local methods
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_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)
 
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 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_RETCODE probdataFree (SCIP *scip, SCIP_PROBDATA **probdata)
 
Callback methods of problem data
static SCIP_DECL_PROBDELORIG (probdelorigScflp)
 
static SCIP_DECL_PROBTRANS (probtransScflp)
 
static SCIP_DECL_PROBDELTRANS (probdeltransScflp)
 
Interface methods
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)
 
int SCIPprobdataGetNFacilities (SCIP_PROBDATA *probdata)
 
int SCIPprobdataGetNCustomers (SCIP_PROBDATA *probdata)
 
SCIP_VAR ** SCIPprobdataGetFacilityVars (SCIP_PROBDATA *probdata)
 

Macro Definition Documentation

◆ DEFAULT_SCALINGFACTOR

#define DEFAULT_SCALINGFACTOR   5000.0

Definition at line 127 of file probdata_scflp.c.

Referenced by createOriginalproblem(), createSubproblems(), and SCIPprobdataCreate().

Function Documentation

◆ createOriginalproblem()

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

creates the original problem

Parameters
scipSCIP data structure
facilityvarsall variables representing facilities
customervarsall variables representing the satisfaction of demand
capconsscapacity constraints per facility
demandconssdemand constraints per customer
sufficientcapensuring sufficient capacity is provided to satisfy demand
coststhe transportation costs from a facility to a customer
demandsthe customer demands
capacitythe capacity of each facility
fixedcostthe fixed cost of opening a facility
ncustomersthe number of customers
nfacilitiesthe number of facilities
nscenariosthe number of scenarios
quadcostsshould the problem be formulated with quadratic costs

Definition at line 164 of file probdata_scflp.c.

References DEFAULT_SCALINGFACTOR, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_CONTINUOUS, SCIPaddCoefLinear(), SCIPaddCons(), SCIPaddVar(), SCIPcreateConsBasicLinear(), SCIPcreateConsBasicQuadratic(), SCIPcreateVarBasic(), SCIPinfinity(), SCIPreleaseCons(), SCIPreleaseVar(), and SCIPsnprintf().

Referenced by SCIPprobdataCreate().

◆ createMasterproblem()

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 
)
static

creates the Benders' decomposition master problem

Parameters
scipSCIP data structure
facilityvarsall variables representing facilities
sufficientcapensuring sufficient capacity is provided to satisfy demand
capacitythe capacity of each facility
fixedcostthe fixed cost of opening a facility
demandsthe customer demands
ncustomersthe number of customers
nfacilitiesthe number of facilities
nscenariosthe number of scenarios

Definition at line 324 of file probdata_scflp.c.

References NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIP_VERBLEVEL_NORMAL, SCIPaddCoefLinear(), SCIPaddCons(), SCIPaddVar(), SCIPcreateConsBasicLinear(), SCIPcreateVarBasic(), SCIPgetMessagehdlr(), SCIPgetVerbLevel(), SCIPinfinity(), SCIPmessagePrintVerbInfo(), and SCIPsnprintf().

Referenced by SCIPprobdataCreate().

◆ createSubproblems()

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

creates the scenario subproblems

Parameters
scipSCIP data structure
subproblemsthe Benders' decomposition subproblems
facilityvarsall variables representing facilities
subfacilityvarsthe copies of the facility variables in the subproblems
customervarsall variables representing the satisfaction of demand
capconsscapacity constraints per facility
demandconssdemand constraints per customer
coststhe transportation costs from a facility to a customer
demandsthe customer demands
capacitythe capacity of each facility
fixedcostthe fixed cost of opening a facility
ncustomersthe number of customers
nfacilitiesthe number of facilities
nscenariosthe number of scenarios
quadcostsshould the problem be formulated with quadratic costs

Definition at line 386 of file probdata_scflp.c.

References DEFAULT_SCALINGFACTOR, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIP_VERBLEVEL_NORMAL, SCIPaddCoefLinear(), SCIPaddCons(), SCIPaddVar(), SCIPcreateConsBasicLinear(), SCIPcreateConsBasicQuadratic(), SCIPcreateVarBasic(), SCIPgetMessagehdlr(), SCIPgetVerbLevel(), SCIPinfinity(), SCIPmessagePrintVerbInfo(), SCIPreleaseCons(), SCIPreleaseVar(), and SCIPsnprintf().

Referenced by SCIPprobdataCreate().

◆ probdataCreate()

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

creates problem data

Parameters
scipSCIP data structure
probdatapointer to problem data
subproblemsthe Benders' decomposition subproblems
facilityvarsall variables representing facilities
subfacilityvarsthe copies of the facility variables in the subproblems
customervarsall variables representing the satisfaction of demand
capconsscapacity constraints per facility per scenario
demandconssdemand constraints per customer per scenario
sufficientcapensuring sufficient capacity is provided to satisfy demand
coststhe transportation costs to a customer from a facility
demandsthe customer demands per scenario
capacitythe capacity of each facility
fixedcostthe fixed cost of opening a facility
ncustomersthe number of customers
nfacilitiesthe number of facilities
nscenariosthe number of scenarios
usebenderswhether Benders' decomposition is used
quadcostsshould the problem be formulated with quadratic costs

Definition at line 537 of file probdata_scflp.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, and SCIPduplicateBlockMemoryArray.

Referenced by SCIPprobdataCreate().

◆ probdataFree()

static SCIP_RETCODE probdataFree ( SCIP scip,
SCIP_PROBDATA **  probdata 
)
static

frees the memory of the given problem data

Parameters
scipSCIP data structure
probdatapointer to problem data

Definition at line 621 of file probdata_scflp.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPfree(), SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, SCIPreleaseCons(), and SCIPreleaseVar().

Referenced by SCIP_DECL_PROBDELORIG().

◆ SCIP_DECL_PROBDELORIG()

static SCIP_DECL_PROBDELORIG ( probdelorigScflp  )
static

frees user data of original problem (called when the original problem is freed)

Definition at line 749 of file probdata_scflp.c.

References NULL, probdataFree(), SCIP_CALL, SCIP_OKAY, and SCIPdebugMsg.

◆ SCIP_DECL_PROBTRANS()

static SCIP_DECL_PROBTRANS ( probtransScflp  )
static

creates user data of transformed problem by transforming the original user problem data (called after problem was transformed)

Definition at line 764 of file probdata_scflp.c.

References SCIP_OKAY, and SCIPdebugMsg.

◆ SCIP_DECL_PROBDELTRANS()

static SCIP_DECL_PROBDELTRANS ( probdeltransScflp  )
static

frees user data of transformed problem (called when the transformed problem is freed)

Definition at line 773 of file probdata_scflp.c.

References SCIP_OKAY, and SCIPdebugMsg.

◆ SCIPprobdataCreate()

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 
)

sets up the problem data

Parameters
scipSCIP data structure
probnameproblem name
coststhe transportation costs from a facility to a customer
demandsthe customer demands
capacitythe capacity of each facility
fixedcostthe fixed cost of opening a facility
ncustomersthe number of customers
nfacilitiesthe number of facilities
nscenariosthe number of Benders' decomposition scenarios
usebenderswhether Benders' decomposition is used
quadcostsshould the problem be formulated with quadratic costs

Definition at line 789 of file probdata_scflp.c.

References createMasterproblem(), createOriginalproblem(), createSubproblems(), DEFAULT_SCALINGFACTOR, NULL, probdataCreate(), SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIPallocBufferArray, SCIPcreate(), SCIPcreateBendersDefault(), SCIPcreateProbBasic(), SCIPfreeBufferArray, SCIPincludeDefaultPlugins(), SCIPinfoMessage(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsetObjsense(), SCIPsetProbData(), SCIPsetProbDelorig(), SCIPsetProbDeltrans(), SCIPsetProbTrans(), SCIPsnprintf(), and TRUE.

◆ SCIPprobdataGetNFacilities()

int SCIPprobdataGetNFacilities ( SCIP_PROBDATA probdata)

returns the number of facilities

Parameters
probdataproblem data

Definition at line 938 of file probdata_scflp.c.

References NULL.

◆ SCIPprobdataGetNCustomers()

int SCIPprobdataGetNCustomers ( SCIP_PROBDATA probdata)

returns the number of customers

Parameters
probdataproblem data

Definition at line 948 of file probdata_scflp.c.

References NULL.

◆ SCIPprobdataGetFacilityVars()

SCIP_VAR** SCIPprobdataGetFacilityVars ( SCIP_PROBDATA probdata)

returns the facility variables

Parameters
probdataproblem data

Definition at line 958 of file probdata_scflp.c.

References NULL.