STO file reader - the stochastic information of an instance in SMPS format.
Definition in file reader_sto.c.
#include "blockmemshell/memory.h"#include "scip/benders_default.h"#include "scip/cons_linear.h"#include "scip/pub_cons.h"#include "scip/pub_fileio.h"#include "scip/pub_message.h"#include "scip/pub_misc.h"#include "scip/pub_reader.h"#include "scip/pub_var.h"#include "scip/reader_cor.h"#include "scip/reader_sto.h"#include "scip/reader_tim.h"#include "scip/scip_cons.h"#include "scip/scip_debug.h"#include "scip/scipdefplugins.h"#include "scip/scip_general.h"#include "scip/scip_mem.h"#include "scip/scip_message.h"#include "scip/scip_numerics.h"#include "scip/scip_param.h"#include "scip/scip_prob.h"#include "scip/scip_reader.h"#include "scip/scip_var.h"#include <stdlib.h>#include <string.h>Go to the source code of this file.
Data Structures | |
| struct | StoScenario |
| struct | StoInput |
Macros | |
| #define | READER_NAME "storeader" |
| #define | READER_DESC "file reader for stochastic information of stochastic programs in the SMPS file format" |
| #define | READER_EXTENSION "sto" |
| #define | DEFAULT_USEBENDERS FALSE |
| #define | STO_MAX_LINELEN 1024 |
| #define | STO_MAX_NAMELEN 256 |
| #define | STO_DEFAULT_ARRAYSIZE 100 |
| #define | STO_DEFAULT_ENTRIESSIZE 20 |
| #define | STO_DEFAULT_BLOCKARRAYSIZE 5 |
| #define | STO_DEFAULT_CHILDRENSIZE 5 |
| #define | BLANK ' ' |
Functions | |
| static SCIP_RETCODE | createScenarioData (SCIP *scip, STOSCENARIO **scenariodata) |
| static SCIP_RETCODE | freeScenarioTree (SCIP *scip, STOSCENARIO **scenariotree) |
| static void | setScenarioScip (STOSCENARIO *scenario, SCIP *scip) |
| static SCIP * | getScenarioScip (STOSCENARIO *scenario) |
| static SCIP_RETCODE | createScenarioSubproblemArray (SCIP *scip, STOSCENARIO *scenario) |
| static void | addScenarioSubproblem (STOSCENARIO *scenario, SCIP *subproblem) |
| static SCIP ** | getScenarioSubproblemArray (STOSCENARIO *scenario) |
| static int | getScenarioNChildren (STOSCENARIO *scenario) |
| static STOSCENARIO * | getScenarioChild (STOSCENARIO *scenario, int childnum) |
| static STOSCENARIO * | getScenarioParent (STOSCENARIO *scenario) |
| static SCIP_RETCODE | setScenarioStageName (SCIP *scip, STOSCENARIO *scenario, const char *stagename) |
| static const char * | getScenarioStageName (SCIP *scip, STOSCENARIO *scenario) |
| static SCIP_RETCODE | setScenarioStageNum (SCIP *scip, STOSCENARIO *scenario, int stagenum) |
| static int | getScenarioStageNum (SCIP *scip, STOSCENARIO *scenario) |
| static SCIP_RETCODE | setScenarioName (SCIP *scip, STOSCENARIO *scenario, const char *name) |
| static const char * | getScenarioName (STOSCENARIO *scenario) |
| static SCIP_RETCODE | setScenarioNum (SCIP *scip, STOSCENARIO *scenario, int scenarionum) |
| static int | getScenarioNum (SCIP *scip, STOSCENARIO *scenario) |
| static SCIP_RETCODE | setScenarioProbability (SCIP *scip, STOSCENARIO *scenario, SCIP_Real probability) |
| static SCIP_Real | getScenarioProbability (SCIP *scip, STOSCENARIO *scenario) |
| static SCIP_RETCODE | setScenarioLowerbound (SCIP *scip, STOSCENARIO *scenario, SCIP_Real lowerbound) |
| static SCIP_Real | getScenarioLowerbound (SCIP *scip, STOSCENARIO *scenario) |
| static SCIP_RETCODE | addScenarioEntry (SCIP *scip, STOSCENARIO *scenario, const char *rowname, const char *colname, SCIP_Real value) |
| static int | getScenarioNEntries (STOSCENARIO *scenario) |
| static const char * | getScenarioEntryRow (STOSCENARIO *scenario, int entry) |
| static const char * | getScenarioEntryCol (STOSCENARIO *scenario, int entry) |
| static SCIP_Real | getScenarioEntryValue (STOSCENARIO *scenario, int entry) |
| static SCIP_RETCODE | copyScenario (SCIP *scip, STOSCENARIO *sourcescenario, STOSCENARIO **targetscenario, SCIP_Bool copyname) |
| static SCIP_RETCODE | mergeScenarios (SCIP *scip, STOSCENARIO *scenario1, STOSCENARIO **mergedscenario) |
| static SCIP_RETCODE | scenarioAddChild (SCIP *scip, STOSCENARIO **parent, STOSCENARIO *child) |
| static SCIP_RETCODE | buildScenarioTree (SCIP *scip, STOSCENARIO **scenariotree, STOSCENARIO ***scenarios, int *numscenarios, int numstages, int stage) |
| static SCIP_RETCODE | addScenariosToReaderdata (SCIP *scip, SCIP_READERDATA *readerdata, STOSCENARIO ***scenarios, int *numscenarios, int numscenariostages) |
| static STOSCENARIO * | findScenarioInTree (STOSCENARIO *scenariotree, const char *scenname) |
| static SCIP_RETCODE | insertScenarioInReaderdata (SCIP *scip, SCIP_READERDATA *readerdata, STOSCENARIO *scenario, char *parentname) |
| static SCIP_RETCODE | buildScenariosFromBlocks (SCIP *scip, STOSCENARIO ***blocks, STOSCENARIO ***scenarios, STOSCENARIO ***blocksforscen, int *numblocksforscen, int numblocks, int *numblocksperblock, int *numscenarios, int *scenariossize, const char *stage, int stagenum, int blocknum) |
| static SCIP_RETCODE | createScenariosFromBlocks (SCIP *scip, SCIP_READERDATA *readerdata, STOSCENARIO ***blocks, int numblocks, int *numblocksperblock, int numstages) |
| static SCIP_RETCODE | createReaderdata (SCIP *scip, SCIP_READERDATA *readerdata) |
| static SCIP_RETCODE | freeReaderdata (SCIP *scip, SCIP_READERDATA *readerdata) |
| static SCIP_RETCODE | stoinputCreate (SCIP *scip, STOINPUT **stoi, SCIP_FILE *fp) |
| static void | stoinputFree (SCIP *scip, STOINPUT **stoi) |
| static STOSECTION | stoinputSection (const STOINPUT *stoi) |
| static STOSTOCHINFO | stoinputStochInfoType (const STOINPUT *stoi) |
| static const char * | stoinputField0 (const STOINPUT *stoi) |
| static const char * | stoinputField1 (const STOINPUT *stoi) |
| static const char * | stoinputField2 (const STOINPUT *stoi) |
| static const char * | stoinputField3 (const STOINPUT *stoi) |
| static const char * | stoinputField4 (const STOINPUT *stoi) |
| static const char * | stoinputField5 (const STOINPUT *stoi) |
| static const char * | stoinputField6 (const STOINPUT *stoi) |
| static SCIP_Bool | stoinputHasError (const STOINPUT *stoi) |
| static void | stoinputSetSection (STOINPUT *stoi, STOSECTION section) |
| static void | stoinputSetStochInfoType (STOINPUT *stoi, STOSTOCHINFO stochinfotype) |
| static void | stoinputSetProbname (STOINPUT *stoi, const char *probname) |
| static void | stoinputSetStochtype (STOINPUT *stoi, const char *stochtype) |
| static void | stoinputSyntaxerror (STOINPUT *stoi) |
| static void | clearFrom (char *buf, unsigned int pos) |
| static SCIP_Bool | stoinputReadLine (STOINPUT *stoi) |
| static SCIP_RETCODE | readStoch (SCIP *scip, STOINPUT *stoi) |
| static SCIP_RETCODE | readBlocks (STOINPUT *stoi, SCIP *scip, SCIP_READERDATA *readerdata) |
| static SCIP_RETCODE | readScenarios (STOINPUT *stoi, SCIP *scip, SCIP_READERDATA *readerdata) |
| static SCIP_RETCODE | readIndep (STOINPUT *stoi, SCIP *scip, SCIP_READERDATA *readerdata) |
| static SCIP_Real | computeScenarioProbability (SCIP *scip, STOSCENARIO *scenario) |
| static void | getScenarioEntityName (char *name, const char *varname, int stagenum, int scenarionum) |
| static SCIP_RETCODE | addScenarioVarsToProb (SCIP *scip, STOSCENARIO *scenario, SCIP_HASHMAP *varmap, SCIP_VAR **vars, int nvars) |
| static SCIP_RETCODE | findScenarioVar (SCIP *scip, STOSCENARIO *scenario, SCIP_VAR *consvar, SCIP_VAR **scenariovar) |
| static SCIP_RETCODE | getScenarioDecompVar (SCIP *scip, STOSCENARIO *scenario, SCIP_VAR *consvar, SCIP_VAR **scenariovar, SCIP_Bool *varadded) |
| static SCIP_RETCODE | addScenarioConsToProb (SCIP *scip, SCIP *scenarioscip, STOSCENARIO *scenario, SCIP_HASHMAP *varmap, SCIP_CONS **conss, int nconss, SCIP_Bool decomp) |
| static SCIP_RETCODE | addScenarioVarsAndConsToProb (SCIP *scip, STOSCENARIO *scenario, SCIP_Bool decomp) |
| static SCIP_RETCODE | removeCoreVariablesAndConstraints (SCIP *scip) |
| static SCIP_RETCODE | buildFullProblem (SCIP *scip, SCIP_READERDATA *readerdata) |
| static SCIP_RETCODE | buildDecompProblem (SCIP *scip, SCIP_READERDATA *readerdata) |
| static SCIP_RETCODE | readSto (SCIP *scip, const char *filename, SCIP_READERDATA *readerdata) |
| static | SCIP_DECL_READERCOPY (readerCopySto) |
| static | SCIP_DECL_READERFREE (readerFreeSto) |
| static | SCIP_DECL_READERREAD (readerReadSto) |
| SCIP_RETCODE | SCIPincludeReaderSto (SCIP *scip) |
| SCIP_RETCODE | SCIPreadSto (SCIP *scip, const char *filename, SCIP_RESULT *result) |
| int | SCIPstoGetNScenarios (SCIP *scip) |
| #define READER_NAME "storeader" |
Definition at line 60 of file reader_sto.c.
| #define READER_DESC "file reader for stochastic information of stochastic programs in the SMPS file format" |
Definition at line 61 of file reader_sto.c.
| #define READER_EXTENSION "sto" |
Definition at line 62 of file reader_sto.c.
| #define DEFAULT_USEBENDERS FALSE |
should Benders' decomposition be used for the stochastic program?
Definition at line 64 of file reader_sto.c.
Referenced by SCIPincludeReaderScflp(), and SCIPincludeReaderSto().
| #define STO_MAX_LINELEN 1024 |
Definition at line 70 of file reader_sto.c.
Referenced by stoinputReadLine().
| #define STO_MAX_NAMELEN 256 |
Definition at line 71 of file reader_sto.c.
Referenced by stoinputSetProbname(), and stoinputSetStochtype().
| #define STO_DEFAULT_ARRAYSIZE 100 |
Definition at line 73 of file reader_sto.c.
Referenced by readBlocks(), and readIndep().
| #define STO_DEFAULT_ENTRIESSIZE 20 |
Definition at line 74 of file reader_sto.c.
Referenced by createScenarioData().
| #define STO_DEFAULT_BLOCKARRAYSIZE 5 |
Definition at line 75 of file reader_sto.c.
Referenced by createScenariosFromBlocks(), readBlocks(), and readIndep().
| #define STO_DEFAULT_CHILDRENSIZE 5 |
Definition at line 76 of file reader_sto.c.
Referenced by createScenarioData().
| #define BLANK ' ' |
Definition at line 78 of file reader_sto.c.
| typedef struct StoScenario STOSCENARIO |
Definition at line 80 of file reader_sto.c.
| typedef enum StoSection STOSECTION |
Definition at line 125 of file reader_sto.c.
| typedef enum StoStochInfo STOSTOCHINFO |
Definition at line 137 of file reader_sto.c.
Definition at line 158 of file reader_sto.c.
| enum StoSection |
enum containing all sto sections
| Enumerator | |
|---|---|
| STO_STOCH | |
| STO_SCENARIOS | |
| STO_BLOCKS | |
| STO_INDEP | |
| STO_ENDATA | |
Definition at line 117 of file reader_sto.c.
| enum StoStochInfo |
enum containing the types of stochastic information
| Enumerator | |
|---|---|
| STO_STOCHINFO_NONE | |
| STO_STOCHINFO_DISCRETE | |
| STO_STOCHINFO_UNIFORM | |
| STO_STOCHINFO_NORMAL | |
| STO_STOCHINFO_SUB | |
| STO_STOCHINFO_LINTR | |
Definition at line 128 of file reader_sto.c.
|
static |
creates a scenario structure
| scip | SCIP data structure |
| scenariodata | the scenario to be created |
Definition at line 162 of file reader_sto.c.
References assert(), NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, SCIPdebugMessage, SCIPinfinity(), STO_DEFAULT_CHILDRENSIZE, and STO_DEFAULT_ENTRIESSIZE.
Referenced by buildScenariosFromBlocks(), createReaderdata(), readBlocks(), readIndep(), readScenarios(), and scenarioAddChild().
|
static |
frees the memory used for the scenario tree
| scip | the SCIP data structure |
| scenariotree | the scenario tree |
Definition at line 198 of file reader_sto.c.
References assert(), freeScenarioTree(), i, NULL, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPfree(), SCIPfreeBlockMemory, and SCIPfreeBlockMemoryArray.
Referenced by createScenariosFromBlocks(), freeReaderdata(), freeScenarioTree(), readBlocks(), readIndep(), and readScenarios().
|
static |
sets the SCIP pointer to the scenario
| scenario | the scenario |
| scip | the SCIP data structure |
Definition at line 251 of file reader_sto.c.
References assert(), NULL, and StoScenario::scip.
Referenced by addScenarioVarsAndConsToProb(), and buildDecompProblem().
|
static |
returns the SCIP pointer to the scenario
| scenario | the scenario |
Definition at line 264 of file reader_sto.c.
References assert(), NULL, and StoScenario::scip.
Referenced by addScenarioVarsAndConsToProb(), buildDecompProblem(), and getScenarioDecompVar().
|
static |
creates the subproblem array. This array will be the same size as the number of children
| scip | the SCIP data structure |
| scenario | the scenario |
Definition at line 275 of file reader_sto.c.
References assert(), StoScenario::nchildren, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemoryArray, and StoScenario::subproblems.
Referenced by addScenarioVarsAndConsToProb(), and buildDecompProblem().
|
static |
adds a scenario to the subproblem array
| scenario | the scenario |
| subproblem | the subproblems data structure |
Definition at line 290 of file reader_sto.c.
References assert(), StoScenario::nchildren, StoScenario::nsubproblems, NULL, and StoScenario::subproblems.
Referenced by addScenarioVarsAndConsToProb(), and buildDecompProblem().
|
static |
returns the subproblem array for the scenario
| scenario | the scenario |
Definition at line 306 of file reader_sto.c.
References assert(), NULL, and StoScenario::subproblems.
Referenced by addScenarioVarsAndConsToProb(), and buildDecompProblem().
|
static |
returns the number of children for a given scenario
| scenario | the scenario |
Definition at line 317 of file reader_sto.c.
References assert(), StoScenario::nchildren, and NULL.
Referenced by addScenarioVarsAndConsToProb(), buildDecompProblem(), buildFullProblem(), buildScenarioTree(), and findScenarioInTree().
|
static |
returns a given child for a given scenario
| scenario | the scenario |
| childnum | the number of the desired child |
Definition at line 328 of file reader_sto.c.
References assert(), StoScenario::children, and NULL.
Referenced by addScenarioVarsAndConsToProb(), buildDecompProblem(), buildFullProblem(), and buildScenarioTree().
|
static |
returns the parent of a scenario
| scenario | the scenario |
Definition at line 341 of file reader_sto.c.
References assert(), NULL, and StoScenario::parent.
Referenced by computeScenarioProbability(), findScenarioVar(), and getScenarioDecompVar().
|
static |
sets the stage name
| scip | the SCIP data structure |
| scenario | the scenario |
| stagename | the stage name |
Definition at line 352 of file reader_sto.c.
References assert(), NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, and StoScenario::stagename.
Referenced by buildScenariosFromBlocks(), copyScenario(), createReaderdata(), readBlocks(), readIndep(), and readScenarios().
|
static |
returns the stage name
| scip | the SCIP data structure |
| scenario | the scenario |
Definition at line 368 of file reader_sto.c.
References assert(), NULL, and StoScenario::stagename.
Referenced by addScenarioVarsAndConsToProb(), buildScenariosFromBlocks(), buildScenarioTree(), and createScenariosFromBlocks().
|
static |
sets the stage num
| scip | the SCIP data structure |
| scenario | the scenario |
| stagenum | the stage num |
Definition at line 381 of file reader_sto.c.
References assert(), NULL, SCIP_OKAY, and StoScenario::stagenum.
Referenced by buildScenariosFromBlocks(), copyScenario(), createScenariosFromBlocks(), and readScenarios().
|
static |
returns the stage num
| scip | the SCIP data structure |
| scenario | the scenario |
Definition at line 397 of file reader_sto.c.
References assert(), NULL, and StoScenario::stagenum.
Referenced by addScenarioConsToProb(), addScenarioVarsAndConsToProb(), addScenarioVarsToProb(), findScenarioVar(), and getScenarioDecompVar().
|
static |
sets the scenario name
| scip | the SCIP data structure |
| scenario | the scenario |
| name | the scenario name |
Definition at line 410 of file reader_sto.c.
References assert(), StoScenario::name, NULL, SCIP_CALL, SCIP_OKAY, and SCIPduplicateBlockMemoryArray.
Referenced by buildScenariosFromBlocks(), copyScenario(), createReaderdata(), readBlocks(), readIndep(), and readScenarios().
|
static |
returns the scenario name
| scenario | the scenario |
Definition at line 426 of file reader_sto.c.
References assert(), StoScenario::name, and NULL.
Referenced by findScenarioInTree(), readBlocks(), and readIndep().
|
static |
sets the scenario num
| scip | the SCIP data structure |
| scenario | the scenario |
| scenarionum | the scenario num |
Definition at line 437 of file reader_sto.c.
References assert(), NULL, StoScenario::scenarionum, and SCIP_OKAY.
Referenced by buildScenariosFromBlocks(), copyScenario(), createScenariosFromBlocks(), and readScenarios().
|
static |
returns the scenario num
| scip | the SCIP data structure |
| scenario | the scenario |
Definition at line 453 of file reader_sto.c.
References assert(), NULL, and StoScenario::scenarionum.
Referenced by addScenarioConsToProb(), addScenarioVarsAndConsToProb(), addScenarioVarsToProb(), findScenarioVar(), and getScenarioDecompVar().
|
static |
sets the scenario probability
| scip | the SCIP data structure |
| scenario | the scenario |
| probability | the scenario probability |
Definition at line 466 of file reader_sto.c.
References assert(), NULL, StoScenario::probability, SCIP_OKAY, and SCIP_Real.
Referenced by copyScenario(), mergeScenarios(), readBlocks(), readIndep(), and readScenarios().
|
static |
returns the scenario probability
| scip | the SCIP data structure |
| scenario | the scenario |
Definition at line 482 of file reader_sto.c.
References assert(), NULL, StoScenario::probability, and SCIP_Real.
Referenced by computeScenarioProbability(), copyScenario(), and mergeScenarios().
|
static |
sets the scenario lowerbound
| scip | the SCIP data structure |
| scenario | the scenario |
| lowerbound | the scenario lowerbound |
Definition at line 495 of file reader_sto.c.
References assert(), StoScenario::lowerbound, NULL, SCIP_OKAY, and SCIP_Real.
Referenced by copyScenario(), and readScenarios().
|
static |
returns the scenario lowerbound
| scip | the SCIP data structure |
| scenario | the scenario |
Definition at line 511 of file reader_sto.c.
References assert(), StoScenario::lowerbound, NULL, and SCIP_Real.
Referenced by addScenarioVarsAndConsToProb(), buildDecompProblem(), and copyScenario().
|
static |
add scenario entry
| scip | the SCIP data structure |
| scenario | the scenario |
| rowname | the row name for the entry |
| colname | the col name for the entry |
| value | the value for the entry |
Definition at line 524 of file reader_sto.c.
References assert(), StoScenario::colnames, StoScenario::entriessize, StoScenario::nentries, NULL, StoScenario::rownames, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPcalcMemGrowSize(), SCIPduplicateBlockMemoryArray, SCIPreallocBlockMemoryArray, and StoScenario::values.
Referenced by copyScenario(), mergeScenarios(), readBlocks(), readIndep(), and readScenarios().
|
static |
returns the number of entries for a scenario
| scenario | the scenario |
Definition at line 556 of file reader_sto.c.
References assert(), StoScenario::nentries, and NULL.
Referenced by addScenarioVarsAndConsToProb().
|
static |
returns an entry row for a scenario
| scenario | the scenario |
| entry | the entry number |
Definition at line 567 of file reader_sto.c.
References assert(), NULL, and StoScenario::rownames.
Referenced by addScenarioVarsAndConsToProb().
|
static |
returns an entry column for a scenario
| scenario | the scenario |
| entry | the entry number |
Definition at line 580 of file reader_sto.c.
References assert(), StoScenario::colnames, and NULL.
Referenced by addScenarioVarsAndConsToProb().
|
static |
returns an entry value for a scenario
| scenario | the scenario |
| entry | the entry number |
Definition at line 593 of file reader_sto.c.
References assert(), NULL, SCIP_Real, and StoScenario::values.
Referenced by addScenarioVarsAndConsToProb().
|
static |
copies a scenario. In the case of blocks, the scenarios must be combined
| scip | the SCIP data structure |
| sourcescenario | the source scenario |
| targetscenario | the target scenario |
| copyname | should the name be copied? |
Definition at line 608 of file reader_sto.c.
References addScenarioEntry(), assert(), StoScenario::colnames, getScenarioLowerbound(), getScenarioProbability(), i, StoScenario::name, StoScenario::nentries, NULL, StoScenario::rownames, StoScenario::scenarionum, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, setScenarioLowerbound(), setScenarioName(), setScenarioNum(), setScenarioProbability(), setScenarioStageName(), setScenarioStageNum(), StoScenario::stagename, StoScenario::stagenum, and StoScenario::values.
Referenced by buildScenariosFromBlocks(), and scenarioAddChild().
|
static |
merge scenarios. In the case of blocks, the scenarios must be combined
| scip | the SCIP data structure |
| scenario1 | the first scenario |
| mergedscenario | the merged scenario |
Definition at line 651 of file reader_sto.c.
References addScenarioEntry(), assert(), StoScenario::colnames, getScenarioProbability(), i, StoScenario::nentries, NULL, StoScenario::rownames, SCIP_CALL, SCIP_OKAY, SCIP_Real, setScenarioProbability(), and StoScenario::values.
Referenced by buildScenariosFromBlocks().
|
static |
adds a child to a given scenario
| scip | the SCIP data structure |
| parent | the parent scenario |
| child | the child scenario |
Definition at line 678 of file reader_sto.c.
References assert(), StoScenario::children, copyScenario(), createScenarioData(), StoScenario::nchildren, NULL, StoScenario::parent, SCIP_CALL, SCIP_OKAY, SCIPensureBlockMemoryArray, and TRUE.
Referenced by buildScenarioTree(), and insertScenarioInReaderdata().
|
static |
recursively adds the scenarios to the reader data
| scip | the SCIP data structure |
| scenariotree | the scenario tree |
| scenarios | the array of scenarios |
| numscenarios | the number of scenarios per stage |
| numstages | the number of stages |
| stage | the number of the stage. Also the depth of the tree |
Definition at line 706 of file reader_sto.c.
References assert(), buildScenarioTree(), getScenarioChild(), getScenarioNChildren(), getScenarioStageName(), i, NULL, scenarioAddChild(), SCIP_CALL, SCIP_OKAY, and SCIPtimGetStageName().
Referenced by addScenariosToReaderdata(), and buildScenarioTree().
|
static |
| scip | the SCIP data structure |
| readerdata | the reader data |
| scenarios | the array of scenarios |
| numscenarios | the number of scenarios per stage |
| numscenariostages | the number of stages for which scenarios were collected |
Definition at line 752 of file reader_sto.c.
References assert(), buildScenarioTree(), i, NULL, SCIP_CALL, SCIP_OKAY, and SCIPtimGetNStages().
Referenced by createScenariosFromBlocks().
|
static |
finds a scenario with a given name
| scenariotree | the scenario tree to search |
| scenname | the name of the scenario to search |
Definition at line 779 of file reader_sto.c.
References StoScenario::children, findScenarioInTree(), getScenarioName(), getScenarioNChildren(), i, and NULL.
Referenced by findScenarioInTree(), and insertScenarioInReaderdata().
|
static |
inserts a scenario into the reader data scenario tree
| scip | the SCIP data structure |
| readerdata | the reader data |
| scenario | the scenario to insert in the scenario tree |
| parentname | the parent scenario for the inserting scenario |
Definition at line 806 of file reader_sto.c.
References assert(), findScenarioInTree(), NULL, scenarioAddChild(), SCIP_CALL, and SCIP_OKAY.
Referenced by readScenarios().
|
static |
| scip | the SCIP data structure |
| blocks | the block that form the scenarios |
| scenarios | the array to store the scenarios |
| blocksforscen | the blocks that will form the scenario |
| numblocksforscen | the number of blocks that form the scenario |
| numblocks | the number of blocks |
| numblocksperblock | the number of blocks for a given block |
| numscenarios | the number of scenarios |
| scenariossize | the size of scenarios array |
| stage | the stage for this scenario |
| stagenum | the number of the stage |
| blocknum | the block number |
Definition at line 833 of file reader_sto.c.
References assert(), buildScenariosFromBlocks(), copyScenario(), createScenarioData(), FALSE, getScenarioStageName(), i, mergeScenarios(), NULL, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPcalcMemGrowSize(), SCIPreallocBlockMemoryArray, SCIPsnprintf(), setScenarioName(), setScenarioNum(), setScenarioStageName(), setScenarioStageNum(), and TRUE.
Referenced by buildScenariosFromBlocks(), and createScenariosFromBlocks().
|
static |
| scip | the SCIP data structure |
| readerdata | the reader data |
| blocks | the block that form the scenarios |
| numblocks | the number of blocks |
| numblocksperblock | the number of blocks for each block type |
| numstages | the number of stages |
Definition at line 930 of file reader_sto.c.
References addScenariosToReaderdata(), assert(), buildScenariosFromBlocks(), freeScenarioTree(), getScenarioStageName(), i, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPallocBlockMemoryArray, SCIPallocBufferArray, SCIPfreeBlockMemoryArray, SCIPfreeBufferArray, SCIPsnprintf(), setScenarioNum(), setScenarioStageNum(), and STO_DEFAULT_BLOCKARRAYSIZE.
Referenced by readBlocks(), and readIndep().
|
static |
creates the reader data
| scip | SCIP data structure |
| readerdata | the reader data |
Definition at line 1006 of file reader_sto.c.
References assert(), createScenarioData(), NULL, SCIP_CALL, SCIP_OKAY, SCIPtimGetStageName(), setScenarioName(), and setScenarioStageName().
Referenced by readSto().
|
static |
frees the reader data
| scip | the SCIP data structure |
| readerdata | the reader data |
Definition at line 1026 of file reader_sto.c.
References assert(), freeScenarioTree(), NULL, SCIP_CALL, SCIP_OKAY, and SCIPfreeBlockMemory.
Referenced by SCIP_DECL_READERFREE().
|
static |
creates the sto input structure
| scip | SCIP data structure |
| stoi | sto input structure |
| fp | file object for the input file |
Definition at line 1045 of file reader_sto.c.
References assert(), FALSE, StoInput::fp, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, STO_STOCH, and STO_STOCHINFO_NONE.
Referenced by readSto().
free the sto input structure
| scip | SCIP data structure |
| stoi | sto input structure |
Definition at line 1077 of file reader_sto.c.
References SCIPfreeBlockMemory.
Referenced by readSto().
|
static |
returns the current section
| stoi | sto input structure |
Definition at line 1087 of file reader_sto.c.
References assert(), NULL, and StoInput::section.
Referenced by readSto().
|
static |
returns the stochastic information type
| stoi | sto input structure |
Definition at line 1098 of file reader_sto.c.
References assert(), NULL, and StoInput::stochinfotype.
Referenced by readSto().
|
static |
return the current value of field 0
| stoi | sto input structure |
Definition at line 1109 of file reader_sto.c.
References assert(), StoInput::f0, and NULL.
Referenced by readBlocks(), readIndep(), readScenarios(), and readStoch().
|
static |
return the current value of field 1
| stoi | sto input structure |
Definition at line 1120 of file reader_sto.c.
References assert(), StoInput::f1, and NULL.
Referenced by readBlocks(), readIndep(), readScenarios(), and readStoch().
|
static |
return the current value of field 2
| stoi | sto input structure |
Definition at line 1131 of file reader_sto.c.
References assert(), StoInput::f2, and NULL.
Referenced by readBlocks(), readIndep(), and readScenarios().
|
static |
return the current value of field 3
| stoi | sto input structure |
Definition at line 1142 of file reader_sto.c.
References assert(), StoInput::f3, and NULL.
Referenced by readBlocks(), readIndep(), and readScenarios().
|
static |
return the current value of field 4
| stoi | sto input structure |
Definition at line 1153 of file reader_sto.c.
References assert(), StoInput::f4, and NULL.
Referenced by readBlocks(), readIndep(), and readScenarios().
|
static |
return the current value of field 5
| stoi | sto input structure |
Definition at line 1164 of file reader_sto.c.
References assert(), StoInput::f5, and NULL.
Referenced by readIndep(), and readScenarios().
|
static |
return the current value of field 6
| stoi | sto input structure |
Definition at line 1175 of file reader_sto.c.
References assert(), StoInput::f6, and NULL.
Referenced by readScenarios().
returns if an error was detected
| stoi | sto input structure |
Definition at line 1186 of file reader_sto.c.
References assert(), StoInput::haserror, NULL, and SCIP_Bool.
Referenced by readSto().
|
static |
set the section in the sto input structure to given section
| stoi | sto input structure |
| section | section that is set |
Definition at line 1197 of file reader_sto.c.
References assert(), NULL, and StoInput::section.
Referenced by readBlocks(), readIndep(), readScenarios(), and readStoch().
|
static |
set the stochastic info type in the sto input structure
| stoi | sto input structure |
| stochinfotype | the stochastic infomation type |
Definition at line 1209 of file reader_sto.c.
References assert(), NULL, and StoInput::stochinfotype.
Referenced by readStoch().
|
static |
set the problem name in the sto input structure to given problem name
| stoi | sto input structure |
| probname | name of the problem to set |
Definition at line 1221 of file reader_sto.c.
References assert(), NULL, StoInput::probname, SCIPmemccpy(), and STO_MAX_NAMELEN.
Referenced by readStoch().
|
static |
set the type name in the sto input structure to given objective name
| stoi | sto input structure |
| stochtype | name of the scenario type |
Definition at line 1235 of file reader_sto.c.
References assert(), NULL, SCIPmemccpy(), STO_MAX_NAMELEN, and StoInput::stochtype.
Referenced by readBlocks(), readIndep(), and readScenarios().
|
static |
| stoi | sto input structure |
Definition at line 1248 of file reader_sto.c.
References assert(), StoInput::haserror, StoInput::lineno, NULL, SCIPerrorMessage, StoInput::section, STO_ENDATA, and TRUE.
Referenced by readBlocks(), readIndep(), readScenarios(), readSto(), and readStoch().
|
static |
fill the line from pos up to column 80 with blanks.
| buf | buffer to clear |
| pos | position to start the clearing process |
Definition at line 1261 of file reader_sto.c.
References BLANK, StoInput::buf, and i.
Referenced by stoinputReadLine().
read a sto format data line and parse the fields.
| stoi | sto input structure |
Definition at line 1275 of file reader_sto.c.
References assert(), BLANK, StoInput::buf, clearFrom(), StoInput::f0, StoInput::f1, StoInput::f2, StoInput::f3, StoInput::f4, StoInput::f5, StoInput::f6, FALSE, StoInput::fp, i, StoInput::lineno, NULL, SCIP_Bool, SCIPdebugMessage, SCIPfgets(), SCIPstrtok(), STO_MAX_LINELEN, and TRUE.
Referenced by readBlocks(), readIndep(), readScenarios(), and readStoch().
|
static |
Process STOCH section.
| scip | SCIP data structure |
| stoi | sto input structure |
Definition at line 1384 of file reader_sto.c.
References assert(), NULL, SCIP_OKAY, SCIPdebugMsg, STO_BLOCKS, STO_INDEP, STO_SCENARIOS, STO_STOCHINFO_DISCRETE, STO_STOCHINFO_LINTR, STO_STOCHINFO_NORMAL, STO_STOCHINFO_SUB, STO_STOCHINFO_UNIFORM, stoinputField0(), stoinputField1(), stoinputReadLine(), stoinputSetProbname(), stoinputSetSection(), stoinputSetStochInfoType(), and stoinputSyntaxerror().
Referenced by readSto().
|
static |
Process BLOCKS section.
| stoi | sto input structure |
| scip | SCIP data structure |
| readerdata | the reader data |
Definition at line 1446 of file reader_sto.c.
References addScenarioEntry(), createScenarioData(), createScenariosFromBlocks(), FALSE, freeScenarioTree(), getScenarioName(), i, NULL, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPallocBlockMemoryArray, SCIPcalcMemGrowSize(), SCIPdebugMsg, SCIPerrorMessage, SCIPfreeBlockMemoryArray, SCIPreallocBlockMemoryArray, SCIPsnprintf(), setScenarioName(), setScenarioProbability(), setScenarioStageName(), STO_BLOCKS, STO_DEFAULT_ARRAYSIZE, STO_DEFAULT_BLOCKARRAYSIZE, STO_ENDATA, stoinputField0(), stoinputField1(), stoinputField2(), stoinputField3(), stoinputField4(), stoinputReadLine(), stoinputSetSection(), stoinputSetStochtype(), stoinputSyntaxerror(), and TRUE.
Referenced by readSto().
|
static |
Process SCENARIOS section.
| stoi | sto input structure |
| scip | SCIP data structure |
| readerdata | the reader data |
Definition at line 1611 of file reader_sto.c.
References addScenarioEntry(), assert(), createScenarioData(), FALSE, freeScenarioTree(), insertScenarioInReaderdata(), NULL, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPdebugMsg, SCIPerrorMessage, SCIPsnprintf(), SCIPtimFindStage(), setScenarioLowerbound(), setScenarioName(), setScenarioNum(), setScenarioProbability(), setScenarioStageName(), setScenarioStageNum(), STO_ENDATA, STO_SCENARIOS, stoinputField0(), stoinputField1(), stoinputField2(), stoinputField3(), stoinputField4(), stoinputField5(), stoinputField6(), stoinputReadLine(), stoinputSetSection(), stoinputSetStochtype(), stoinputSyntaxerror(), and TRUE.
Referenced by readSto().
|
static |
Process INDEP section.
| stoi | sto input structure |
| scip | SCIP data structure |
| readerdata | the reader data |
Definition at line 1754 of file reader_sto.c.
References addScenarioEntry(), createScenarioData(), createScenariosFromBlocks(), FALSE, freeScenarioTree(), getScenarioName(), i, NULL, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPallocBlockMemoryArray, SCIPcalcMemGrowSize(), SCIPdebugMsg, SCIPfreeBlockMemoryArray, SCIPreallocBlockMemoryArray, SCIPsnprintf(), SCIPtimConsGetStageName(), setScenarioName(), setScenarioProbability(), setScenarioStageName(), STO_DEFAULT_ARRAYSIZE, STO_DEFAULT_BLOCKARRAYSIZE, STO_ENDATA, STO_INDEP, stoinputField0(), stoinputField1(), stoinputField2(), stoinputField3(), stoinputField4(), stoinputField5(), stoinputReadLine(), stoinputSetSection(), stoinputSetStochtype(), stoinputSyntaxerror(), and TRUE.
Referenced by readSto().
|
static |
computes the probability of a scenario
| scip | the SCIP data structure |
| scenario | the current scenario |
Definition at line 1923 of file reader_sto.c.
References assert(), getScenarioParent(), getScenarioProbability(), NULL, and SCIP_Real.
Referenced by addScenarioVarsAndConsToProb(), and addScenarioVarsToProb().
|
static |
gets the variable name
| name | the name to be returned |
| varname | the root of the variable name |
| stagenum | the stage number |
| scenarionum | the scenario number |
Definition at line 1948 of file reader_sto.c.
References SCIP_MAXSTRLEN, and SCIPsnprintf().
Referenced by addScenarioConsToProb(), addScenarioVarsAndConsToProb(), addScenarioVarsToProb(), findScenarioVar(), and getScenarioDecompVar().
|
static |
add variables to the scenario
| scip | the SCIP data structure |
| scenario | the current scenario |
| varmap | the variable map from the original to the subproblem variables |
| vars | the variables of the core problem associated with this scenario |
| nvars | the number of variables for this scenario |
Definition at line 1964 of file reader_sto.c.
References assert(), computeScenarioProbability(), getScenarioEntityName(), getScenarioNum(), getScenarioStageNum(), i, NULL, nvars, obj, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddVar(), SCIPcreateVar(), SCIPdebugMessage, SCIPhashmapInsert(), SCIPreleaseVar(), SCIPvarGetLbOriginal(), SCIPvarGetName(), SCIPvarGetObj(), SCIPvarGetType(), SCIPvarGetUbOriginal(), SCIPvarIsDeleted(), SCIPvarIsInitial(), SCIPvarIsRemovable(), var, and vars.
Referenced by addScenarioVarsAndConsToProb().
|
static |
finds the scenario variable to add to a constraint
| scip | the SCIP data structure |
| scenario | the current scenario |
| consvar | the variable in the constraint that is being searched for |
| scenariovar | pointer to return the variable to be added to the constraint |
Definition at line 2021 of file reader_sto.c.
References assert(), getScenarioEntityName(), getScenarioNum(), getScenarioParent(), getScenarioStageNum(), NULL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_READERROR, SCIPerrorMessage, SCIPfindVar(), SCIPsnprintf(), and SCIPvarGetName().
Referenced by addScenarioConsToProb().
|
static |
create variable for the decomposed scenario
| scip | the SCIP data structure |
| scenario | the current scenario |
| consvar | the variable in the constraint that is being searched for |
| scenariovar | pointer to return the variable to be added to the constraint |
| varadded | pointer to indicate whether a variable has been added |
Definition at line 2069 of file reader_sto.c.
References assert(), FALSE, getScenarioEntityName(), getScenarioNum(), getScenarioParent(), getScenarioScip(), getScenarioStageNum(), NULL, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPaddVar(), SCIPcreateVar(), SCIPfindVar(), SCIPsnprintf(), SCIPvarGetLbOriginal(), SCIPvarGetName(), SCIPvarGetType(), SCIPvarGetUbOriginal(), SCIPvarIsInitial(), SCIPvarIsRemovable(), TRUE, and var.
Referenced by addScenarioConsToProb().
|
static |
adds the constraint to the scenario problem
| scip | the SCIP data structure |
| scenarioscip | the scenario SCIP data structure |
| scenario | the current scenario |
| varmap | the variable map from the original to the subproblem variables |
| conss | the constraints of the core problem associated with this scenario |
| nconss | the number of constraints for this scenario |
| decomp | is the problem being decomposed |
Definition at line 2135 of file reader_sto.c.
References assert(), FALSE, findScenarioVar(), getScenarioDecompVar(), getScenarioEntityName(), getScenarioNum(), getScenarioStageNum(), i, NULL, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_READERROR, SCIPaddCons(), SCIPallocBufferArray, SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconsIsChecked(), SCIPconsIsDeleted(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsMarkedPropagate(), SCIPconsIsModifiable(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPerrorMessage, SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPgetConsCopy(), SCIPgetConsNVars(), SCIPgetConsVars(), SCIPhashmapExists(), SCIPhashmapInsert(), SCIPreleaseCons(), SCIPreleaseVar(), and TRUE.
Referenced by addScenarioVarsAndConsToProb().
|
static |
add variables and constraint to problem
| scip | the SCIP data structure of master problem |
| scenario | the current scenario |
| decomp | is the problem being decomposed |
Definition at line 2254 of file reader_sto.c.
References addScenarioConsToProb(), addScenarioSubproblem(), addScenarioVarsAndConsToProb(), addScenarioVarsToProb(), assert(), computeScenarioProbability(), createScenarioSubproblemArray(), getScenarioChild(), getScenarioEntityName(), getScenarioEntryCol(), getScenarioEntryRow(), getScenarioEntryValue(), getScenarioLowerbound(), getScenarioNChildren(), getScenarioNEntries(), getScenarioNum(), getScenarioScip(), getScenarioStageName(), getScenarioStageNum(), getScenarioSubproblemArray(), i, NULL, nvars, obj, RHS, RIGHT, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_READERROR, SCIP_Real, SCIPbendersUpdateSubproblemLowerbound(), SCIPblkmem(), SCIPchgCoefLinear(), SCIPchgLhsLinear(), SCIPchgRhsLinear(), SCIPchgVarObj(), SCIPcreate(), SCIPcreateBendersDefault(), SCIPcreateProbBasic(), SCIPdebugMessage, SCIPenableDebugSol(), SCIPerrorMessage, SCIPfindBenders(), SCIPfindCons(), SCIPfindVar(), SCIPgetLhsLinear(), SCIPgetNVars(), SCIPgetProbName(), SCIPgetRhsLinear(), SCIPhashmapCreate(), SCIPhashmapFree(), SCIPincludeDefaultPlugins(), SCIPinfinity(), SCIPisLT(), SCIPsetBoolParam(), SCIPsnprintf(), SCIPtimFindStage(), SCIPtimGetNStages(), SCIPtimGetStageConss(), SCIPtimGetStageNConss(), SCIPtimGetStageNVars(), SCIPtimGetStageVars(), setScenarioScip(), TRUE, var, and vars.
Referenced by addScenarioVarsAndConsToProb(), buildDecompProblem(), and buildFullProblem().
|
static |
removes the core variables and constriants for stage 2 and lower
| scip | the SCIP data structure |
Definition at line 2463 of file reader_sto.c.
References assert(), i, NULL, nvars, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconsIsDeleted(), SCIPdelCons(), SCIPdelVar(), SCIPtimGetNStages(), SCIPtimGetStageConss(), SCIPtimGetStageNConss(), SCIPtimGetStageNVars(), SCIPtimGetStageVars(), SCIPvarIsDeleted(), and vars.
Referenced by buildDecompProblem(), and buildFullProblem().
|
static |
| scip | the SCIP data structure |
| readerdata | the reader data |
Definition at line 2513 of file reader_sto.c.
References addScenarioVarsAndConsToProb(), assert(), FALSE, getScenarioChild(), getScenarioNChildren(), i, NULL, removeCoreVariablesAndConstraints(), SCIP_CALL, and SCIP_OKAY.
Referenced by readSto().
|
static |
builds the stochastic program using Benders' decomposition
| scip | the SCIP data structure |
| readerdata | the reader data |
Definition at line 2537 of file reader_sto.c.
References addScenarioSubproblem(), addScenarioVarsAndConsToProb(), assert(), createScenarioSubproblemArray(), getScenarioChild(), getScenarioLowerbound(), getScenarioNChildren(), getScenarioScip(), getScenarioSubproblemArray(), i, NULL, removeCoreVariablesAndConstraints(), SCIP_CALL, SCIP_OKAY, SCIP_PARAMSETTING_OFF, SCIPbendersUpdateSubproblemLowerbound(), SCIPcreateBendersDefault(), SCIPfindBenders(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsetPresolving(), setScenarioScip(), and TRUE.
Referenced by readSto().
|
static |
Read the stochastic information of an SMPS file instance in "STO File Format".
| scip | SCIP data structure |
| filename | name of the input file |
| readerdata | the reader data |
Definition at line 2597 of file reader_sto.c.
References assert(), buildDecompProblem(), buildFullProblem(), createReaderdata(), FALSE, StoInput::fp, NULL, readBlocks(), readIndep(), readScenarios(), readStoch(), SCIP_Bool, SCIP_CALL_FINALLY, SCIP_CALL_TERMINATE, SCIP_NOFILE, SCIP_OKAY, SCIP_READERROR, SCIPerrorMessage, SCIPfclose(), SCIPfopen(), SCIPinfoMessage(), SCIPprintSysError(), SCIPtimGetNStages(), STO_BLOCKS, STO_ENDATA, STO_INDEP, STO_SCENARIOS, STO_STOCHINFO_DISCRETE, stoinputCreate(), stoinputFree(), stoinputHasError(), stoinputSection(), stoinputStochInfoType(), stoinputSyntaxerror(), and TRUE.
Referenced by SCIPreadSto().
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 2697 of file reader_sto.c.
References assert(), NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderSto(), and SCIPreaderGetName().
|
static |
destructor of reader to free user data (called when SCIP is exiting)
Definition at line 2711 of file reader_sto.c.
References assert(), freeReaderdata(), NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPreaderGetData(), and SCIPreaderGetName().
|
static |
problem reading method of reader
Definition at line 2726 of file reader_sto.c.
References assert(), NULL, READER_NAME, result, SCIP_CALL, SCIP_DIDNOTRUN, SCIP_OKAY, SCIPcorHasRead(), SCIPfindReader(), SCIPreaderGetName(), SCIPreadSto(), SCIPtimHasRead(), and SCIPwarningMessage().