Detailed Description
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 ' ' |
Typedefs | |
typedef struct TimStage | TIMSTAGE |
typedef enum TimSection | TIMSECTION |
typedef struct TimInput | TIMINPUT |
Enumerations | |
enum | TimSection { TIM_TIME, TIM_PERIODS, TIM_ENDATA } |
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) |
Macro Definition Documentation
◆ READER_NAME
#define READER_NAME "timreader" |
Definition at line 37 of file reader_tim.c.
Referenced by SCIP_DECL_READERCOPY(), SCIP_DECL_READERREAD(), SCIPincludeReaderTim(), SCIPreadTim(), SCIPtimConsGetStageName(), SCIPtimFindStage(), SCIPtimGetNStages(), SCIPtimGetStageConss(), SCIPtimGetStageName(), SCIPtimGetStageNConss(), SCIPtimGetStageNVars(), SCIPtimGetStageVars(), and SCIPtimHasRead().
◆ READER_DESC
#define READER_DESC "file reader for the TIME file of a stochastic program in SMPS format" |
Definition at line 38 of file reader_tim.c.
Referenced by SCIPincludeReaderTim().
◆ READER_EXTENSION
#define READER_EXTENSION "tim" |
Definition at line 39 of file reader_tim.c.
Referenced by SCIPincludeReaderTim().
◆ TIM_MAX_LINELEN
#define TIM_MAX_LINELEN 1025 |
Definition at line 45 of file reader_tim.c.
Referenced by timinputReadLine().
◆ TIM_MAX_NAMELEN
#define TIM_MAX_NAMELEN 256 |
Definition at line 46 of file reader_tim.c.
Referenced by timinputSetProbname().
◆ TIM_DEFAULT_STAGESIZE
#define TIM_DEFAULT_STAGESIZE 10 |
Definition at line 47 of file reader_tim.c.
Referenced by timinputCreate().
◆ TIM_DEFAULT_ARRAYSIZE
#define TIM_DEFAULT_ARRAYSIZE 100 |
Definition at line 48 of file reader_tim.c.
Referenced by createReaderdata().
◆ BLANK
#define BLANK ' ' |
Definition at line 50 of file reader_tim.c.
Referenced by clearFrom(), and timinputReadLine().
Typedef Documentation
◆ TIMSTAGE
Definition at line 63 of file reader_tim.c.
◆ TIMSECTION
typedef enum TimSection TIMSECTION |
Definition at line 83 of file reader_tim.c.
◆ TIMINPUT
Definition at line 104 of file reader_tim.c.
Enumeration Type Documentation
◆ TimSection
enum TimSection |
enum containing all tim sections
Enumerator | |
---|---|
TIM_TIME | |
TIM_PERIODS | |
TIM_ENDATA |
Definition at line 77 of file reader_tim.c.
Function Documentation
◆ addVariableToStage()
|
static |
adds the variable to the given stage
- Parameters
-
scip SCIP data structure stage the stage structure varname the name of the variable to add to the stage
Definition at line 108 of file reader_tim.c.
References NULL, TimStage::nvars, SCIP_CALL, SCIP_OKAY, SCIPensureBlockMemoryArray, SCIPfindVar(), SCIPhashmapInsert(), SCIPwarningMessage(), TimStage::varnametovar, TimStage::vars, and TimStage::varssize.
Referenced by createStages().
◆ addConstraintToStage()
|
static |
adds the constraint to the given stage
- Parameters
-
scip SCIP data structure stage the stage structure consname the name of the constraint to add to the stage
Definition at line 140 of file reader_tim.c.
References TimStage::consnametocons, TimStage::conss, TimStage::conssize, TimStage::nconss, NULL, SCIP_CALL, SCIP_OKAY, SCIPensureBlockMemoryArray, SCIPfindCons(), SCIPhashmapInsert(), and SCIPwarningMessage().
Referenced by createStages().
◆ createStages()
|
static |
creates the stage data
- Parameters
-
scip SCIP data structure reader the reader structure correader the reader structure for the core file
Definition at line 172 of file reader_tim.c.
References addConstraintToStage(), addVariableToStage(), TimInput::nstages, NULL, SCIP_CALL, SCIP_OKAY, SCIPcorGetConsName(), SCIPcorGetNConsNames(), SCIPcorGetNVarNames(), SCIPcorGetVarName(), and SCIPreaderGetData().
Referenced by SCIPreadTim().
◆ createReaderdata()
|
static |
creates the reader data for the time input data
- Parameters
-
scip SCIP data structure reader the reader structure timi tim input structure
Definition at line 225 of file reader_tim.c.
References TimInput::nstages, NULL, TimStage::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().
◆ freeReaderdata()
|
static |
free the reader data
- Parameters
-
scip SCIP data structure reader the reader structure
Definition at line 284 of file reader_tim.c.
References NULL, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, SCIPhashmapFree(), and SCIPreaderGetData().
Referenced by SCIP_DECL_READERFREE().
◆ timinputCreate()
|
static |
creates the tim input structure
- Parameters
-
scip SCIP data structure timi tim input structure fp file object for the input file
Definition at line 330 of file reader_tim.c.
References FALSE, TimInput::fp, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, TIM_DEFAULT_STAGESIZE, and TIM_TIME.
Referenced by readTim().
◆ timinputFree()
free the tim input structure
- Parameters
-
scip SCIP data structure timi tim input structure
Definition at line 363 of file reader_tim.c.
References SCIPfreeBlockMemory, and SCIPfreeBlockMemoryArray.
Referenced by readTim().
◆ timinputSection()
|
static |
returns the current section
- Parameters
-
timi tim input structure
Definition at line 386 of file reader_tim.c.
References NULL, and TimInput::section.
Referenced by readTim().
◆ timinputField0()
|
static |
return the current value of field 0
- Parameters
-
timi tim input structure
Definition at line 397 of file reader_tim.c.
References TimInput::f0, and NULL.
Referenced by readPeriods(), and readTime().
◆ timinputField1()
|
static |
return the current value of field 1
- Parameters
-
timi tim input structure
Definition at line 408 of file reader_tim.c.
References TimInput::f1, and NULL.
Referenced by readPeriods(), and readTime().
◆ timinputField2()
|
static |
return the current value of field 2
- Parameters
-
timi tim input structure
Definition at line 419 of file reader_tim.c.
References TimInput::f2, and NULL.
Referenced by readPeriods().
◆ timinputField3()
|
static |
return the current value of field 3
- Parameters
-
timi tim input structure
Definition at line 430 of file reader_tim.c.
References TimInput::f3, and NULL.
Referenced by readPeriods().
◆ timinputHasError()
returns if an error was detected
- Parameters
-
timi tim input structure
Definition at line 441 of file reader_tim.c.
References TimInput::haserror, and NULL.
Referenced by readTim().
◆ timinputSetSection()
|
static |
set the section in the tim input structure to given section
- Parameters
-
timi tim input structure section section that is set
Definition at line 452 of file reader_tim.c.
References NULL, and TimInput::section.
Referenced by readPeriods(), and readTime().
◆ timinputSetProbname()
|
static |
set the problem name in the tim input structure to given problem name
- Parameters
-
timi tim input structure probname name of the problem to set
Definition at line 464 of file reader_tim.c.
References NULL, TimInput::probname, SCIPmemccpy(), and TIM_MAX_NAMELEN.
Referenced by readTime().
◆ timinputSetStageStartVar()
|
static |
set the problem var name that starts a stage in the tim input structure to given objective name
- Parameters
-
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 478 of file reader_tim.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, and TimInput::stagestartvars.
Referenced by readPeriods().
◆ timinputSetStageStartCons()
|
static |
set the problem constraint name that starts a stage in the tim input structure to given objective name
- Parameters
-
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 495 of file reader_tim.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, and TimInput::stagestartcons.
Referenced by readPeriods().
◆ timinputSetStageName()
|
static |
set the stage name in the tim input structure to given objective name
- Parameters
-
timi tim input structure scip SCIP data structure stagename name of the stage stagenum the stage number the constraint starts
Definition at line 512 of file reader_tim.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, and TimInput::stagenames.
Referenced by readPeriods().
◆ timinputSyntaxerror()
|
static |
- Parameters
-
timi tim input structure
Definition at line 528 of file reader_tim.c.
References TimInput::haserror, TimInput::lineno, NULL, SCIPerrorMessage, TimInput::section, TIM_ENDATA, and TRUE.
Referenced by readPeriods(), readTim(), and readTime().
◆ 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 541 of file reader_tim.c.
References BLANK.
Referenced by timinputReadLine().
◆ timinputReadLine()
read a tim format data line and parse the fields.
- Parameters
-
timi tim input structure
Definition at line 555 of file reader_tim.c.
References BLANK, TimInput::buf, clearFrom(), TimInput::f0, TimInput::f1, TimInput::f2, TimInput::f3, FALSE, TimInput::fp, TimInput::lineno, NULL, SCIP_Bool, SCIPdebugMessage, SCIPfgets(), SCIPstrtok(), TIM_MAX_LINELEN, and TRUE.
Referenced by readPeriods(), and readTime().
◆ readTime()
|
static |
Process TIME section.
- Parameters
-
scip SCIP data structure timi tim input structure
Definition at line 645 of file reader_tim.c.
References NULL, SCIP_OKAY, SCIPdebugMsg, TIM_PERIODS, timinputField0(), timinputField1(), timinputReadLine(), timinputSetProbname(), timinputSetSection(), and timinputSyntaxerror().
Referenced by readTim().
◆ readPeriods()
|
static |
Process PERIODS section.
- Parameters
-
timi tim input structure scip SCIP data structure
Definition at line 682 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().
◆ readTim()
|
static |
Read time data for the SMPS file format.
- Parameters
-
scip SCIP data structure reader the file reader itself filename name of the input file
Definition at line 724 of file reader_tim.c.
References 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().
◆ SCIP_DECL_READERCOPY()
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 782 of file reader_tim.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderTim(), and SCIPreaderGetName().
◆ SCIP_DECL_READERFREE()
|
static |
destructor of reader to free user data (called when SCIP is exiting)
Definition at line 796 of file reader_tim.c.
References freeReaderdata(), and SCIP_OKAY.
◆ SCIP_DECL_READERREAD()
|
static |
reads the stage information for a stochastic programming instance in SMPS format
Definition at line 805 of file reader_tim.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_DIDNOTRUN, SCIP_OKAY, SCIPcorHasRead(), SCIPfindReader(), SCIPreaderGetName(), SCIPreadTim(), and SCIPwarningMessage().
◆ SCIPtimHasRead()
SCIP_Bool SCIPtimHasRead | ( | SCIP_READER * | reader | ) |
- Parameters
-
reader the file reader itself
Definition at line 907 of file reader_tim.c.
References NULL, READER_NAME, SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by SCIP_DECL_READERREAD().
◆ SCIPtimGetNStages()
int SCIPtimGetNStages | ( | SCIP * | scip | ) |
- Parameters
-
scip SCIP data structure
Definition at line 924 of file reader_tim.c.
References NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenariosToReaderdata(), addScenarioVarsAndConsToProb(), readSto(), removeCoreVariablesAndConstraints(), and SCIP_DECL_READERREAD().
◆ SCIPtimGetStageName()
const char* SCIPtimGetStageName | ( | SCIP * | scip, |
int | stagenum | ||
) |
- Parameters
-
scip SCIP data structure stagenum the number of the requested stage
Definition at line 943 of file reader_tim.c.
References TimInput::nstages, NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by buildScenarioTree(), and createReaderdata().
◆ SCIPtimConsGetStageName()
const char* SCIPtimConsGetStageName | ( | SCIP * | scip, |
const char * | consname | ||
) |
- Parameters
-
scip SCIP data structure consname the constraint to search for
Definition at line 964 of file reader_tim.c.
References TimInput::nstages, NULL, READER_NAME, SCIPconsGetName(), SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by readIndep().
◆ SCIPtimFindStage()
int SCIPtimFindStage | ( | SCIP * | scip, |
const char * | stage | ||
) |
- Parameters
-
scip SCIP data structure stage the name of the requested stage
Definition at line 1005 of file reader_tim.c.
References NULL, READER_NAME, SCIPABORT, SCIPerrorMessage, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenarioVarsAndConsToProb(), and readScenarios().
◆ SCIPtimGetStageVars()
- Parameters
-
scip SCIP data structure stagenum the number of the requested stage
Definition at line 1043 of file reader_tim.c.
References TimInput::nstages, NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenarioVarsAndConsToProb(), and removeCoreVariablesAndConstraints().
◆ SCIPtimGetStageConss()
- Parameters
-
scip SCIP data structure stagenum the number of the requested stage
Definition at line 1064 of file reader_tim.c.
References TimInput::nstages, NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenarioVarsAndConsToProb(), and removeCoreVariablesAndConstraints().
◆ SCIPtimGetStageNVars()
int SCIPtimGetStageNVars | ( | SCIP * | scip, |
int | stagenum | ||
) |
- Parameters
-
scip SCIP data structure stagenum the number of the requested stage
Definition at line 1085 of file reader_tim.c.
References TimInput::nstages, NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenarioVarsAndConsToProb(), and removeCoreVariablesAndConstraints().
◆ SCIPtimGetStageNConss()
int SCIPtimGetStageNConss | ( | SCIP * | scip, |
int | stagenum | ||
) |
- Parameters
-
scip SCIP data structure stagenum the number of the requested stage
Definition at line 1106 of file reader_tim.c.
References TimInput::nstages, NULL, READER_NAME, SCIPfindReader(), SCIPreaderGetData(), and SCIPreaderGetName().
Referenced by addScenarioVarsAndConsToProb(), and removeCoreVariablesAndConstraints().