reader_tim.c
Go to the documentation of this file.
18 * @brief TIM file reader - the stage information for a stochastic programming instance in SMPS format
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
132 SCIP_CALL( SCIPensureBlockMemoryArray(scip, &stage->vars, &stage->varssize, stage->nvars + 1) );
164 SCIP_CALL( SCIPensureBlockMemoryArray(scip, &stage->conss, &stage->conssize, stage->nconss + 1) );
196 assert((stage == 0 && i == 0 && strcmp(SCIPcorGetVarName(correader, i), readerdata->stagestartvars[stage]) == 0)
204 SCIP_CALL( addVariableToStage(scip, readerdata->stages[stage], SCIPcorGetVarName(correader, i)) );
218 SCIP_CALL( addConstraintToStage(scip, readerdata->stages[stage], SCIPcorGetConsName(correader, i)) );
245 /* getting the total number of variables in the problem. The hash maps will be of size nvars/nstages. */
271 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &readerdata->stages[i]->vars, readerdata->stages[i]->varssize) ); /*lint !e866*/
272 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &readerdata->stages[i]->conss, readerdata->stages[i]->conssize) ); /*lint !e866*/
276 SCIP_CALL( SCIPhashmapCreate(&readerdata->stages[i]->varnametovar, SCIPblkmem(scip), hashmapsize) );
277 SCIP_CALL( SCIPhashmapCreate(&readerdata->stages[i]->consnametocons, SCIPblkmem(scip), hashmapsize) );
309 SCIPfreeBlockMemoryArray(scip, &readerdata->stagestartvars[i], strlen(readerdata->stagestartvars[i]) + 1);
310 SCIPfreeBlockMemoryArray(scip, &readerdata->stagestartcons[i], strlen(readerdata->stagestartcons[i]) + 1);
311 SCIPfreeBlockMemoryArray(scip, &readerdata->stagenames[i], strlen(readerdata->stagenames[i]) + 1);
373 SCIPfreeBlockMemoryArray(scip, &(*timi)->stagestartvars[i], strlen((*timi)->stagestartvars[i]) + 1);
374 SCIPfreeBlockMemoryArray(scip, &(*timi)->stagestartcons[i], strlen((*timi)->stagestartcons[i]) + 1);
477 /** set the problem var name that starts a stage in the tim input structure to given objective name */
489 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &timi->stagestartvars[stagenum], varname, strlen(varname) + 1) ); /*lint !e866*/
494 /** set the problem constraint name that starts a stage in the tim input structure to given objective name */
506 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &timi->stagestartcons[stagenum], consname, strlen(consname) + 1) ); /*lint !e866*/
523 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &timi->stagenames[stagenum], stagename, strlen(stagename) + 1) ); /*lint !e866*/
654 if( !timinputReadLine(timi) || timinputField0(timi) == NULL || strcmp(timinputField0(timi), "TIME") )
709 SCIP_CALL( SCIPensureBlockMemoryArray(scip, &timi->stagestartvars, &timi->stagesize, timi->nstages + 1) );
710 SCIP_CALL( SCIPensureBlockMemoryArray(scip, &timi->stagestartcons, &timi->stagesize, timi->nstages + 1) );
711 SCIP_CALL( SCIPensureBlockMemoryArray(scip, &timi->stagenames, &timi->stagesize, timi->nstages + 1) );
857 SCIP_CALL( SCIPincludeReaderBasic(scip, &reader, READER_NAME, READER_DESC, READER_EXTENSION, readerdata) );
871 const char* filename, /**< full path and name of file to read, or NULL if stdin should be used */
1040 SCIPerrorMessage("Stage <%s> was not found in the TIM file. Check the SMPS files (COR, TIM and STO)\n", stage);
Definition: reader_tim.c:80
Definition: type_result.h:33
SCIP_RETCODE SCIPreadTim(SCIP *scip, const char *filename, SCIP_RESULT *result)
Definition: reader_tim.c:869
int SCIPmemccpy(char *dest, const char *src, char stop, unsigned int cnt)
Definition: misc.c:10639
TIM file reader - the stage information for a stochastic programming instance in SMPS format...
Definition: struct_reader.h:36
Definition: struct_scip.h:59
public methods for memory management
Definition: type_result.h:49
const char * SCIPcorGetVarName(SCIP_READER *reader, int i)
Definition: reader_cor.c:256
COR file reader (MPS format of the core problem for stochastic programs)
Definition: struct_var.h:198
static SCIP_RETCODE timinputSetStageStartVar(TIMINPUT *timi, SCIP *scip, const char *varname, int stagenum)
Definition: reader_tim.c:479
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:3014
static void freeReaderdata(SCIP *scip, SCIP_READER *reader)
Definition: reader_tim.c:285
SCIP_READER * SCIPfindReader(SCIP *scip, const char *name)
Definition: scip_reader.c:226
const char * SCIPtimConsGetStageName(SCIP *scip, const char *consname)
Definition: reader_tim.c:969
Definition: graph_load.c:261
Definition: type_retcode.h:38
Definition: reader_tim.c:87
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:111
public methods for numerical tolerances
static void timinputSetProbname(TIMINPUT *timi, const char *probname)
Definition: reader_tim.c:465
const char * SCIPcorGetConsName(SCIP_READER *reader, int i)
Definition: reader_cor.c:274
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
Definition: scip_mem.h:96
Definition: struct_misc.h:128
public methods for managing constraints
Definition: type_retcode.h:36
Definition: struct_cons.h:37
Definition: reader_tim.c:53
Definition: type_retcode.h:33
#define SCIPensureBlockMemoryArray(scip, ptr, arraysizeptr, minsize)
Definition: scip_mem.h:98
wrapper functions to map file i/o to standard or zlib file i/o
public data structures and miscellaneous methods
static SCIP_RETCODE addConstraintToStage(SCIP *scip, TIMSTAGE *stage, const char *consname)
Definition: reader_tim.c:141
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
Definition: scip_reader.c:100
SCIP_CONS ** SCIPtimGetStageConss(SCIP *scip, int stagenum)
Definition: reader_tim.c:1069
static SCIP_RETCODE timinputCreate(SCIP *scip, TIMINPUT **timi, SCIP_FILE *fp)
Definition: reader_tim.c:331
Definition: reader_tim.c:81
static SCIP_RETCODE readTim(SCIP *scip, SCIP_READER *reader, const char *filename)
Definition: reader_tim.c:728
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERCOPY((*readercopy)))
Definition: scip_reader.c:138
static SCIP_RETCODE timinputSetStageName(TIMINPUT *timi, SCIP *scip, const char *stagename, int stagenum)
Definition: reader_tim.c:513
static SCIP_RETCODE addVariableToStage(SCIP *scip, TIMSTAGE *stage, const char *varname)
Definition: reader_tim.c:109
Definition: reader_tim.c:82
public methods for message output
static SCIP_RETCODE createReaderdata(SCIP *scip, SCIP_READER *reader, TIMINPUT *timi)
Definition: reader_tim.c:226
public methods for input file readers
public methods for message handling
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
Definition: scip_reader.c:186
Definition: type_retcode.h:45
static SCIP_RETCODE timinputSetStageStartCons(TIMINPUT *timi, SCIP *scip, const char *consname, int stagenum)
Definition: reader_tim.c:496
static void timinputSetSection(TIMINPUT *timi, TIMSECTION section)
Definition: reader_tim.c:453
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:3096
SCIPallocBlockMemory(scip, subsol))
SCIP_VAR ** SCIPtimGetStageVars(SCIP *scip, int stagenum)
Definition: reader_tim.c:1048
Definition: objbenders.h:33
int SCIPtimGetStageNConss(SCIP *scip, int stagenum)
Definition: reader_tim.c:1111
public methods for reader plugins
public methods for global and local (sub)problems
static SCIP_RETCODE createStages(SCIP *scip, SCIP_READER *reader, SCIP_READER *correader)
Definition: reader_tim.c:173
const char * SCIPtimGetStageName(SCIP *scip, int stagenum)
Definition: reader_tim.c:948
SCIP_RETCODE SCIPsetReaderFree(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERFREE((*readerfree)))
Definition: scip_reader.c:162