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/scip_mem.h"#include "scip/scip_message.h"#include "scip/scip_numerics.h"#include "scip/scip_prob.h"#include "scip/scip_reader.h"#include <string.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_READER *reader) |
| 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_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 47 of file reader_tim.c.
Definition at line 48 of file reader_tim.c.
| #define READER_EXTENSION "tim" |
Definition at line 49 of file reader_tim.c.
| #define TIM_MAX_LINELEN 1025 |
Definition at line 55 of file reader_tim.c.
Referenced by timinputReadLine().
| #define TIM_MAX_NAMELEN 256 |
Definition at line 56 of file reader_tim.c.
Referenced by timinputSetProbname().
| #define TIM_DEFAULT_STAGESIZE 10 |
Definition at line 57 of file reader_tim.c.
Referenced by timinputCreate().
| #define TIM_DEFAULT_ARRAYSIZE 100 |
Definition at line 58 of file reader_tim.c.
Referenced by createReaderdata().
| #define BLANK ' ' |
Definition at line 60 of file reader_tim.c.
Definition at line 73 of file reader_tim.c.
| typedef enum TimSection TIMSECTION |
Definition at line 93 of file reader_tim.c.
Definition at line 114 of file reader_tim.c.
| enum TimSection |
enum containing all tim sections
| Enumerator | |
|---|---|
| TIM_TIME | |
| TIM_PERIODS | |
| TIM_ENDATA | |
Definition at line 87 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 118 of file reader_tim.c.
References assert(), NULL, TimStage::nvars, SCIP_CALL, SCIP_OKAY, SCIPensureBlockMemoryArray, SCIPfindVar(), SCIPhashmapInsert(), SCIPwarningMessage(), var, TimStage::varnametovar, TimStage::vars, and TimStage::varssize.
Referenced by 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 150 of file reader_tim.c.
References assert(), TimStage::consnametocons, TimStage::conss, TimStage::conssize, TimStage::nconss, NULL, SCIP_CALL, SCIP_OKAY, SCIPensureBlockMemoryArray, SCIPfindCons(), SCIPhashmapInsert(), and SCIPwarningMessage().
Referenced by 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 182 of file reader_tim.c.
References addConstraintToStage(), addVariableToStage(), assert(), i, TimInput::nstages, NULL, SCIP_CALL, SCIP_OKAY, SCIPcorGetConsName(), SCIPcorGetNConsNames(), SCIPcorGetNVarNames(), SCIPcorGetVarName(), and SCIPreaderGetData().
Referenced by 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 235 of file reader_tim.c.
References assert(), 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.
Referenced by readTim().
|
static |
free the reader data
| scip | SCIP data structure |
| reader | the reader structure |
Definition at line 294 of file reader_tim.c.
References assert(), i, NULL, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, SCIPhashmapFree(), and SCIPreaderGetData().
Referenced by SCIP_DECL_READERFREE().
|
static |
creates the tim input structure
| scip | SCIP data structure |
| timi | tim input structure |
| fp | file object for the input file |
Definition at line 340 of file reader_tim.c.
References assert(), FALSE, TimInput::fp, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, TIM_DEFAULT_STAGESIZE, and TIM_TIME.
Referenced by readTim().
free the tim input structure
| scip | SCIP data structure |
| timi | tim input structure |
Definition at line 373 of file reader_tim.c.
References i, SCIPfreeBlockMemory, and SCIPfreeBlockMemoryArray.
Referenced by readTim().
|
static |
returns the current section
| timi | tim input structure |
Definition at line 396 of file reader_tim.c.
References assert(), NULL, and TimInput::section.
Referenced by readTim().
|
static |
return the current value of field 0
| timi | tim input structure |
Definition at line 407 of file reader_tim.c.
References assert(), TimInput::f0, and NULL.
Referenced by readPeriods(), and readTime().
|
static |
return the current value of field 1
| timi | tim input structure |
Definition at line 418 of file reader_tim.c.
References assert(), TimInput::f1, and NULL.
Referenced by readPeriods(), and readTime().
|
static |
return the current value of field 2
| timi | tim input structure |
Definition at line 429 of file reader_tim.c.
References assert(), TimInput::f2, and NULL.
Referenced by readPeriods().
|
static |
return the current value of field 3
| timi | tim input structure |
Definition at line 440 of file reader_tim.c.
References assert(), TimInput::f3, and NULL.
Referenced by readPeriods().
returns if an error was detected
| timi | tim input structure |
Definition at line 451 of file reader_tim.c.
References assert(), TimInput::haserror, NULL, and SCIP_Bool.
Referenced by readTim().
|
static |
set the section in the tim input structure to given section
| timi | tim input structure |
| section | section that is set |
Definition at line 462 of file reader_tim.c.
References assert(), NULL, and TimInput::section.
Referenced by readPeriods(), and readTime().
|
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 474 of file reader_tim.c.
References assert(), NULL, TimInput::probname, SCIPmemccpy(), and TIM_MAX_NAMELEN.
Referenced by readTime().
|
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 488 of file reader_tim.c.
References assert(), NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, and TimInput::stagestartvars.
Referenced by readPeriods().
|
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 505 of file reader_tim.c.
References assert(), NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, and TimInput::stagestartcons.
Referenced by readPeriods().
|
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 522 of file reader_tim.c.
References assert(), NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, and TimInput::stagenames.
Referenced by readPeriods().
|
static |
| timi | tim input structure |
Definition at line 538 of file reader_tim.c.
References assert(), TimInput::haserror, TimInput::lineno, NULL, SCIPerrorMessage, TimInput::section, TIM_ENDATA, and TRUE.
Referenced by readPeriods(), readTim(), and readTime().
|
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 551 of file reader_tim.c.
References BLANK, TimInput::buf, and i.
Referenced by timinputReadLine().
read a tim format data line and parse the fields.
| timi | tim input structure |
Definition at line 565 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, and TRUE.
Referenced by readPeriods(), and readTime().
|
static |
Process TIME section.
| scip | SCIP data structure |
| timi | tim input structure |
Definition at line 655 of file reader_tim.c.
References NULL, SCIP_OKAY, SCIPdebugMsg, TIM_PERIODS, timinputField0(), timinputField1(), timinputReadLine(), timinputSetProbname(), timinputSetSection(), and timinputSyntaxerror().
Referenced by readTim().
|
static |
Process PERIODS section.
| timi | tim input structure |
| scip | SCIP data structure |
Definition at line 693 of file reader_tim.c.
References TimInput::nstages, NULL, 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 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 737 of file reader_tim.c.
References assert(), createReaderdata(), TimInput::fp, NULL, readPeriods(), 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 SCIPreadTim().
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 795 of file reader_tim.c.
References assert(), NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderTim(), and SCIPreaderGetName().
|
static |
destructor of reader to free user data (called when SCIP is exiting)
Definition at line 809 of file reader_tim.c.
References freeReaderdata(), and SCIP_OKAY.
|
static |
reads the stage information for a stochastic programming instance in SMPS format
Definition at line 818 of file reader_tim.c.
References assert(), NULL, READER_NAME, result, SCIP_CALL, SCIP_DIDNOTRUN, SCIP_OKAY, SCIPcorHasRead(), SCIPfindReader(), SCIPreaderGetName(), SCIPreadTim(), and SCIPwarningMessage().
| SCIP_Bool SCIPtimHasRead | ( | SCIP_READER * | reader | ) |
| reader | the file reader itself |
Definition at line 920 of file reader_tim.c.
References assert(), NULL, READER_NAME, SCIP_Bool, SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by SCIP_DECL_READERREAD().
| int SCIPtimGetNStages | ( | SCIP * | scip | ) |
| scip | SCIP data structure |
Definition at line 937 of file reader_tim.c.
References assert(), NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenariosToReaderdata(), addScenarioVarsAndConsToProb(), readSto(), removeCoreVariablesAndConstraints(), and SCIP_DECL_READERREAD().
| const char * SCIPtimGetStageName | ( | SCIP * | scip, |
| int | stagenum ) |
| scip | SCIP data structure |
| stagenum | the number of the requested stage |
Definition at line 956 of file reader_tim.c.
References assert(), TimInput::nstages, NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by buildScenarioTree(), and createReaderdata().
| const char * SCIPtimConsGetStageName | ( | SCIP * | scip, |
| const char * | consname ) |
| scip | SCIP data structure |
| consname | the constraint to search for |
Definition at line 977 of file reader_tim.c.
References assert(), i, TimInput::nstages, NULL, READER_NAME, SCIPconsGetName(), SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by readIndep().
| int SCIPtimFindStage | ( | SCIP * | scip, |
| const char * | stage ) |
| scip | SCIP data structure |
| stage | the name of the requested stage |
Definition at line 1018 of file reader_tim.c.
References assert(), i, NULL, READER_NAME, SCIPABORT, SCIPerrorMessage, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenarioVarsAndConsToProb(), and readScenarios().
| scip | SCIP data structure |
| stagenum | the number of the requested stage |
Definition at line 1056 of file reader_tim.c.
References assert(), TimInput::nstages, NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenarioVarsAndConsToProb(), and removeCoreVariablesAndConstraints().
| scip | SCIP data structure |
| stagenum | the number of the requested stage |
Definition at line 1077 of file reader_tim.c.
References assert(), TimInput::nstages, NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenarioVarsAndConsToProb(), and removeCoreVariablesAndConstraints().
| int SCIPtimGetStageNVars | ( | SCIP * | scip, |
| int | stagenum ) |
| scip | SCIP data structure |
| stagenum | the number of the requested stage |
Definition at line 1098 of file reader_tim.c.
References assert(), TimInput::nstages, NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenarioVarsAndConsToProb(), and removeCoreVariablesAndConstraints().
| int SCIPtimGetStageNConss | ( | SCIP * | scip, |
| int | stagenum ) |
| scip | SCIP data structure |
| stagenum | the number of the requested stage |
Definition at line 1119 of file reader_tim.c.
References assert(), TimInput::nstages, NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenarioVarsAndConsToProb(), and removeCoreVariablesAndConstraints().