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"#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 ' ' |
| #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 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 151 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 183 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
Definition at line 236 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
Definition at line 295 of file reader_tim.c.
References assert(), FALSE, i, NULL, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, and SCIPhashmapFree().
Referenced by SCIP_DECL_READERFREE(), and SCIPfreeReaderdataTim().
|
static |
creates the tim input structure
Definition at line 336 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
Definition at line 369 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 392 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 403 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 414 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 425 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 436 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 447 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 458 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 470 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 484 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 501 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 518 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 534 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 547 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 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, and TRUE.
Referenced by readPeriods(), and readTime().
|
static |
Process TIME section.
Definition at line 651 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.
Definition at line 689 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.
Definition at line 733 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 791 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 805 of file reader_tim.c.
References assert(), freeReaderdata(), NULL, SCIP_OKAY, SCIPfreeBlockMemory, and SCIPreaderGetData().
|
static |
reads the stage information for a stochastic programming instance in SMPS format
Definition at line 824 of file reader_tim.c.
References assert(), NULL, READER_NAME, result, SCIP_CALL, SCIP_DIDNOTRUN, SCIP_OKAY, SCIPcorHasRead(), SCIPfindReader(), SCIPfreeReaderdataSto(), SCIPfreeReaderdataTim(), SCIPreaderGetName(), SCIPreadTim(), and SCIPwarningMessage().
| SCIP_RETCODE SCIPfreeReaderdataTim | ( | SCIP * | scip | ) |
frees the reader data for the tim file
Definition at line 932 of file reader_tim.c.
References assert(), freeReaderdata(), NULL, READER_NAME, SCIP_OKAY, SCIPfindReader(), and SCIPreaderGetData().
Referenced by SCIP_DECL_READERREAD(), and SCIPreadCor().
| SCIP_Bool SCIPtimHasRead | ( | SCIP_READER * | reader | ) |
| reader | the file reader itself |
Definition at line 958 of file reader_tim.c.
References assert(), NULL, READER_NAME, SCIP_Bool, SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by SCIP_DECL_READERREAD().
| int SCIPtimGetNStages | ( | SCIP * | scip | ) |
Definition at line 975 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 ) |
Definition at line 994 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 ) |
Definition at line 1015 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 ) |
Definition at line 1056 of file reader_tim.c.
References assert(), i, NULL, READER_NAME, SCIPABORT, SCIPerrorMessage, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenarioVarsAndConsToProb(), and readScenarios().
Definition at line 1094 of file reader_tim.c.
References assert(), TimInput::nstages, NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenarioVarsAndConsToProb(), and removeCoreVariablesAndConstraints().
Definition at line 1115 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 ) |
Definition at line 1136 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 ) |
Definition at line 1157 of file reader_tim.c.
References assert(), TimInput::nstages, NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenarioVarsAndConsToProb(), and removeCoreVariablesAndConstraints().