Detailed Description
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 ' ' |
Typedefs | |
typedef struct StoScenario | STOSCENARIO |
typedef enum StoSection | STOSECTION |
typedef enum StoStochInfo | STOSTOCHINFO |
typedef struct StoInput | STOINPUT |
Enumerations | |
enum | StoSection { STO_STOCH, STO_SCENARIOS, STO_BLOCKS, STO_INDEP, STO_ENDATA } |
enum | StoStochInfo { STO_STOCHINFO_NONE = -1, STO_STOCHINFO_DISCRETE = 0, STO_STOCHINFO_UNIFORM = 1, STO_STOCHINFO_NORMAL = 2, STO_STOCHINFO_SUB = 3, STO_STOCHINFO_LINTR = 4 } |
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 | 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 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_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, STOSCENARIO *scenario, 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) |
Macro Definition Documentation
◆ READER_NAME
#define READER_NAME "storeader" |
Definition at line 50 of file reader_sto.c.
Referenced by SCIP_DECL_READERCOPY(), SCIP_DECL_READERFREE(), SCIP_DECL_READERREAD(), SCIPincludeReaderSto(), SCIPreadSto(), and SCIPstoGetNScenarios().
◆ READER_DESC
#define READER_DESC "file reader for stochastic information of stochastic programs in the SMPS file format" |
Definition at line 51 of file reader_sto.c.
Referenced by SCIPincludeReaderSto().
◆ READER_EXTENSION
#define READER_EXTENSION "sto" |
Definition at line 52 of file reader_sto.c.
Referenced by SCIPincludeReaderSto().
◆ DEFAULT_USEBENDERS
#define DEFAULT_USEBENDERS FALSE |
should Benders' decomposition be used for the stochastic program?
Definition at line 54 of file reader_sto.c.
Referenced by SCIPincludeReaderSto().
◆ STO_MAX_LINELEN
#define STO_MAX_LINELEN 1024 |
Definition at line 60 of file reader_sto.c.
Referenced by stoinputReadLine().
◆ STO_MAX_NAMELEN
#define STO_MAX_NAMELEN 256 |
Definition at line 61 of file reader_sto.c.
Referenced by stoinputSetProbname(), and stoinputSetStochtype().
◆ STO_DEFAULT_ARRAYSIZE
#define STO_DEFAULT_ARRAYSIZE 100 |
Definition at line 63 of file reader_sto.c.
Referenced by readBlocks(), and readIndep().
◆ STO_DEFAULT_ENTRIESSIZE
#define STO_DEFAULT_ENTRIESSIZE 20 |
Definition at line 64 of file reader_sto.c.
Referenced by createScenarioData().
◆ STO_DEFAULT_BLOCKARRAYSIZE
#define STO_DEFAULT_BLOCKARRAYSIZE 5 |
Definition at line 65 of file reader_sto.c.
Referenced by createScenariosFromBlocks(), readBlocks(), and readIndep().
◆ STO_DEFAULT_CHILDRENSIZE
#define STO_DEFAULT_CHILDRENSIZE 5 |
Definition at line 66 of file reader_sto.c.
Referenced by createScenarioData().
◆ BLANK
#define BLANK ' ' |
Definition at line 68 of file reader_sto.c.
Referenced by clearFrom(), and stoinputReadLine().
Typedef Documentation
◆ STOSCENARIO
typedef struct StoScenario STOSCENARIO |
Definition at line 70 of file reader_sto.c.
◆ STOSECTION
typedef enum StoSection STOSECTION |
Definition at line 114 of file reader_sto.c.
◆ STOSTOCHINFO
typedef enum StoStochInfo STOSTOCHINFO |
Definition at line 126 of file reader_sto.c.
◆ STOINPUT
Definition at line 146 of file reader_sto.c.
Enumeration Type Documentation
◆ StoSection
enum StoSection |
enum containing all sto sections
Enumerator | |
---|---|
STO_STOCH | |
STO_SCENARIOS | |
STO_BLOCKS | |
STO_INDEP | |
STO_ENDATA |
Definition at line 106 of file reader_sto.c.
◆ StoStochInfo
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 117 of file reader_sto.c.
Function Documentation
◆ createScenarioData()
|
static |
creates a scenario structure
- Parameters
-
scip SCIP data structure scenariodata the scenario to be created
Definition at line 150 of file reader_sto.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, SCIPdebugMessage, STO_DEFAULT_CHILDRENSIZE, and STO_DEFAULT_ENTRIESSIZE.
Referenced by buildScenariosFromBlocks(), createReaderdata(), readBlocks(), readIndep(), readScenarios(), and scenarioAddChild().
◆ freeScenarioTree()
|
static |
frees the memory used for the scenario tree
- Parameters
-
scip the SCIP data structure scenariotree the scenario tree
Definition at line 185 of file reader_sto.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPfree(), SCIPfreeBlockMemory, and SCIPfreeBlockMemoryArray.
Referenced by createScenariosFromBlocks(), freeReaderdata(), readBlocks(), readIndep(), and readScenarios().
◆ setScenarioScip()
|
static |
sets the SCIP pointer to the scenario
- Parameters
-
scenario the scenario scip the SCIP data structure
Definition at line 230 of file reader_sto.c.
References NULL, and StoScenario::scip.
Referenced by addScenarioVarsAndConsToProb(), and buildDecompProblem().
◆ getScenarioScip()
|
static |
returns the SCIP pointer to the scenario
- Parameters
-
scenario the scenario
Definition at line 243 of file reader_sto.c.
References NULL, and StoScenario::scip.
Referenced by addScenarioVarsAndConsToProb(), buildDecompProblem(), and getScenarioDecompVar().
◆ createScenarioSubproblemArray()
|
static |
creates the subproblem array. This array will be the same size as the number of children
- Parameters
-
scip the SCIP data structure scenario the scenario
Definition at line 254 of file reader_sto.c.
References StoScenario::nchildren, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemoryArray, and StoScenario::subproblems.
Referenced by addScenarioVarsAndConsToProb(), and buildDecompProblem().
◆ addScenarioSubproblem()
|
static |
adds a scenario to the subproblem array
- Parameters
-
scenario the scenario subproblem the subproblems data structure
Definition at line 269 of file reader_sto.c.
References StoScenario::nchildren, StoScenario::nsubproblems, NULL, and StoScenario::subproblems.
Referenced by addScenarioVarsAndConsToProb(), and buildDecompProblem().
◆ getScenarioSubproblemArray()
|
static |
returns the subproblem array for the scenario
- Parameters
-
scenario the scenario
Definition at line 285 of file reader_sto.c.
References NULL, and StoScenario::subproblems.
Referenced by addScenarioVarsAndConsToProb(), and buildDecompProblem().
◆ getScenarioNChildren()
|
static |
returns the number of children for a given scenario
- Parameters
-
scenario the scenario
Definition at line 296 of file reader_sto.c.
References StoScenario::nchildren, and NULL.
Referenced by addScenarioVarsAndConsToProb(), buildDecompProblem(), buildFullProblem(), buildScenarioTree(), and findScenarioInTree().
◆ getScenarioChild()
|
static |
returns a given child for a given scenario
- Parameters
-
scenario the scenario childnum the number of the desired child
Definition at line 307 of file reader_sto.c.
References StoScenario::children, and NULL.
Referenced by addScenarioVarsAndConsToProb(), buildDecompProblem(), buildFullProblem(), and buildScenarioTree().
◆ getScenarioParent()
|
static |
returns the parent of a scenario
- Parameters
-
scenario the scenario
Definition at line 320 of file reader_sto.c.
References NULL, and StoScenario::parent.
Referenced by computeScenarioProbability(), findScenarioVar(), and getScenarioDecompVar().
◆ setScenarioStageName()
|
static |
sets the stage name
- Parameters
-
scip the SCIP data structure scenario the scenario stagename the stage name
Definition at line 331 of file reader_sto.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, and StoScenario::stagename.
Referenced by buildScenariosFromBlocks(), copyScenario(), createReaderdata(), readBlocks(), readIndep(), and readScenarios().
◆ getScenarioStageName()
|
static |
returns the stage name
- Parameters
-
scip the SCIP data structure scenario the scenario
Definition at line 347 of file reader_sto.c.
References NULL, and StoScenario::stagename.
Referenced by addScenarioVarsAndConsToProb(), buildScenariosFromBlocks(), buildScenarioTree(), and createScenariosFromBlocks().
◆ setScenarioStageNum()
|
static |
sets the stage num
- Parameters
-
scip the SCIP data structure scenario the scenario stagenum the stage num
Definition at line 360 of file reader_sto.c.
References NULL, SCIP_OKAY, and StoScenario::stagenum.
Referenced by buildScenariosFromBlocks(), copyScenario(), createScenariosFromBlocks(), and readScenarios().
◆ getScenarioStageNum()
|
static |
returns the stage num
- Parameters
-
scip the SCIP data structure scenario the scenario
Definition at line 376 of file reader_sto.c.
References NULL, and StoScenario::stagenum.
Referenced by addScenarioConsToProb(), addScenarioVarsAndConsToProb(), addScenarioVarsToProb(), findScenarioVar(), and getScenarioDecompVar().
◆ setScenarioName()
|
static |
sets the scenario name
- Parameters
-
scip the SCIP data structure scenario the scenario name the scenario name
Definition at line 389 of file reader_sto.c.
References StoScenario::name, NULL, SCIP_CALL, SCIP_OKAY, and SCIPduplicateBlockMemoryArray.
Referenced by buildScenariosFromBlocks(), copyScenario(), createReaderdata(), readBlocks(), readIndep(), and readScenarios().
◆ getScenarioName()
|
static |
returns the scenario name
- Parameters
-
scenario the scenario
Definition at line 405 of file reader_sto.c.
References StoScenario::name, and NULL.
Referenced by findScenarioInTree(), readBlocks(), and readIndep().
◆ setScenarioNum()
|
static |
sets the scenario num
- Parameters
-
scip the SCIP data structure scenario the scenario scenarionum the scenario num
Definition at line 416 of file reader_sto.c.
References NULL, StoScenario::scenarionum, and SCIP_OKAY.
Referenced by buildScenariosFromBlocks(), copyScenario(), createScenariosFromBlocks(), and readScenarios().
◆ getScenarioNum()
|
static |
returns the scenario num
- Parameters
-
scip the SCIP data structure scenario the scenario
Definition at line 432 of file reader_sto.c.
References NULL, and StoScenario::scenarionum.
Referenced by addScenarioConsToProb(), addScenarioVarsAndConsToProb(), addScenarioVarsToProb(), findScenarioVar(), and getScenarioDecompVar().
◆ setScenarioProbability()
|
static |
sets the scenario probability
- Parameters
-
scip the SCIP data structure scenario the scenario probability the scenario probability
Definition at line 445 of file reader_sto.c.
References NULL, StoScenario::probability, and SCIP_OKAY.
Referenced by copyScenario(), mergeScenarios(), readBlocks(), readIndep(), and readScenarios().
◆ getScenarioProbability()
|
static |
returns the scenario probability
- Parameters
-
scip the SCIP data structure scenario the scenario
Definition at line 461 of file reader_sto.c.
References NULL, and StoScenario::probability.
Referenced by computeScenarioProbability(), copyScenario(), and mergeScenarios().
◆ addScenarioEntry()
|
static |
add scenario entry
- Parameters
-
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 474 of file reader_sto.c.
References StoScenario::colnames, StoScenario::entriessize, StoScenario::nentries, NULL, StoScenario::rownames, SCIP_CALL, SCIP_OKAY, SCIPcalcMemGrowSize(), SCIPduplicateBlockMemoryArray, SCIPreallocBlockMemoryArray, and StoScenario::values.
Referenced by copyScenario(), mergeScenarios(), readBlocks(), readIndep(), and readScenarios().
◆ getScenarioNEntries()
|
static |
returns the number of entries for a scenario
- Parameters
-
scenario the scenario
Definition at line 506 of file reader_sto.c.
References StoScenario::nentries, and NULL.
Referenced by addScenarioVarsAndConsToProb().
◆ getScenarioEntryRow()
|
static |
returns an entry row for a scenario
- Parameters
-
scenario the scenario entry the entry number
Definition at line 517 of file reader_sto.c.
References NULL, and StoScenario::rownames.
Referenced by addScenarioVarsAndConsToProb().
◆ getScenarioEntryCol()
|
static |
returns an entry column for a scenario
- Parameters
-
scenario the scenario entry the entry number
Definition at line 530 of file reader_sto.c.
References StoScenario::colnames, and NULL.
Referenced by addScenarioVarsAndConsToProb().
◆ getScenarioEntryValue()
|
static |
returns an entry value for a scenario
- Parameters
-
scenario the scenario entry the entry number
Definition at line 543 of file reader_sto.c.
References NULL, and StoScenario::values.
Referenced by addScenarioVarsAndConsToProb().
◆ copyScenario()
|
static |
copies a scenario. In the case of blocks, the scenarios must be combined
- Parameters
-
scip the SCIP data structure sourcescenario the source scenario targetscenario the target scenario copyname should the name be copied?
Definition at line 558 of file reader_sto.c.
References addScenarioEntry(), StoScenario::colnames, getScenarioProbability(), StoScenario::name, StoScenario::nentries, NULL, StoScenario::rownames, StoScenario::scenarionum, SCIP_CALL, SCIP_OKAY, SCIP_Real, setScenarioName(), setScenarioNum(), setScenarioProbability(), setScenarioStageName(), setScenarioStageNum(), StoScenario::stagename, StoScenario::stagenum, and StoScenario::values.
Referenced by buildScenariosFromBlocks(), and scenarioAddChild().
◆ mergeScenarios()
|
static |
merge scenarios. In the case of blocks, the scenarios must be combined
- Parameters
-
scip the SCIP data structure scenario1 the first scenario mergedscenario the merged scenario
Definition at line 597 of file reader_sto.c.
References addScenarioEntry(), StoScenario::colnames, getScenarioProbability(), StoScenario::nentries, NULL, StoScenario::rownames, SCIP_CALL, SCIP_OKAY, SCIP_Real, setScenarioProbability(), and StoScenario::values.
Referenced by buildScenariosFromBlocks().
◆ scenarioAddChild()
|
static |
adds a child to a given scenario
- Parameters
-
scip the SCIP data structure parent the parent scenario child the child scenario
Definition at line 624 of file reader_sto.c.
References StoScenario::children, copyScenario(), createScenarioData(), StoScenario::nchildren, NULL, StoScenario::parent, SCIP_CALL, SCIP_OKAY, SCIPensureBlockMemoryArray, and TRUE.
Referenced by buildScenarioTree(), and insertScenarioInReaderdata().
◆ buildScenarioTree()
|
static |
recursively adds the scenarios to the reader data
- Parameters
-
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 652 of file reader_sto.c.
References getScenarioChild(), getScenarioNChildren(), getScenarioStageName(), NULL, scenarioAddChild(), SCIP_CALL, SCIP_OKAY, and SCIPtimGetStageName().
Referenced by addScenariosToReaderdata().
◆ addScenariosToReaderdata()
|
static |
- Parameters
-
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 698 of file reader_sto.c.
References buildScenarioTree(), FALSE, NULL, SCIP_CALL, SCIP_OKAY, and SCIPtimGetNStages().
Referenced by createScenariosFromBlocks().
◆ findScenarioInTree()
|
static |
finds a scenario with a given name
- Parameters
-
scenariotree the scenario tree to search scenname the name of the scenario to search
Definition at line 729 of file reader_sto.c.
References StoScenario::children, getScenarioName(), getScenarioNChildren(), and NULL.
Referenced by insertScenarioInReaderdata().
◆ insertScenarioInReaderdata()
|
static |
inserts a scenario into the reader data scenario tree
- Parameters
-
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 756 of file reader_sto.c.
References findScenarioInTree(), NULL, scenarioAddChild(), SCIP_CALL, and SCIP_OKAY.
Referenced by readScenarios().
◆ buildScenariosFromBlocks()
|
static |
- Parameters
-
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 783 of file reader_sto.c.
References copyScenario(), createScenarioData(), FALSE, getScenarioStageName(), mergeScenarios(), NULL, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPcalcMemGrowSize(), SCIPreallocBlockMemoryArray, SCIPsnprintf(), setScenarioName(), setScenarioNum(), setScenarioStageName(), setScenarioStageNum(), and TRUE.
Referenced by createScenariosFromBlocks().
◆ createScenariosFromBlocks()
|
static |
- Parameters
-
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 880 of file reader_sto.c.
References addScenariosToReaderdata(), buildScenariosFromBlocks(), freeScenarioTree(), getScenarioStageName(), NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPallocBlockMemoryArray, SCIPallocBufferArray, SCIPfreeBlockMemoryArray, SCIPfreeBufferArray, SCIPsnprintf(), setScenarioNum(), setScenarioStageNum(), and STO_DEFAULT_BLOCKARRAYSIZE.
Referenced by readBlocks(), and readIndep().
◆ createReaderdata()
|
static |
creates the reader data
- Parameters
-
scip SCIP data structure readerdata the reader data
Definition at line 956 of file reader_sto.c.
References createScenarioData(), NULL, SCIP_CALL, SCIP_OKAY, SCIPtimGetStageName(), setScenarioName(), and setScenarioStageName().
Referenced by readSto().
◆ freeReaderdata()
|
static |
frees the reader data
- Parameters
-
scip the SCIP data structure readerdata the reader data
Definition at line 976 of file reader_sto.c.
References freeScenarioTree(), NULL, SCIP_CALL, SCIP_OKAY, and SCIPfreeBlockMemory.
Referenced by SCIP_DECL_READERFREE().
◆ stoinputCreate()
|
static |
creates the sto input structure
- Parameters
-
scip SCIP data structure stoi sto input structure fp file object for the input file
Definition at line 995 of file reader_sto.c.
References FALSE, StoInput::fp, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, STO_STOCH, and STO_STOCHINFO_NONE.
Referenced by readSto().
◆ stoinputFree()
free the sto input structure
- Parameters
-
scip SCIP data structure stoi sto input structure
Definition at line 1026 of file reader_sto.c.
References SCIPfreeBlockMemory.
Referenced by readSto().
◆ stoinputSection()
|
static |
returns the current section
- Parameters
-
stoi sto input structure
Definition at line 1036 of file reader_sto.c.
References NULL, and StoInput::section.
Referenced by readSto().
◆ stoinputStochInfoType()
|
static |
returns the stochastic information type
- Parameters
-
stoi sto input structure
Definition at line 1047 of file reader_sto.c.
References NULL, and StoInput::stochinfotype.
Referenced by readSto().
◆ stoinputField0()
|
static |
return the current value of field 0
- Parameters
-
stoi sto input structure
Definition at line 1058 of file reader_sto.c.
References StoInput::f0, and NULL.
Referenced by readBlocks(), readIndep(), readScenarios(), and readStoch().
◆ stoinputField1()
|
static |
return the current value of field 1
- Parameters
-
stoi sto input structure
Definition at line 1069 of file reader_sto.c.
References StoInput::f1, and NULL.
Referenced by readBlocks(), readIndep(), readScenarios(), and readStoch().
◆ stoinputField2()
|
static |
return the current value of field 2
- Parameters
-
stoi sto input structure
Definition at line 1080 of file reader_sto.c.
References StoInput::f2, and NULL.
Referenced by readBlocks(), readIndep(), and readScenarios().
◆ stoinputField3()
|
static |
return the current value of field 3
- Parameters
-
stoi sto input structure
Definition at line 1091 of file reader_sto.c.
References StoInput::f3, and NULL.
Referenced by readBlocks(), readIndep(), and readScenarios().
◆ stoinputField4()
|
static |
return the current value of field 4
- Parameters
-
stoi sto input structure
Definition at line 1102 of file reader_sto.c.
References StoInput::f4, and NULL.
Referenced by readBlocks(), readIndep(), and readScenarios().
◆ stoinputField5()
|
static |
return the current value of field 5
- Parameters
-
stoi sto input structure
Definition at line 1113 of file reader_sto.c.
References StoInput::f5, and NULL.
Referenced by readIndep(), and readScenarios().
◆ stoinputHasError()
returns if an error was detected
- Parameters
-
stoi sto input structure
Definition at line 1124 of file reader_sto.c.
References StoInput::haserror, and NULL.
Referenced by readSto().
◆ stoinputSetSection()
|
static |
set the section in the sto input structure to given section
- Parameters
-
stoi sto input structure section section that is set
Definition at line 1135 of file reader_sto.c.
References NULL, and StoInput::section.
Referenced by readBlocks(), readIndep(), readScenarios(), and readStoch().
◆ stoinputSetStochInfoType()
|
static |
set the stochastic info type in the sto input structure
- Parameters
-
stoi sto input structure stochinfotype the stochastic infomation type
Definition at line 1147 of file reader_sto.c.
References NULL, and StoInput::stochinfotype.
Referenced by readStoch().
◆ stoinputSetProbname()
|
static |
set the problem name in the sto input structure to given problem name
- Parameters
-
stoi sto input structure probname name of the problem to set
Definition at line 1159 of file reader_sto.c.
References NULL, StoInput::probname, SCIPmemccpy(), and STO_MAX_NAMELEN.
Referenced by readStoch().
◆ stoinputSetStochtype()
|
static |
set the type name in the sto input structure to given objective name
- Parameters
-
stoi sto input structure stochtype name of the scenario type
Definition at line 1173 of file reader_sto.c.
References NULL, SCIPmemccpy(), STO_MAX_NAMELEN, and StoInput::stochtype.
Referenced by readBlocks(), readIndep(), and readScenarios().
◆ stoinputSyntaxerror()
|
static |
- Parameters
-
stoi sto input structure
Definition at line 1186 of file reader_sto.c.
References StoInput::haserror, StoInput::lineno, NULL, SCIPerrorMessage, StoInput::section, STO_ENDATA, and TRUE.
Referenced by readBlocks(), readIndep(), readScenarios(), readSto(), and readStoch().
◆ clearFrom()
|
static |
fill the line from pos
up to column 80 with blanks.
- Parameters
-
buf buffer to clear pos position to start the clearing process
Definition at line 1199 of file reader_sto.c.
References BLANK.
Referenced by stoinputReadLine().
◆ stoinputReadLine()
read a sto format data line and parse the fields.
- Parameters
-
stoi sto input structure
Definition at line 1213 of file reader_sto.c.
References BLANK, StoInput::buf, clearFrom(), StoInput::f0, StoInput::f1, StoInput::f2, StoInput::f3, StoInput::f4, StoInput::f5, FALSE, StoInput::fp, StoInput::lineno, NULL, SCIP_Bool, SCIPdebugMessage, SCIPfgets(), SCIPstrtok(), STO_MAX_LINELEN, and TRUE.
Referenced by readBlocks(), readIndep(), readScenarios(), and readStoch().
◆ readStoch()
|
static |
Process STOCH section.
- Parameters
-
scip SCIP data structure stoi sto input structure
Definition at line 1316 of file reader_sto.c.
References 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().
◆ readBlocks()
|
static |
Process BLOCKS section.
- Parameters
-
stoi sto input structure scip SCIP data structure readerdata the reader data
Definition at line 1377 of file reader_sto.c.
References addScenarioEntry(), createScenarioData(), createScenariosFromBlocks(), FALSE, freeScenarioTree(), getScenarioName(), 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().
◆ readScenarios()
|
static |
Process SCENARIOS section.
- Parameters
-
stoi sto input structure scip SCIP data structure readerdata the reader data
Definition at line 1541 of file reader_sto.c.
References addScenarioEntry(), createScenarioData(), FALSE, freeScenarioTree(), insertScenarioInReaderdata(), NULL, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPdebugMsg, SCIPerrorMessage, SCIPsnprintf(), SCIPtimFindStage(), setScenarioName(), setScenarioNum(), setScenarioProbability(), setScenarioStageName(), setScenarioStageNum(), STO_ENDATA, STO_SCENARIOS, stoinputField0(), stoinputField1(), stoinputField2(), stoinputField3(), stoinputField4(), stoinputField5(), stoinputReadLine(), stoinputSetSection(), stoinputSetStochtype(), stoinputSyntaxerror(), and TRUE.
Referenced by readSto().
◆ readIndep()
|
static |
Process INDEP section.
- Parameters
-
stoi sto input structure scip SCIP data structure readerdata the reader data
Definition at line 1669 of file reader_sto.c.
References addScenarioEntry(), createScenarioData(), createScenariosFromBlocks(), FALSE, freeScenarioTree(), getScenarioName(), 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().
◆ computeScenarioProbability()
|
static |
computes the probability of a scenario
- Parameters
-
scip the SCIP data structure scenario the current scenario
Definition at line 1838 of file reader_sto.c.
References getScenarioParent(), getScenarioProbability(), NULL, and SCIP_Real.
Referenced by addScenarioVarsAndConsToProb(), and addScenarioVarsToProb().
◆ getScenarioEntityName()
|
static |
gets the variable name
- Parameters
-
name the name to be returned varname the root of the variable name stagenum the stage number scenarionum the scenario number
Definition at line 1863 of file reader_sto.c.
References SCIP_MAXSTRLEN, and SCIPsnprintf().
Referenced by addScenarioConsToProb(), addScenarioVarsAndConsToProb(), addScenarioVarsToProb(), findScenarioVar(), and getScenarioDecompVar().
◆ addScenarioVarsToProb()
|
static |
add variables to the scenario
- Parameters
-
scip the SCIP data structure scenario the current scenario vars the variables of the core problem associated with this scenario nvars the number of variables for this scenario
Definition at line 1879 of file reader_sto.c.
References computeScenarioProbability(), getScenarioEntityName(), getScenarioNum(), getScenarioStageNum(), NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPaddVar(), SCIPcreateVar(), SCIPdebugMessage, SCIPreleaseVar(), SCIPvarGetLbOriginal(), SCIPvarGetName(), SCIPvarGetObj(), SCIPvarGetType(), SCIPvarGetUbOriginal(), SCIPvarIsDeleted(), SCIPvarIsInitial(), and SCIPvarIsRemovable().
Referenced by addScenarioVarsAndConsToProb().
◆ findScenarioVar()
|
static |
finds the scenario variable to add to a constraint
- Parameters
-
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 1937 of file reader_sto.c.
References getScenarioEntityName(), getScenarioNum(), getScenarioParent(), getScenarioStageNum(), NULL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPfindVar(), SCIPsnprintf(), and SCIPvarGetName().
Referenced by addScenarioConsToProb().
◆ getScenarioDecompVar()
|
static |
create variable for the decomposed scenario
- Parameters
-
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 1980 of file reader_sto.c.
References FALSE, getScenarioEntityName(), getScenarioNum(), getScenarioParent(), getScenarioScip(), getScenarioStageNum(), NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPaddVar(), SCIPcreateVar(), SCIPfindVar(), SCIPsnprintf(), SCIPvarGetLbOriginal(), SCIPvarGetName(), SCIPvarGetType(), SCIPvarGetUbOriginal(), SCIPvarIsInitial(), SCIPvarIsRemovable(), and TRUE.
Referenced by addScenarioConsToProb().
◆ addScenarioConsToProb()
|
static |
adds the constraint to the scenario problem
- Parameters
-
scip the SCIP data structure scenario the current scenario 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 2046 of file reader_sto.c.
References FALSE, findScenarioVar(), getScenarioDecompVar(), getScenarioEntityName(), getScenarioNum(), getScenarioStageNum(), NULL, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddCoefLinear(), SCIPaddCons(), SCIPconsGetName(), SCIPconsIsChecked(), SCIPconsIsDeleted(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsMarkedPropagate(), SCIPconsIsModifiable(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsLinear(), SCIPgetLhsLinear(), SCIPgetNVarsLinear(), SCIPgetRhsLinear(), SCIPgetValsLinear(), SCIPgetVarsLinear(), SCIPreleaseCons(), and SCIPreleaseVar().
Referenced by addScenarioVarsAndConsToProb().
◆ addScenarioVarsAndConsToProb()
|
static |
add variables and constraint to problem
- Parameters
-
scip the SCIP data structure of master problem scenario the current scenario decomp is the problem being decomposed
Definition at line 2116 of file reader_sto.c.
References addScenarioConsToProb(), addScenarioSubproblem(), addScenarioVarsToProb(), computeScenarioProbability(), createScenarioSubproblemArray(), getScenarioChild(), getScenarioEntityName(), getScenarioEntryCol(), getScenarioEntryRow(), getScenarioEntryValue(), getScenarioNChildren(), getScenarioNEntries(), getScenarioNum(), getScenarioScip(), getScenarioStageName(), getScenarioStageNum(), getScenarioSubproblemArray(), NULL, RHS, RIGHT, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPchgCoefLinear(), SCIPchgLhsLinear(), SCIPchgRhsLinear(), SCIPchgVarObj(), SCIPcreate(), SCIPcreateBendersDefault(), SCIPcreateProbBasic(), SCIPdebugMessage, SCIPenableDebugSol(), SCIPfindCons(), SCIPfindVar(), SCIPgetLhsLinear(), SCIPgetProbName(), SCIPgetRhsLinear(), SCIPincludeDefaultPlugins(), SCIPinfinity(), SCIPisLT(), SCIPsetBoolParam(), SCIPsnprintf(), SCIPtimFindStage(), SCIPtimGetNStages(), SCIPtimGetStageConss(), SCIPtimGetStageNConss(), SCIPtimGetStageNVars(), SCIPtimGetStageVars(), setScenarioScip(), and TRUE.
Referenced by buildDecompProblem(), and buildFullProblem().
◆ removeCoreVariablesAndConstraints()
|
static |
removes the core variables and constriants for stage 2 and lower
- Parameters
-
scip the SCIP data structure
Definition at line 2266 of file reader_sto.c.
References NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconsIsDeleted(), SCIPdelCons(), SCIPdelVar(), SCIPtimGetNStages(), SCIPtimGetStageConss(), SCIPtimGetStageNConss(), SCIPtimGetStageNVars(), SCIPtimGetStageVars(), and SCIPvarIsDeleted().
Referenced by buildDecompProblem(), and buildFullProblem().
◆ buildFullProblem()
|
static |
- Parameters
-
scip the SCIP data structure readerdata the reader data
Definition at line 2316 of file reader_sto.c.
References addScenarioVarsAndConsToProb(), FALSE, getScenarioChild(), getScenarioNChildren(), NULL, removeCoreVariablesAndConstraints(), SCIP_CALL, and SCIP_OKAY.
Referenced by readSto().
◆ buildDecompProblem()
|
static |
builds the stochastic program using Benders' decomposition
- Parameters
-
scip the SCIP data structure readerdata the reader data
Definition at line 2340 of file reader_sto.c.
References addScenarioSubproblem(), addScenarioVarsAndConsToProb(), createScenarioSubproblemArray(), getScenarioChild(), getScenarioNChildren(), getScenarioScip(), getScenarioSubproblemArray(), NULL, removeCoreVariablesAndConstraints(), SCIP_CALL, SCIP_OKAY, SCIP_PARAMSETTING_OFF, SCIPcreateBendersDefault(), SCIPsetBoolParam(), SCIPsetIntParam(), SCIPsetPresolving(), setScenarioScip(), and TRUE.
Referenced by readSto().
◆ readSto()
|
static |
Read the stochastic information of an SMPS file instance in "STO File Format".
- Parameters
-
scip SCIP data structure filename name of the input file readerdata the reader data
Definition at line 2390 of file reader_sto.c.
References 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().
◆ SCIP_DECL_READERCOPY()
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 2489 of file reader_sto.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderSto(), and SCIPreaderGetName().
◆ SCIP_DECL_READERFREE()
|
static |
destructor of reader to free user data (called when SCIP is exiting)
Definition at line 2503 of file reader_sto.c.
References freeReaderdata(), NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPreaderGetData(), and SCIPreaderGetName().
◆ SCIP_DECL_READERREAD()
|
static |
problem reading method of reader
Definition at line 2518 of file reader_sto.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_DIDNOTRUN, SCIP_OKAY, SCIPcorHasRead(), SCIPfindReader(), SCIPreaderGetName(), SCIPreadSto(), SCIPtimHasRead(), and SCIPwarningMessage().