TIM file reader - the stage information for a stochastic programming instance in SMPS format.
Definition in file reader_tim.c.
#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/reader_cor.h"#include "scip/reader_tim.h"#include "scip/reader_sto.h"#include "scip/scip_mem.h"#include "scip/scip_message.h"#include "scip/scip_numerics.h"#include "scip/scip_prob.h"#include "scip/scip_reader.h"Go to the source code of this file.
Data Structures | |
| struct | TimStage |
| struct | TimInput |
Macros | |
| #define | READER_NAME "timreader" |
| #define | READER_DESC "file reader for the TIME file of a stochastic program in SMPS format" |
| #define | READER_EXTENSION "tim" |
| #define | TIM_MAX_LINELEN 1025 |
| #define | TIM_MAX_NAMELEN 256 |
| #define | TIM_DEFAULT_STAGESIZE 10 |
| #define | TIM_DEFAULT_ARRAYSIZE 100 |
| #define | BLANK ' ' |
Functions | |
| static SCIP_RETCODE | addVariableToStage (SCIP *scip, TIMSTAGE *stage, const char *varname) |
| static SCIP_RETCODE | addConstraintToStage (SCIP *scip, TIMSTAGE *stage, const char *consname) |
| static SCIP_RETCODE | createStages (SCIP *scip, SCIP_READER *reader, SCIP_READER *correader) |
| static SCIP_RETCODE | createReaderdata (SCIP *scip, SCIP_READER *reader, TIMINPUT *timi) |
| static void | freeReaderdata (SCIP *scip, SCIP_READERDATA *readerdata) |
| static SCIP_RETCODE | timinputCreate (SCIP *scip, TIMINPUT **timi, SCIP_FILE *fp) |
| static void | timinputFree (SCIP *scip, TIMINPUT **timi) |
| static TIMSECTION | timinputSection (const TIMINPUT *timi) |
| static const char * | timinputField0 (const TIMINPUT *timi) |
| static const char * | timinputField1 (const TIMINPUT *timi) |
| static const char * | timinputField2 (const TIMINPUT *timi) |
| static const char * | timinputField3 (const TIMINPUT *timi) |
| static SCIP_Bool | timinputHasError (const TIMINPUT *timi) |
| static void | timinputSetSection (TIMINPUT *timi, TIMSECTION section) |
| static void | timinputSetProbname (TIMINPUT *timi, const char *probname) |
| static SCIP_RETCODE | timinputSetStageStartVar (TIMINPUT *timi, SCIP *scip, const char *varname, int stagenum) |
| static SCIP_RETCODE | timinputSetStageStartCons (TIMINPUT *timi, SCIP *scip, const char *consname, int stagenum) |
| static SCIP_RETCODE | timinputSetStageName (TIMINPUT *timi, SCIP *scip, const char *stagename, int stagenum) |
| static void | timinputSyntaxerror (TIMINPUT *timi) |
| static void | clearFrom (char *buf, unsigned int pos) |
| static SCIP_Bool | timinputReadLine (TIMINPUT *timi) |
| static SCIP_RETCODE | readTime (SCIP *scip, TIMINPUT *timi) |
| static SCIP_RETCODE | readPeriods (TIMINPUT *timi, SCIP *scip) |
| static SCIP_RETCODE | readTim (SCIP *scip, SCIP_READER *reader, const char *filename) |
| static | SCIP_DECL_READERCOPY (readerCopyTim) |
| static | SCIP_DECL_READERFREE (readerFreeTim) |
| static | SCIP_DECL_READERREAD (readerReadTim) |
| SCIP_RETCODE | SCIPincludeReaderTim (SCIP *scip) |
| SCIP_RETCODE | SCIPreadTim (SCIP *scip, const char *filename, SCIP_RESULT *result) |
| SCIP_RETCODE | SCIPfreeReaderdataTim (SCIP *scip) |
| SCIP_Bool | SCIPtimHasRead (SCIP_READER *reader) |
| int | SCIPtimGetNStages (SCIP *scip) |
| const char * | SCIPtimGetStageName (SCIP *scip, int stagenum) |
| const char * | SCIPtimConsGetStageName (SCIP *scip, const char *consname) |
| int | SCIPtimFindStage (SCIP *scip, const char *stage) |
| SCIP_VAR ** | SCIPtimGetStageVars (SCIP *scip, int stagenum) |
| SCIP_CONS ** | SCIPtimGetStageConss (SCIP *scip, int stagenum) |
| int | SCIPtimGetStageNVars (SCIP *scip, int stagenum) |
| int | SCIPtimGetStageNConss (SCIP *scip, int stagenum) |
| #define READER_NAME "timreader" |
Definition at line 48 of file reader_tim.c.
Definition at line 49 of file reader_tim.c.
| #define READER_EXTENSION "tim" |
Definition at line 50 of file reader_tim.c.
| #define TIM_MAX_LINELEN 1025 |
Definition at line 56 of file reader_tim.c.
Referenced by timinputReadLine().
| #define TIM_MAX_NAMELEN 256 |
Definition at line 57 of file reader_tim.c.
Referenced by timinputSetProbname().
| #define TIM_DEFAULT_STAGESIZE 10 |
Definition at line 58 of file reader_tim.c.
Referenced by timinputCreate().
| #define TIM_DEFAULT_ARRAYSIZE 100 |
Definition at line 59 of file reader_tim.c.
Referenced by createReaderdata().
| #define BLANK ' ' |
Definition at line 61 of file reader_tim.c.
Definition at line 74 of file reader_tim.c.
| typedef enum TimSection TIMSECTION |
Definition at line 94 of file reader_tim.c.
Definition at line 115 of file reader_tim.c.
| enum TimSection |
enum containing all tim sections
| Enumerator | |
|---|---|
| TIM_TIME | |
| TIM_PERIODS | |
| TIM_ENDATA | |
Definition at line 88 of file reader_tim.c.
|
static |
adds the variable to the given stage
| scip | SCIP data structure |
| stage | the stage structure |
| varname | the name of the variable to add to the stage |
Definition at line 119 of file reader_tim.c.
References addVariableToStage(), assert(), NULL, TimStage::nvars, SCIP_CALL, SCIP_OKAY, SCIPensureBlockMemoryArray, SCIPfindVar(), SCIPhashmapInsert(), SCIPwarningMessage(), var, TimStage::varnametovar, TimStage::vars, and TimStage::varssize.
Referenced by addVariableToStage(), and createStages().
|
static |
adds the constraint to the given stage
| scip | SCIP data structure |
| stage | the stage structure |
| consname | the name of the constraint to add to the stage |
Definition at line 151 of file reader_tim.c.
References addConstraintToStage(), assert(), TimStage::consnametocons, TimStage::conss, TimStage::conssize, TimStage::nconss, NULL, SCIP_CALL, SCIP_OKAY, SCIPensureBlockMemoryArray, SCIPfindCons(), SCIPhashmapInsert(), and SCIPwarningMessage().
Referenced by addConstraintToStage(), and createStages().
|
static |
creates the stage data
| scip | SCIP data structure |
| reader | the reader structure |
| correader | the reader structure for the core file |
Definition at line 183 of file reader_tim.c.
References addConstraintToStage(), addVariableToStage(), assert(), createStages(), i, TimInput::nstages, NULL, SCIP_CALL, SCIP_OKAY, SCIPcorGetConsName(), SCIPcorGetNConsNames(), SCIPcorGetNVarNames(), SCIPcorGetVarName(), and SCIPreaderGetData().
Referenced by createStages(), and SCIPreadTim().
|
static |
creates the reader data for the time input data
| scip | SCIP data structure |
| reader | the reader structure |
| timi | tim input structure |
Definition at line 236 of file reader_tim.c.
References assert(), createReaderdata(), i, TimInput::nstages, NULL, nvars, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, SCIPblkmem(), SCIPceil(), SCIPduplicateBlockMemoryArray, SCIPgetNVars(), SCIPhashmapCreate(), SCIPreaderGetData(), TimInput::stagenames, TimInput::stagestartcons, TimInput::stagestartvars, TIM_DEFAULT_ARRAYSIZE, and TRUE.
|
static |
free the reader data
| scip | SCIP data structure |
| readerdata | the reader data structure |
Definition at line 295 of file reader_tim.c.
References assert(), FALSE, freeReaderdata(), i, NULL, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, and SCIPhashmapFree().
|
static |
creates the tim input structure
| scip | SCIP data structure |
| timi | tim input structure |
| fp | file object for the input file |
Definition at line 336 of file reader_tim.c.
References assert(), FALSE, TimInput::fp, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, TIM_DEFAULT_STAGESIZE, TIM_TIME, and timinputCreate().
Referenced by readTim(), and timinputCreate().
free the tim input structure
| scip | SCIP data structure |
| timi | tim input structure |
Definition at line 369 of file reader_tim.c.
References i, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, and timinputFree().
Referenced by readTim(), and timinputFree().
|
static |
returns the current section
| timi | tim input structure |
Definition at line 392 of file reader_tim.c.
References assert(), NULL, TimInput::section, and timinputSection().
Referenced by readTim(), and timinputSection().
|
static |
return the current value of field 0
| timi | tim input structure |
Definition at line 403 of file reader_tim.c.
References assert(), TimInput::f0, NULL, and timinputField0().
Referenced by readPeriods(), readTime(), and timinputField0().
|
static |
return the current value of field 1
| timi | tim input structure |
Definition at line 414 of file reader_tim.c.
References assert(), TimInput::f1, NULL, and timinputField1().
Referenced by readPeriods(), readTime(), and timinputField1().
|
static |
return the current value of field 2
| timi | tim input structure |
Definition at line 425 of file reader_tim.c.
References assert(), TimInput::f2, NULL, and timinputField2().
Referenced by readPeriods(), and timinputField2().
|
static |
return the current value of field 3
| timi | tim input structure |
Definition at line 436 of file reader_tim.c.
References assert(), TimInput::f3, NULL, and timinputField3().
Referenced by readPeriods(), and timinputField3().
returns if an error was detected
| timi | tim input structure |
Definition at line 447 of file reader_tim.c.
References assert(), TimInput::haserror, NULL, SCIP_Bool, and timinputHasError().
Referenced by readTim(), and timinputHasError().
|
static |
set the section in the tim input structure to given section
| timi | tim input structure |
| section | section that is set |
Definition at line 458 of file reader_tim.c.
References assert(), NULL, TimInput::section, and timinputSetSection().
Referenced by readPeriods(), readTime(), and timinputSetSection().
|
static |
set the problem name in the tim input structure to given problem name
| timi | tim input structure |
| probname | name of the problem to set |
Definition at line 470 of file reader_tim.c.
References assert(), NULL, TimInput::probname, SCIPmemccpy(), TIM_MAX_NAMELEN, and timinputSetProbname().
Referenced by readTime(), and timinputSetProbname().
|
static |
set the problem var name that starts a stage in the tim input structure to given objective name
| timi | tim input structure |
| scip | SCIP data structure |
| varname | name of the variable that starts the stage |
| stagenum | the stage number the variable starts |
Definition at line 484 of file reader_tim.c.
References assert(), NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, TimInput::stagestartvars, and timinputSetStageStartVar().
Referenced by readPeriods(), and timinputSetStageStartVar().
|
static |
set the problem constraint name that starts a stage in the tim input structure to given objective name
| timi | tim input structure |
| scip | SCIP data structure |
| consname | name of the constraint that starts the stage |
| stagenum | the stage number the constraint starts |
Definition at line 501 of file reader_tim.c.
References assert(), NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, TimInput::stagestartcons, and timinputSetStageStartCons().
Referenced by readPeriods(), and timinputSetStageStartCons().
|
static |
set the stage name in the tim input structure to given objective name
| timi | tim input structure |
| scip | SCIP data structure |
| stagename | name of the stage |
| stagenum | the stage number the constraint starts |
Definition at line 518 of file reader_tim.c.
References assert(), NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, TimInput::stagenames, and timinputSetStageName().
Referenced by readPeriods(), and timinputSetStageName().
|
static |
| timi | tim input structure |
Definition at line 534 of file reader_tim.c.
References assert(), TimInput::haserror, TimInput::lineno, NULL, SCIPerrorMessage, TimInput::section, TIM_ENDATA, timinputSyntaxerror(), and TRUE.
Referenced by readPeriods(), readTim(), readTime(), and timinputSyntaxerror().
|
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 547 of file reader_tim.c.
References BLANK, TimInput::buf, clearFrom(), and i.
read a tim format data line and parse the fields.
| timi | tim input structure |
Definition at line 561 of file reader_tim.c.
References assert(), BLANK, TimInput::buf, clearFrom(), TimInput::f0, TimInput::f1, TimInput::f2, TimInput::f3, FALSE, TimInput::fp, i, TimInput::lineno, NULL, SCIP_Bool, SCIPdebugMessage, SCIPfgets(), SCIPstrtok(), TIM_MAX_LINELEN, timinputReadLine(), and TRUE.
Referenced by readPeriods(), readTime(), and timinputReadLine().
|
static |
Process TIME section.
| scip | SCIP data structure |
| timi | tim input structure |
Definition at line 651 of file reader_tim.c.
References NULL, readTime(), SCIP_OKAY, SCIPdebugMsg, TIM_PERIODS, timinputField0(), timinputField1(), timinputReadLine(), timinputSetProbname(), timinputSetSection(), and timinputSyntaxerror().
Referenced by readTim(), and readTime().
|
static |
Process PERIODS section.
| timi | tim input structure |
| scip | SCIP data structure |
Definition at line 689 of file reader_tim.c.
References TimInput::nstages, NULL, readPeriods(), SCIP_CALL, SCIP_OKAY, SCIPdebugMsg, SCIPensureBlockMemoryArray, TimInput::stagenames, TimInput::stagesize, TimInput::stagestartcons, TimInput::stagestartvars, TIM_ENDATA, TIM_PERIODS, timinputField0(), timinputField1(), timinputField2(), timinputField3(), timinputReadLine(), timinputSetSection(), timinputSetStageName(), timinputSetStageStartCons(), timinputSetStageStartVar(), and timinputSyntaxerror().
Referenced by readPeriods(), and readTim().
|
static |
Read time data for the SMPS file format.
| scip | SCIP data structure |
| reader | the file reader itself |
| filename | name of the input file |
Definition at line 733 of file reader_tim.c.
References assert(), createReaderdata(), TimInput::fp, NULL, readPeriods(), readTim(), readTime(), SCIP_Bool, SCIP_CALL_FINALLY, SCIP_CALL_TERMINATE, SCIP_NOFILE, SCIP_OKAY, SCIP_READERROR, SCIPerrorMessage, SCIPfclose(), SCIPfopen(), SCIPprintSysError(), TIM_ENDATA, TIM_PERIODS, timinputCreate(), timinputFree(), timinputHasError(), timinputSection(), timinputSyntaxerror(), and TRUE.
Referenced by readTim(), and SCIPreadTim().
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 791 of file reader_tim.c.
References assert(), NULL, READER_NAME, SCIP_CALL, SCIP_DECL_READERCOPY, SCIP_INVALIDCALL, SCIP_OKAY, SCIP_STRINGEQ, SCIPincludeReaderTim(), and SCIPreaderGetName().
|
static |
destructor of reader to free user data (called when SCIP is exiting)
Definition at line 806 of file reader_tim.c.
References assert(), freeReaderdata(), NULL, SCIP_DECL_READERFREE, SCIP_OKAY, SCIPfreeBlockMemory, and SCIPreaderGetData().
|
static |
reads the stage information for a stochastic programming instance in SMPS format
Definition at line 825 of file reader_tim.c.
References assert(), NULL, READER_NAME, result, SCIP_CALL, SCIP_DECL_READERREAD, SCIP_DIDNOTRUN, SCIP_INVALIDCALL, SCIP_OKAY, SCIP_STRINGEQ, SCIPcorHasRead(), SCIPfindReader(), SCIPfreeReaderdataSto(), SCIPfreeReaderdataTim(), SCIPreaderGetName(), SCIPreadTim(), and SCIPwarningMessage().
| SCIP_RETCODE SCIPfreeReaderdataTim | ( | SCIP * | scip | ) |
frees the reader data for the tim file
| scip | the SCIP data structure |
Definition at line 934 of file reader_tim.c.
References assert(), freeReaderdata(), NULL, READER_NAME, SCIP_OKAY, SCIPfindReader(), SCIPfreeReaderdataTim(), and SCIPreaderGetData().
Referenced by SCIP_DECL_READERREAD(), SCIPfreeReaderdataTim(), and SCIPreadCor().
| SCIP_Bool SCIPtimHasRead | ( | SCIP_READER * | reader | ) |
| reader | the file reader itself |
Definition at line 960 of file reader_tim.c.
References assert(), FALSE, NULL, READER_NAME, SCIP_Bool, SCIP_STRINGEQ, SCIPreaderGetData(), SCIPreaderGetName(), and SCIPtimHasRead().
Referenced by SCIP_DECL_READERREAD(), and SCIPtimHasRead().
| int SCIPtimGetNStages | ( | SCIP * | scip | ) |
| scip | SCIP data structure |
Definition at line 978 of file reader_tim.c.
References assert(), NULL, READER_NAME, SCIP_STRINGEQ, SCIPfindReader(), SCIPreaderGetData(), SCIPreaderGetName(), and SCIPtimGetNStages().
Referenced by addScenariosToReaderdata(), addScenarioVarsAndConsToProb(), readSto(), removeCoreVariablesAndConstraints(), SCIP_DECL_READERREAD(), and SCIPtimGetNStages().
| const char * SCIPtimGetStageName | ( | SCIP * | scip, |
| int | stagenum ) |
| scip | SCIP data structure |
| stagenum | the number of the requested stage |
Definition at line 998 of file reader_tim.c.
References assert(), TimInput::nstages, NULL, READER_NAME, SCIP_STRINGEQ, SCIPfindReader(), SCIPreaderGetData(), SCIPreaderGetName(), and SCIPtimGetStageName().
Referenced by buildScenarioTree(), createReaderdata(), and SCIPtimGetStageName().
| const char * SCIPtimConsGetStageName | ( | SCIP * | scip, |
| const char * | consname ) |
| scip | SCIP data structure |
| consname | the constraint to search for |
Definition at line 1020 of file reader_tim.c.
References assert(), i, TimInput::nstages, NULL, READER_NAME, SCIP_STRINGEQ, SCIPconsGetName(), SCIPfindReader(), SCIPreaderGetData(), SCIPreaderGetName(), and SCIPtimConsGetStageName().
Referenced by readIndep(), and SCIPtimConsGetStageName().
| int SCIPtimFindStage | ( | SCIP * | scip, |
| const char * | stage ) |
| scip | SCIP data structure |
| stage | the name of the requested stage |
Definition at line 1062 of file reader_tim.c.
References assert(), i, NULL, READER_NAME, SCIP_STRINGEQ, SCIPABORT, SCIPerrorMessage, SCIPfindReader(), SCIPreaderGetData(), SCIPreaderGetName(), and SCIPtimFindStage().
Referenced by addScenarioVarsAndConsToProb(), readScenarios(), and SCIPtimFindStage().
| scip | SCIP data structure |
| stagenum | the number of the requested stage |
Definition at line 1101 of file reader_tim.c.
References assert(), TimInput::nstages, NULL, READER_NAME, SCIP_STRINGEQ, SCIPfindReader(), SCIPreaderGetData(), SCIPreaderGetName(), and SCIPtimGetStageVars().
Referenced by addScenarioVarsAndConsToProb(), removeCoreVariablesAndConstraints(), and SCIPtimGetStageVars().
| scip | SCIP data structure |
| stagenum | the number of the requested stage |
Definition at line 1123 of file reader_tim.c.
References assert(), TimInput::nstages, NULL, READER_NAME, SCIP_STRINGEQ, SCIPfindReader(), SCIPreaderGetData(), SCIPreaderGetName(), and SCIPtimGetStageConss().
Referenced by addScenarioVarsAndConsToProb(), removeCoreVariablesAndConstraints(), and SCIPtimGetStageConss().
| int SCIPtimGetStageNVars | ( | SCIP * | scip, |
| int | stagenum ) |
| scip | SCIP data structure |
| stagenum | the number of the requested stage |
Definition at line 1145 of file reader_tim.c.
References assert(), TimInput::nstages, NULL, READER_NAME, SCIP_STRINGEQ, SCIPfindReader(), SCIPreaderGetData(), SCIPreaderGetName(), and SCIPtimGetStageNVars().
Referenced by addScenarioVarsAndConsToProb(), removeCoreVariablesAndConstraints(), and SCIPtimGetStageNVars().
| int SCIPtimGetStageNConss | ( | SCIP * | scip, |
| int | stagenum ) |
| scip | SCIP data structure |
| stagenum | the number of the requested stage |
Definition at line 1167 of file reader_tim.c.
References assert(), TimInput::nstages, NULL, READER_NAME, SCIP_STRINGEQ, SCIPfindReader(), SCIPreaderGetData(), SCIPreaderGetName(), and SCIPtimGetStageNConss().
Referenced by addScenarioVarsAndConsToProb(), removeCoreVariablesAndConstraints(), and SCIPtimGetStageNConss().