Scippy

    SCIP

    Solving Constraint Integer Programs

    reader_tim.c
    Go to the documentation of this file.
    1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    2/* */
    3/* This file is part of the program and library */
    4/* SCIP --- Solving Constraint Integer Programs */
    5/* */
    6/* Copyright (c) 2002-2025 Zuse Institute Berlin (ZIB) */
    7/* */
    8/* Licensed under the Apache License, Version 2.0 (the "License"); */
    9/* you may not use this file except in compliance with the License. */
    10/* You may obtain a copy of the License at */
    11/* */
    12/* http://www.apache.org/licenses/LICENSE-2.0 */
    13/* */
    14/* Unless required by applicable law or agreed to in writing, software */
    15/* distributed under the License is distributed on an "AS IS" BASIS, */
    16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
    17/* See the License for the specific language governing permissions and */
    18/* limitations under the License. */
    19/* */
    20/* You should have received a copy of the Apache-2.0 license */
    21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
    22/* */
    23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    24
    25/**@file reader_tim.c
    26 * @ingroup DEFPLUGINS_READER
    27 * @brief TIM file reader - the stage information for a stochastic programming instance in SMPS format
    28 * @author Stephen J. Maher
    29 */
    30
    31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    32
    33#include "scip/pub_cons.h"
    34#include "scip/pub_fileio.h"
    35#include "scip/pub_message.h"
    36#include "scip/pub_misc.h"
    37#include "scip/pub_reader.h"
    38#include "scip/reader_cor.h"
    39#include "scip/reader_tim.h"
    40#include "scip/reader_sto.h"
    41#include "scip/scip_mem.h"
    42#include "scip/scip_message.h"
    43#include "scip/scip_numerics.h"
    44#include "scip/scip_prob.h"
    45#include "scip/scip_reader.h"
    46#include <string.h>
    47
    48#define READER_NAME "timreader"
    49#define READER_DESC "file reader for the TIME file of a stochastic program in SMPS format"
    50#define READER_EXTENSION "tim"
    51
    52/*
    53 * tim reader internal methods
    54 */
    55
    56#define TIM_MAX_LINELEN 1025
    57#define TIM_MAX_NAMELEN 256
    58#define TIM_DEFAULT_STAGESIZE 10
    59#define TIM_DEFAULT_ARRAYSIZE 100
    60
    61#define BLANK ' '
    62
    64{
    69 int nvars;
    70 int nconss;
    73};
    74typedef struct TimStage TIMSTAGE;
    75
    76/** TIM reading data */
    77struct SCIP_ReaderData
    78{
    79 SCIP_Bool read; /**< flag to indicate whether the time file has been read */
    80 int nstages; /**< the number of stages in the stochastic program */
    81 const char** stagestartvars; /**< the variables that start each stage */
    82 const char** stagestartcons; /**< the constraints that start each stage */
    83 const char** stagenames; /**< the name of the stage */
    84 TIMSTAGE** stages; /**< the stages for the stochastic program */
    85};
    86
    87/** enum containing all tim sections */
    89{
    93};
    95
    96/** tim input structure */
    98{
    104 const char* f0;
    105 const char* f1;
    106 const char* f2;
    107 const char* f3;
    109 const char** stagestartvars;
    110 const char** stagestartcons;
    111 const char** stagenames;
    114};
    115typedef struct TimInput TIMINPUT;
    116
    117/** adds the variable to the given stage */
    118static
    120 SCIP* scip, /**< SCIP data structure */
    121 TIMSTAGE* stage, /**< the stage structure */
    122 const char* varname /**< the name of the variable to add to the stage */
    123 )
    124{
    125 SCIP_VAR* var;
    126
    127 assert(scip != NULL);
    128 assert(stage != NULL);
    129
    130 var = SCIPfindVar(scip, varname);
    131
    132 if( var == NULL )
    133 {
    134 SCIPwarningMessage(scip, "This is an error. All variables should in the problem.\n");
    135 return SCIP_OKAY;
    136 }
    137
    138 /* adding the variable to the hashmap */
    139 SCIP_CALL( SCIPhashmapInsert(stage->varnametovar, (void*) varname, var) );
    140
    141 /* adding the variable to the variable storage */
    142 SCIP_CALL( SCIPensureBlockMemoryArray(scip, &stage->vars, &stage->varssize, stage->nvars + 1) );
    143 stage->vars[stage->nvars] = var;
    144 stage->nvars++;
    145
    146 return SCIP_OKAY;
    147}
    148
    149/** adds the constraint to the given stage */
    150static
    152 SCIP* scip, /**< SCIP data structure */
    153 TIMSTAGE* stage, /**< the stage structure */
    154 const char* consname /**< the name of the constraint to add to the stage */
    155 )
    156{
    157 SCIP_CONS* cons;
    158
    159 assert(scip != NULL);
    160 assert(stage != NULL);
    161
    162 cons = SCIPfindCons(scip, consname);
    163
    164 if( cons == NULL )
    165 {
    166 SCIPwarningMessage(scip, "This is an error. All constraints should in the problem.\n");
    167 return SCIP_OKAY;
    168 }
    169
    170 /* adding the constraint to the hashmap */
    171 SCIP_CALL( SCIPhashmapInsert(stage->consnametocons, (void*) consname, cons) );
    172
    173 /* adding the constraint to the constraint storage */
    174 SCIP_CALL( SCIPensureBlockMemoryArray(scip, &stage->conss, &stage->conssize, stage->nconss + 1) );
    175 stage->conss[stage->nconss] = cons;
    176 stage->nconss++;
    177
    178 return SCIP_OKAY;
    179}
    180
    181/** creates the stage data */
    182static
    184 SCIP* scip, /**< SCIP data structure */
    185 SCIP_READER* reader, /**< the reader structure */
    186 SCIP_READER* correader /**< the reader structure for the core file */
    187 )
    188{
    189 SCIP_READERDATA* readerdata;
    190 int stage;
    191 int i;
    192
    193 assert(scip != NULL);
    194 assert(reader != NULL);
    195 assert(correader != NULL);
    196
    197 readerdata = SCIPreaderGetData(reader);
    198 assert(readerdata != NULL);
    199
    200 stage = 0;
    201
    202 /* assigning the variables to the stages */
    203 for( i = 0; i < SCIPcorGetNVarNames(correader); i++ )
    204 {
    205 /* the first variable in the var names list should be the start of the first stage */
    206 assert((stage == 0 && i == 0 && strcmp(SCIPcorGetVarName(correader, i), readerdata->stagestartvars[stage]) == 0)
    207 || i > 0);
    208 /* checking whether the next stage has been found */
    209 if( i > 0 && stage < readerdata->nstages - 1
    210 && strcmp(SCIPcorGetVarName(correader, i), readerdata->stagestartvars[stage + 1]) == 0 )
    211 stage++;
    212
    213 /* adding the variable to the stage */
    214 SCIP_CALL( addVariableToStage(scip, readerdata->stages[stage], SCIPcorGetVarName(correader, i)) );
    215 }
    216
    217 stage = 0;
    218
    219 /* assigning the constraint to the stages */
    220 for( i = 0; i < SCIPcorGetNConsNames(correader); i++ )
    221 {
    222 /* checking whether the next stage has been found */
    223 if( i > 0 && stage < readerdata->nstages - 1
    224 && strcmp(SCIPcorGetConsName(correader, i), readerdata->stagestartcons[stage + 1]) == 0 )
    225 stage++;
    226
    227 /* adding the consiable to the stage */
    228 SCIP_CALL( addConstraintToStage(scip, readerdata->stages[stage], SCIPcorGetConsName(correader, i)) );
    229 }
    230
    231 return SCIP_OKAY;
    232}
    233
    234/** creates the reader data for the time input data */
    235static
    237 SCIP* scip, /**< SCIP data structure */
    238 SCIP_READER* reader, /**< the reader structure */
    239 TIMINPUT* timi /**< tim input structure */
    240 )
    241{
    242 SCIP_READERDATA* readerdata;
    243 int hashmapsize;
    244 int nvars;
    245 int i;
    246
    247 assert(scip != NULL);
    248 assert(reader != NULL);
    249 assert(timi != NULL);
    250
    251 readerdata = SCIPreaderGetData(reader);
    252
    253 assert(readerdata != NULL);
    254
    255 /* getting the total number of variables in the problem. The hash maps will be of size nvars/nstages. */
    256 nvars = SCIPgetNVars(scip);
    257
    258 readerdata->read = TRUE;
    259 readerdata->nstages = timi->nstages;
    260
    261 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &readerdata->stagestartvars, readerdata->nstages) );
    262 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &readerdata->stagestartcons, readerdata->nstages) );
    263 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &readerdata->stagenames, readerdata->nstages) );
    264 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &readerdata->stages, readerdata->nstages) );
    265
    266 for( i = 0; i < readerdata->nstages; i++ )
    267 {
    268 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &readerdata->stagestartvars[i],
    269 timi->stagestartvars[i], strlen(timi->stagestartvars[i]) + 1) ); /*lint !e866*/
    270 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &readerdata->stagestartcons[i],
    271 timi->stagestartcons[i], strlen(timi->stagestartcons[i]) + 1) ); /*lint !e866*/
    272 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &readerdata->stagenames[i],
    273 timi->stagenames[i], strlen(timi->stagenames[i]) + 1) ); /*lint !e866*/
    274
    275 /* creating the data for the stages */
    276 SCIP_CALL( SCIPallocBlockMemory(scip, &readerdata->stages[i]) ); /*lint !e866*/
    277 readerdata->stages[i]->nvars = 0;
    278 readerdata->stages[i]->nconss = 0;
    279 readerdata->stages[i]->varssize = TIM_DEFAULT_ARRAYSIZE;
    280 readerdata->stages[i]->conssize = TIM_DEFAULT_ARRAYSIZE;
    281 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &readerdata->stages[i]->vars, readerdata->stages[i]->varssize) ); /*lint !e866*/
    282 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &readerdata->stages[i]->conss, readerdata->stages[i]->conssize) ); /*lint !e866*/
    283
    284 /* creating the hashmaps */
    285 hashmapsize = (int) SCIPceil(scip, (SCIP_Real) nvars/(SCIP_Real) readerdata->nstages);
    286 SCIP_CALL( SCIPhashmapCreate(&readerdata->stages[i]->varnametovar, SCIPblkmem(scip), hashmapsize) );
    287 SCIP_CALL( SCIPhashmapCreate(&readerdata->stages[i]->consnametocons, SCIPblkmem(scip), hashmapsize) );
    288 }
    289
    290 return SCIP_OKAY;
    291}
    292
    293/** free the reader data */
    294static
    296 SCIP* scip, /**< SCIP data structure */
    297 SCIP_READERDATA* readerdata /**< the reader data structure */
    298 )
    299{
    300 int i;
    301
    302 assert(scip != NULL);
    303 assert(readerdata != NULL);
    304
    305 /* only free the reader data is a file has been read */
    306 if( readerdata->read )
    307 {
    308 for( i = 0; i < readerdata->nstages; i++ )
    309 {
    310 /* freeing the hashmaps */
    311 SCIPhashmapFree(&readerdata->stages[i]->consnametocons);
    312 SCIPhashmapFree(&readerdata->stages[i]->varnametovar);
    313
    314 SCIPfreeBlockMemoryArray(scip, &readerdata->stagestartvars[i], strlen(readerdata->stagestartvars[i]) + 1);
    315 SCIPfreeBlockMemoryArray(scip, &readerdata->stagestartcons[i], strlen(readerdata->stagestartcons[i]) + 1);
    316 SCIPfreeBlockMemoryArray(scip, &readerdata->stagenames[i], strlen(readerdata->stagenames[i]) + 1);
    317
    318 /* freeing the memory for the stage data */
    319 SCIPfreeBlockMemoryArray(scip, &readerdata->stages[i]->vars, readerdata->stages[i]->varssize);
    320 SCIPfreeBlockMemoryArray(scip, &readerdata->stages[i]->conss, readerdata->stages[i]->conssize);
    321 SCIPfreeBlockMemory(scip, &readerdata->stages[i]); /*lint !e866*/
    322 }
    323
    324 SCIPfreeBlockMemoryArray(scip, &readerdata->stages, readerdata->nstages);
    325 SCIPfreeBlockMemoryArray(scip, &readerdata->stagenames, readerdata->nstages);
    326 SCIPfreeBlockMemoryArray(scip, &readerdata->stagestartcons, readerdata->nstages);
    327 SCIPfreeBlockMemoryArray(scip, &readerdata->stagestartvars, readerdata->nstages);
    328
    329 readerdata->read = FALSE;
    330 }
    331}
    332
    333
    334/** creates the tim input structure */
    335static
    337 SCIP* scip, /**< SCIP data structure */
    338 TIMINPUT** timi, /**< tim input structure */
    339 SCIP_FILE* fp /**< file object for the input file */
    340 )
    341{
    342 assert(timi != NULL);
    343 assert(fp != NULL);
    344
    346
    347 (*timi)->section = TIM_TIME;
    348 (*timi)->fp = fp;
    349 (*timi)->lineno = 0;
    350 (*timi)->haserror = FALSE;
    351 (*timi)->buf [0] = '\0';
    352 (*timi)->probname[0] = '\0';
    353 (*timi)->f0 = NULL;
    354 (*timi)->f1 = NULL;
    355 (*timi)->f2 = NULL;
    356 (*timi)->f3 = NULL;
    357 (*timi)->nstages = 0;
    358 (*timi)->stagesize = TIM_DEFAULT_STAGESIZE;
    359
    360 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(*timi)->stagestartvars, (*timi)->stagesize) );
    361 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(*timi)->stagestartcons, (*timi)->stagesize) );
    362 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(*timi)->stagenames, (*timi)->stagesize) );
    363
    364 return SCIP_OKAY;
    365}
    366
    367/** free the tim input structure */
    368static
    370 SCIP* scip, /**< SCIP data structure */
    371 TIMINPUT** timi /**< tim input structure */
    372 )
    373{
    374 int i;
    375
    376 for( i = 0; i < (*timi)->nstages; i++ )
    377 {
    378 SCIPfreeBlockMemoryArray(scip, &(*timi)->stagestartvars[i], strlen((*timi)->stagestartvars[i]) + 1);
    379 SCIPfreeBlockMemoryArray(scip, &(*timi)->stagestartcons[i], strlen((*timi)->stagestartcons[i]) + 1);
    380 SCIPfreeBlockMemoryArray(scip, &(*timi)->stagenames[i], strlen((*timi)->stagenames[i]) + 1);
    381 }
    382
    383 SCIPfreeBlockMemoryArray(scip, &(*timi)->stagestartvars, (*timi)->stagesize);
    384 SCIPfreeBlockMemoryArray(scip, &(*timi)->stagestartcons, (*timi)->stagesize);
    385 SCIPfreeBlockMemoryArray(scip, &(*timi)->stagenames, (*timi)->stagesize);
    386
    388}
    389
    390/** returns the current section */
    391static
    393 const TIMINPUT* timi /**< tim input structure */
    394 )
    395{
    396 assert(timi != NULL);
    397
    398 return timi->section;
    399}
    400
    401/** return the current value of field 0 */
    402static
    403const char* timinputField0(
    404 const TIMINPUT* timi /**< tim input structure */
    405 )
    406{
    407 assert(timi != NULL);
    408
    409 return timi->f0;
    410}
    411
    412/** return the current value of field 1 */
    413static
    414const char* timinputField1(
    415 const TIMINPUT* timi /**< tim input structure */
    416 )
    417{
    418 assert(timi != NULL);
    419
    420 return timi->f1;
    421}
    422
    423/** return the current value of field 2 */
    424static
    425const char* timinputField2(
    426 const TIMINPUT* timi /**< tim input structure */
    427 )
    428{
    429 assert(timi != NULL);
    430
    431 return timi->f2;
    432}
    433
    434/** return the current value of field 3 */
    435static
    436const char* timinputField3(
    437 const TIMINPUT* timi /**< tim input structure */
    438 )
    439{
    440 assert(timi != NULL);
    441
    442 return timi->f3;
    443}
    444
    445/** returns if an error was detected */
    446static
    448 const TIMINPUT* timi /**< tim input structure */
    449 )
    450{
    451 assert(timi != NULL);
    452
    453 return timi->haserror;
    454}
    455
    456/** set the section in the tim input structure to given section */
    457static
    459 TIMINPUT* timi, /**< tim input structure */
    460 TIMSECTION section /**< section that is set */
    461 )
    462{
    463 assert(timi != NULL);
    464
    465 timi->section = section;
    466}
    467
    468/** set the problem name in the tim input structure to given problem name */
    469static
    471 TIMINPUT* timi, /**< tim input structure */
    472 const char* probname /**< name of the problem to set */
    473 )
    474{
    475 assert(timi != NULL);
    476 assert(probname != NULL);
    477 assert(strlen(probname) < sizeof(timi->probname));
    478
    479 (void)SCIPmemccpy(timi->probname, probname, '\0', TIM_MAX_NAMELEN - 1);
    480}
    481
    482/** set the problem var name that starts a stage in the tim input structure to given objective name */
    483static
    485 TIMINPUT* timi, /**< tim input structure */
    486 SCIP* scip, /**< SCIP data structure */
    487 const char* varname, /**< name of the variable that starts the stage */
    488 int stagenum /**< the stage number the variable starts */
    489 )
    490{
    491 assert(timi != NULL);
    492 assert(varname != NULL);
    493
    494 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &timi->stagestartvars[stagenum], varname, strlen(varname) + 1) ); /*lint !e866*/
    495
    496 return SCIP_OKAY;
    497}
    498
    499/** set the problem constraint name that starts a stage in the tim input structure to given objective name */
    500static
    502 TIMINPUT* timi, /**< tim input structure */
    503 SCIP* scip, /**< SCIP data structure */
    504 const char* consname, /**< name of the constraint that starts the stage */
    505 int stagenum /**< the stage number the constraint starts */
    506 )
    507{
    508 assert(timi != NULL);
    509 assert(consname != NULL);
    510
    511 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &timi->stagestartcons[stagenum], consname, strlen(consname) + 1) ); /*lint !e866*/
    512
    513 return SCIP_OKAY;
    514}
    515
    516/** set the stage name in the tim input structure to given objective name */
    517static
    519 TIMINPUT* timi, /**< tim input structure */
    520 SCIP* scip, /**< SCIP data structure */
    521 const char* stagename, /**< name of the stage */
    522 int stagenum /**< the stage number the constraint starts */
    523 )
    524{
    525 assert(timi != NULL);
    526 assert(stagename != NULL);
    527
    528 SCIP_CALL( SCIPduplicateBlockMemoryArray(scip, &timi->stagenames[stagenum], stagename, strlen(stagename) + 1) ); /*lint !e866*/
    529
    530 return SCIP_OKAY;
    531}
    532
    533static
    535 TIMINPUT* timi /**< tim input structure */
    536 )
    537{
    538 assert(timi != NULL);
    539
    540 SCIPerrorMessage("Syntax error in line %d\n", timi->lineno);
    541 timi->section = TIM_ENDATA;
    542 timi->haserror = TRUE;
    543}
    544
    545/** fill the line from \p pos up to column 80 with blanks. */
    546static
    548 char* buf, /**< buffer to clear */
    549 unsigned int pos /**< position to start the clearing process */
    550 )
    551{
    552 unsigned int i;
    553
    554 for(i = pos; i < 80; i++)
    555 buf[i] = BLANK;
    556 buf[80] = '\0';
    557}
    558
    559/** read a tim format data line and parse the fields. */
    560static
    562 TIMINPUT* timi /**< tim input structure */
    563 )
    564{
    565 unsigned int len;
    566 unsigned int i;
    567 char* s;
    568 SCIP_Bool is_empty;
    569 char* nexttok;
    570
    571 do
    572 {
    573 timi->f0 = timi->f1 = timi->f2 = timi->f3 = 0;
    574
    575 /* Read until we have not a comment line. */
    576 do
    577 {
    578 timi->buf[TIM_MAX_LINELEN-1] = '\0';
    579 if( NULL == SCIPfgets(timi->buf, (int) sizeof(timi->buf), timi->fp) )
    580 return FALSE;
    581 timi->lineno++;
    582 }
    583 while( *timi->buf == '*' ); /* coverity[a_loop_bound] */
    584
    585 /* Normalize line */
    586 len = (unsigned int) strlen(timi->buf);
    587
    588 for( i = 0; i < len; i++ )
    589 if( (timi->buf[i] == '\t') || (timi->buf[i] == '\n') || (timi->buf[i] == '\r') )
    590 timi->buf[i] = BLANK;
    591
    592 if( len < 80 )
    593 clearFrom(timi->buf, len);
    594
    595 SCIPdebugMessage("line %d: <%s>\n", timi->lineno, timi->buf);
    596
    597 assert(strlen(timi->buf) >= 80);
    598
    599 /* Look for new section */
    600 if( *timi->buf != BLANK )
    601 {
    602 timi->f0 = SCIPstrtok(&timi->buf[0], " ", &nexttok);
    603
    604 assert(timi->f0 != 0);
    605
    606 timi->f1 = SCIPstrtok(NULL, " ", &nexttok);
    607
    608 return TRUE;
    609 }
    610
    611 s = &timi->buf[1];
    612
    613 /* At this point it is not clear if we have a indicator field.
    614 * If there is none (e.g. empty) f1 will be the first name field.
    615 * If there is one, f2 will be the first name field.
    616 *
    617 * Initially comment marks '$' are only allowed in the beginning
    618 * of the 2nd and 3rd name field. We test all fields but the first.
    619 * This makes no difference, since if the $ is at the start of a value
    620 * field, the line will be erroneous anyway.
    621 */
    622 do
    623 {
    624 if( NULL == (timi->f1 = SCIPstrtok(s, " ", &nexttok)) )
    625 break;
    626
    627 if( (NULL == (timi->f2 = SCIPstrtok(NULL, " ", &nexttok))) || (*timi->f2 == '$') )
    628 {
    629 timi->f2 = 0;
    630 break;
    631 }
    632
    633 if( (NULL == (timi->f3 = SCIPstrtok(NULL, " ", &nexttok))) || (*timi->f3 == '$') )
    634 {
    635 timi->f3 = 0;
    636 break;
    637 }
    638 }
    639 while( FALSE );
    640
    641 /* check for empty lines */
    642 is_empty = (timi->f0 == NULL && timi->f1 == NULL);
    643 }
    644 while( is_empty );
    645
    646 return TRUE;
    647}
    648
    649/** Process TIME section. */
    650static
    652 SCIP* scip, /**< SCIP data structure */
    653 TIMINPUT* timi /**< tim input structure */
    654 )
    655{
    656 SCIPdebugMsg(scip, "read problem name from TIME section\n");
    657
    658 /* This has to be the Line with the TIME section. */
    659 if( !timinputReadLine(timi) || timinputField0(timi) == NULL || strcmp(timinputField0(timi), "TIME") )
    660 {
    662 return SCIP_OKAY;
    663 }
    664
    665 /* Sometimes the name is omitted. */
    666 timinputSetProbname(timi, (timinputField1(timi) == 0) ? "_TIM_" : timinputField1(timi));
    667
    668 /* This has to be a new section */
    669 /* coverity[tainted_data] */
    670 if( !timinputReadLine(timi) || (timinputField0(timi) == NULL) )
    671 {
    673 return SCIP_OKAY;
    674 }
    675
    676 if( strncmp(timinputField0(timi), "PERIODS", 7) == 0 )
    678 else
    679 {
    681 return SCIP_OKAY;
    682 }
    683
    684 return SCIP_OKAY;
    685}
    686
    687/** Process PERIODS section. */
    688static
    690 TIMINPUT* timi, /**< tim input structure */
    691 SCIP* scip /**< SCIP data structure */
    692 )
    693{
    694 SCIPdebugMsg(scip, "read Periods\n");
    695
    696 /* coverity[tainted_data_sink_lv_call] */
    697 /* coverity[tainted_data] */
    698 while( timinputReadLine(timi) )
    699 {
    700 if( timinputField0(timi) != NULL )
    701 {
    702 if( strcmp(timinputField0(timi), "PERIODS") == 0 )
    704 else if( strcmp(timinputField0(timi), "ENDATA") == 0 )
    706 else
    708
    709 return SCIP_OKAY;
    710 }
    711
    712 if( timi->nstages + 1 >= timi->stagesize )
    713 {
    717 }
    718
    722
    723 timi->nstages++;
    724 }
    726
    727 return SCIP_OKAY;
    728}
    729
    730
    731/** Read time data for the SMPS file format. */
    732static
    734 SCIP* scip, /**< SCIP data structure */
    735 SCIP_READER* reader, /**< the file reader itself */
    736 const char* filename /**< name of the input file */
    737 )
    738{
    739 SCIP_FILE* fp;
    740 TIMINPUT* timi;
    741 SCIP_RETCODE retcode;
    742 SCIP_Bool error = TRUE;
    743
    744 assert(scip != NULL);
    745 assert(filename != NULL);
    746
    747 fp = SCIPfopen(filename, "r");
    748 if( fp == NULL )
    749 {
    750 SCIPerrorMessage("cannot open file <%s> for reading\n", filename);
    751 SCIPprintSysError(filename);
    752
    753 return SCIP_NOFILE;
    754 }
    755
    757
    758 SCIP_CALL_TERMINATE( retcode, readTime(scip, timi), TERMINATE );
    759
    760 while( timinputSection(timi) == TIM_PERIODS )
    761 {
    762 /* coverity[tainted_data] */
    763 SCIP_CALL_TERMINATE( retcode, readPeriods(timi, scip), TERMINATE );
    764 }
    765 if( timinputSection(timi) != TIM_ENDATA )
    767
    768 error = timinputHasError(timi);
    769
    770 if( !error )
    771 {
    772 SCIP_CALL_TERMINATE( retcode, createReaderdata(scip, reader, timi), TERMINATE );
    773 }
    774
    775 TERMINATE:
    776 timinputFree(scip, &timi);
    777 SCIPfclose(fp);
    778
    779 if( error )
    780 return SCIP_READERROR;
    781 else
    782 return SCIP_OKAY;
    783}
    784
    785/*
    786 * Callback methods of reader
    787 */
    788
    789/** copy method for reader plugins (called when SCIP copies plugins) */
    790static
    792{ /*lint --e{715}*/
    793 assert(scip != NULL);
    794 assert(reader != NULL);
    795 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
    796
    797 /* call inclusion method of reader */
    799
    800 return SCIP_OKAY;
    801}
    802
    803/** destructor of reader to free user data (called when SCIP is exiting) */
    804static
    806{
    807 SCIP_READERDATA* readerdata;
    808
    809 assert(scip != NULL);
    810 assert(reader != NULL);
    811
    812 readerdata = SCIPreaderGetData(reader);
    813 assert(readerdata != NULL);
    814
    815 freeReaderdata(scip, readerdata);
    816
    817 SCIPfreeBlockMemory(scip, &readerdata);
    818
    819 return SCIP_OKAY;
    820}
    821
    822/** reads the stage information for a stochastic programming instance in SMPS format */
    823static
    825{ /*lint --e{715}*/
    826 SCIP_READER* correader;
    827
    828 assert(reader != NULL);
    829 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
    830 assert(result != NULL);
    831
    832 *result = SCIP_DIDNOTRUN;
    833
    834 correader = SCIPfindReader(scip, "correader");
    835
    836 if( correader == NULL )
    837 {
    838 SCIPwarningMessage(scip, "It is necessary to include the \"cor\" reader\n");
    839 (*result) = SCIP_DIDNOTRUN;
    840 return SCIP_OKAY;
    841 }
    842
    843 /* checking whether the cor file has been read */
    844 if( !SCIPcorHasRead(correader) )
    845 {
    846 SCIPwarningMessage(scip, "The core file must be read before the time and stochastic files.\n");
    847 (*result) = SCIP_DIDNOTRUN;
    848 return SCIP_OKAY;
    849 }
    850
    851 /* when reading the TIM file, it is necessary to free the TIM and STO reader data. This is the STO file generates
    852 * data based on the data from the TIM file. For most readers, there is no problem data stored in the reader data,
    853 * and hence the reader data doesn't need to be freed.
    854 */
    857
    858 SCIP_CALL( SCIPreadTim(scip, filename, result) );
    859
    860 return SCIP_OKAY;
    861}
    862
    863
    864/*
    865 * tim file reader specific interface methods
    866 */
    867
    868/** includes the tim file reader in SCIP */
    870 SCIP* scip /**< SCIP data structure */
    871 )
    872{
    873 SCIP_READERDATA* readerdata;
    874 SCIP_READER* reader;
    875
    876 /* create reader data */
    877 SCIP_CALL( SCIPallocBlockMemory(scip, &readerdata) );
    878 readerdata->read = FALSE;
    879
    880 /* include reader */
    882
    883 /* set non fundamental callbacks via setter functions */
    884 SCIP_CALL( SCIPsetReaderCopy(scip, reader, readerCopyTim) );
    885 SCIP_CALL( SCIPsetReaderFree(scip, reader, readerFreeTim) );
    886 SCIP_CALL( SCIPsetReaderRead(scip, reader, readerReadTim) );
    887
    888 return SCIP_OKAY;
    889}
    890
    891
    892/** reads problem from file */
    894 SCIP* scip, /**< SCIP data structure */
    895 const char* filename, /**< full path and name of file to read, or NULL if stdin should be used */
    896 SCIP_RESULT* result /**< pointer to store the result of the file reading call */
    897 )
    898{
    899 SCIP_READER* reader;
    900 SCIP_RETCODE retcode;
    901 SCIP_READERDATA* readerdata;
    902
    903 assert(scip != NULL);
    904 assert(result != NULL);
    905
    907 assert(reader != NULL);
    908
    909 retcode = readTim(scip, reader, filename);
    910
    911 if( retcode == SCIP_PLUGINNOTFOUND )
    912 retcode = SCIP_READERROR;
    913
    914 if( retcode == SCIP_NOFILE || retcode == SCIP_READERROR )
    915 return retcode;
    916
    917 SCIP_CALL( retcode );
    918
    919 /* creating the stages */
    920 SCIP_CALL( createStages(scip, reader, SCIPfindReader(scip, "correader")) );
    921
    922 /* setting the read flag to TRUE */
    923 readerdata = SCIPreaderGetData(reader);
    924 readerdata->read = TRUE;
    925
    926 *result = SCIP_SUCCESS;
    927
    928 return SCIP_OKAY;
    929}
    930
    931/** frees the reader data for the tim file */
    933 SCIP* scip /**< the SCIP data structure */
    934 )
    935{
    936 SCIP_READER* reader;
    937 SCIP_READERDATA* readerdata;
    938
    939 assert(scip != NULL);
    940
    942 assert(reader != NULL);
    943
    944 readerdata = SCIPreaderGetData(reader);
    945 assert(readerdata != NULL);
    946
    947 freeReaderdata(scip, readerdata);
    948
    949 return SCIP_OKAY;
    950}
    951
    952
    953/*
    954 * Interface methods for the cor and sto files
    955 */
    956
    957/* return whether the tim file has been read */
    959 SCIP_READER* reader /**< the file reader itself */
    960 )
    961{
    962 SCIP_READERDATA* readerdata;
    963
    964 assert(reader != NULL);
    965 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
    966
    967 readerdata = SCIPreaderGetData(reader);
    968 assert(readerdata != NULL);
    969
    970 return readerdata->read;
    971}
    972
    973
    974/* returns the number of stages */
    976 SCIP* scip /**< SCIP data structure */
    977 )
    978{
    979 SCIP_READER* reader;
    980 SCIP_READERDATA* readerdata;
    981
    983
    984 assert(reader != NULL);
    985 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
    986
    987 readerdata = SCIPreaderGetData(reader);
    988 assert(readerdata != NULL);
    989
    990 return readerdata->nstages;
    991}
    992
    993/* returns the name for a given stage */
    995 SCIP* scip, /**< SCIP data structure */
    996 int stagenum /**< the number of the requested stage */
    997 )
    998{
    999 SCIP_READER* reader;
    1000 SCIP_READERDATA* readerdata;
    1001
    1002 reader = SCIPfindReader(scip, READER_NAME);
    1003
    1004 assert(reader != NULL);
    1005 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
    1006
    1007 readerdata = SCIPreaderGetData(reader);
    1008 assert(readerdata != NULL);
    1009 assert(stagenum >= 0 && stagenum < readerdata->nstages);
    1010
    1011 return readerdata->stagenames[stagenum];
    1012}
    1013
    1014/* returns the stage name for a given constraint name */
    1016 SCIP* scip, /**< SCIP data structure */
    1017 const char* consname /**< the constraint to search for */
    1018 )
    1019{
    1020 SCIP_READER* reader;
    1021 SCIP_READERDATA* readerdata;
    1022 int stagenum;
    1023 int i;
    1024 int j;
    1025
    1026 reader = SCIPfindReader(scip, READER_NAME);
    1027
    1028 assert(reader != NULL);
    1029 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
    1030
    1031 readerdata = SCIPreaderGetData(reader);
    1032 assert(readerdata != NULL);
    1033
    1034 /* looping over all stages to find the provided constraint */
    1035 stagenum = -1;
    1036 for( i = 0; i < readerdata->nstages; i++ )
    1037 {
    1038 for( j = 0; j < readerdata->stages[i]->nconss; j++ )
    1039 {
    1040 if( strcmp(SCIPconsGetName(readerdata->stages[i]->conss[j]), consname) == 0 )
    1041 {
    1042 stagenum = i;
    1043 break;
    1044 }
    1045 }
    1046
    1047 if( stagenum >= 0 )
    1048 break;
    1049 }
    1050 assert(stagenum >= 0 && stagenum < readerdata->nstages);
    1051
    1052 return readerdata->stagenames[stagenum];
    1053}
    1054
    1055/* returns the number for a given stage */
    1057 SCIP* scip, /**< SCIP data structure */
    1058 const char* stage /**< the name of the requested stage */
    1059 )
    1060{
    1061 SCIP_READER* reader;
    1062 SCIP_READERDATA* readerdata;
    1063 int i;
    1064 int stagenum;
    1065
    1066 reader = SCIPfindReader(scip, READER_NAME);
    1067
    1068 assert(reader != NULL);
    1069 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
    1070
    1071 readerdata = SCIPreaderGetData(reader);
    1072 assert(readerdata != NULL);
    1073
    1074 stagenum = -1;
    1075 for( i = 0; i < readerdata->nstages; i++ )
    1076 {
    1077 if( strcmp(readerdata->stagenames[i], stage) == 0 )
    1078 {
    1079 stagenum = i;
    1080 break;
    1081 }
    1082 }
    1083
    1084 if( stagenum < 0 )
    1085 {
    1086 SCIPerrorMessage("Stage <%s> was not found in the TIM file. Check the SMPS files (COR, TIM and STO)\n", stage);
    1087 SCIPABORT();
    1088 }
    1089
    1090 return stagenum;
    1091}
    1092
    1093/* returns the array of variables for a given stage */
    1095 SCIP* scip, /**< SCIP data structure */
    1096 int stagenum /**< the number of the requested stage */
    1097 )
    1098{
    1099 SCIP_READER* reader;
    1100 SCIP_READERDATA* readerdata;
    1101
    1102 reader = SCIPfindReader(scip, READER_NAME);
    1103
    1104 assert(reader != NULL);
    1105 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
    1106
    1107 readerdata = SCIPreaderGetData(reader);
    1108 assert(readerdata != NULL);
    1109 assert(stagenum >= 0 && stagenum < readerdata->nstages);
    1110
    1111 return readerdata->stages[stagenum]->vars;
    1112}
    1113
    1114/* returns an array of constraints for a given stage */
    1116 SCIP* scip, /**< SCIP data structure */
    1117 int stagenum /**< the number of the requested stage */
    1118 )
    1119{
    1120 SCIP_READER* reader;
    1121 SCIP_READERDATA* readerdata;
    1122
    1123 reader = SCIPfindReader(scip, READER_NAME);
    1124
    1125 assert(reader != NULL);
    1126 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
    1127
    1128 readerdata = SCIPreaderGetData(reader);
    1129 assert(readerdata != NULL);
    1130 assert(stagenum >= 0 && stagenum < readerdata->nstages);
    1131
    1132 return readerdata->stages[stagenum]->conss;
    1133}
    1134
    1135/* returns the number of variables for a given stage */
    1137 SCIP* scip, /**< SCIP data structure */
    1138 int stagenum /**< the number of the requested stage */
    1139 )
    1140{
    1141 SCIP_READER* reader;
    1142 SCIP_READERDATA* readerdata;
    1143
    1144 reader = SCIPfindReader(scip, READER_NAME);
    1145
    1146 assert(reader != NULL);
    1147 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
    1148
    1149 readerdata = SCIPreaderGetData(reader);
    1150 assert(readerdata != NULL);
    1151 assert(stagenum >= 0 && stagenum < readerdata->nstages);
    1152
    1153 return readerdata->stages[stagenum]->nvars;
    1154}
    1155
    1156/* returns the number of constraints for a given stage */
    1158 SCIP* scip, /**< SCIP data structure */
    1159 int stagenum /**< the number of the requested stage */
    1160 )
    1161{
    1162 SCIP_READER* reader;
    1163 SCIP_READERDATA* readerdata;
    1164
    1165 reader = SCIPfindReader(scip, READER_NAME);
    1166
    1167 assert(reader != NULL);
    1168 assert(strcmp(SCIPreaderGetName(reader), READER_NAME) == 0);
    1169
    1170 readerdata = SCIPreaderGetData(reader);
    1171 assert(readerdata != NULL);
    1172 assert(stagenum >= 0 && stagenum < readerdata->nstages);
    1173
    1174 return readerdata->stages[stagenum]->nconss;
    1175}
    #define NULL
    Definition: def.h:248
    #define SCIP_Bool
    Definition: def.h:91
    #define SCIP_Real
    Definition: def.h:156
    #define TRUE
    Definition: def.h:93
    #define FALSE
    Definition: def.h:94
    #define SCIP_CALL_TERMINATE(retcode, x, TERM)
    Definition: def.h:376
    #define SCIPABORT()
    Definition: def.h:327
    #define SCIP_CALL(x)
    Definition: def.h:355
    #define SCIP_CALL_FINALLY(x, y)
    Definition: def.h:397
    SCIP_FILE * SCIPfopen(const char *path, const char *mode)
    Definition: fileio.c:153
    int SCIPfclose(SCIP_FILE *fp)
    Definition: fileio.c:232
    char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
    Definition: fileio.c:200
    SCIP_RETCODE SCIPreadTim(SCIP *scip, const char *filename, SCIP_RESULT *result)
    Definition: reader_tim.c:893
    const char * SCIPcorGetVarName(SCIP_READER *reader, int i)
    Definition: reader_cor.c:315
    SCIP_Bool SCIPcorHasRead(SCIP_READER *reader)
    Definition: reader_cor.c:267
    const char * SCIPcorGetConsName(SCIP_READER *reader, int i)
    Definition: reader_cor.c:333
    SCIP_RETCODE SCIPfreeReaderdataSto(SCIP *scip)
    Definition: reader_sto.c:2880
    int SCIPcorGetNConsNames(SCIP_READER *reader)
    Definition: reader_cor.c:299
    int SCIPcorGetNVarNames(SCIP_READER *reader)
    Definition: reader_cor.c:283
    SCIP_RETCODE SCIPincludeReaderTim(SCIP *scip)
    Definition: reader_tim.c:869
    int SCIPgetNVars(SCIP *scip)
    Definition: scip_prob.c:2246
    SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
    Definition: scip_prob.c:3189
    SCIP_CONS * SCIPfindCons(SCIP *scip, const char *name)
    Definition: scip_prob.c:3525
    void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
    Definition: misc.c:3095
    SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
    Definition: misc.c:3143
    SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
    Definition: misc.c:3061
    #define SCIPdebugMsg
    Definition: scip_message.h:78
    void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
    Definition: scip_message.c:120
    const char * SCIPconsGetName(SCIP_CONS *cons)
    Definition: cons.c:8389
    #define SCIPfreeBlockMemoryArray(scip, ptr, num)
    Definition: scip_mem.h:110
    BMS_BLKMEM * SCIPblkmem(SCIP *scip)
    Definition: scip_mem.c:57
    #define SCIPensureBlockMemoryArray(scip, ptr, arraysizeptr, minsize)
    Definition: scip_mem.h:107
    #define SCIPallocBlockMemoryArray(scip, ptr, num)
    Definition: scip_mem.h:93
    #define SCIPfreeBlockMemory(scip, ptr)
    Definition: scip_mem.h:108
    #define SCIPallocBlockMemory(scip, ptr)
    Definition: scip_mem.h:89
    #define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
    Definition: scip_mem.h:105
    SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
    Definition: scip_reader.c:109
    SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERCOPY((*readercopy)))
    Definition: scip_reader.c:147
    SCIP_READERDATA * SCIPreaderGetData(SCIP_READER *reader)
    Definition: reader.c:605
    SCIP_READER * SCIPfindReader(SCIP *scip, const char *name)
    Definition: scip_reader.c:235
    SCIP_RETCODE SCIPsetReaderFree(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERFREE((*readerfree)))
    Definition: scip_reader.c:171
    const char * SCIPreaderGetName(SCIP_READER *reader)
    Definition: reader.c:680
    SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
    Definition: scip_reader.c:195
    SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
    void SCIPprintSysError(const char *message)
    Definition: misc.c:10719
    char * SCIPstrtok(char *s, const char *delim, char **ptrptr)
    Definition: misc.c:10768
    int SCIPmemccpy(char *dest, const char *src, char stop, unsigned int cnt)
    Definition: misc.c:10694
    public methods for managing constraints
    wrapper functions to map file i/o to standard or zlib file i/o
    struct SCIP_File SCIP_FILE
    Definition: pub_fileio.h:43
    public methods for message output
    #define SCIPerrorMessage
    Definition: pub_message.h:64
    #define SCIPdebugMessage
    Definition: pub_message.h:96
    public data structures and miscellaneous methods
    public methods for input file readers
    COR file reader (MPS format of the core problem for stochastic programs)
    STO file reader - the stochastic information of an instance in SMPS format.
    static SCIP_RETCODE timinputCreate(SCIP *scip, TIMINPUT **timi, SCIP_FILE *fp)
    Definition: reader_tim.c:336
    static SCIP_DECL_READERFREE(readerFreeTim)
    Definition: reader_tim.c:805
    static SCIP_RETCODE addConstraintToStage(SCIP *scip, TIMSTAGE *stage, const char *consname)
    Definition: reader_tim.c:151
    static SCIP_DECL_READERREAD(readerReadTim)
    Definition: reader_tim.c:824
    int SCIPtimFindStage(SCIP *scip, const char *stage)
    Definition: reader_tim.c:1056
    #define TIM_DEFAULT_STAGESIZE
    Definition: reader_tim.c:58
    static const char * timinputField0(const TIMINPUT *timi)
    Definition: reader_tim.c:403
    #define TIM_MAX_LINELEN
    Definition: reader_tim.c:56
    static void timinputFree(SCIP *scip, TIMINPUT **timi)
    Definition: reader_tim.c:369
    static SCIP_RETCODE createReaderdata(SCIP *scip, SCIP_READER *reader, TIMINPUT *timi)
    Definition: reader_tim.c:236
    static SCIP_RETCODE timinputSetStageStartVar(TIMINPUT *timi, SCIP *scip, const char *varname, int stagenum)
    Definition: reader_tim.c:484
    static SCIP_RETCODE createStages(SCIP *scip, SCIP_READER *reader, SCIP_READER *correader)
    Definition: reader_tim.c:183
    static void clearFrom(char *buf, unsigned int pos)
    Definition: reader_tim.c:547
    static const char * timinputField3(const TIMINPUT *timi)
    Definition: reader_tim.c:436
    enum TimSection TIMSECTION
    Definition: reader_tim.c:94
    static void timinputSetProbname(TIMINPUT *timi, const char *probname)
    Definition: reader_tim.c:470
    #define TIM_MAX_NAMELEN
    Definition: reader_tim.c:57
    int SCIPtimGetStageNVars(SCIP *scip, int stagenum)
    Definition: reader_tim.c:1136
    static void timinputSetSection(TIMINPUT *timi, TIMSECTION section)
    Definition: reader_tim.c:458
    #define BLANK
    Definition: reader_tim.c:61
    static SCIP_Bool timinputReadLine(TIMINPUT *timi)
    Definition: reader_tim.c:561
    SCIP_RETCODE SCIPfreeReaderdataTim(SCIP *scip)
    Definition: reader_tim.c:932
    static SCIP_RETCODE readTime(SCIP *scip, TIMINPUT *timi)
    Definition: reader_tim.c:651
    #define READER_DESC
    Definition: reader_tim.c:49
    static const char * timinputField1(const TIMINPUT *timi)
    Definition: reader_tim.c:414
    SCIP_VAR ** SCIPtimGetStageVars(SCIP *scip, int stagenum)
    Definition: reader_tim.c:1094
    static SCIP_DECL_READERCOPY(readerCopyTim)
    Definition: reader_tim.c:791
    static SCIP_RETCODE timinputSetStageStartCons(TIMINPUT *timi, SCIP *scip, const char *consname, int stagenum)
    Definition: reader_tim.c:501
    static SCIP_RETCODE timinputSetStageName(TIMINPUT *timi, SCIP *scip, const char *stagename, int stagenum)
    Definition: reader_tim.c:518
    static void freeReaderdata(SCIP *scip, SCIP_READERDATA *readerdata)
    Definition: reader_tim.c:295
    SCIP_Bool SCIPtimHasRead(SCIP_READER *reader)
    Definition: reader_tim.c:958
    TimSection
    Definition: reader_tim.c:89
    @ TIM_TIME
    Definition: reader_tim.c:90
    @ TIM_ENDATA
    Definition: reader_tim.c:92
    @ TIM_PERIODS
    Definition: reader_tim.c:91
    #define READER_EXTENSION
    Definition: reader_tim.c:50
    int SCIPtimGetNStages(SCIP *scip)
    Definition: reader_tim.c:975
    static const char * timinputField2(const TIMINPUT *timi)
    Definition: reader_tim.c:425
    const char * SCIPtimGetStageName(SCIP *scip, int stagenum)
    Definition: reader_tim.c:994
    #define READER_NAME
    Definition: reader_tim.c:48
    #define TIM_DEFAULT_ARRAYSIZE
    Definition: reader_tim.c:59
    static SCIP_RETCODE readTim(SCIP *scip, SCIP_READER *reader, const char *filename)
    Definition: reader_tim.c:733
    static SCIP_RETCODE addVariableToStage(SCIP *scip, TIMSTAGE *stage, const char *varname)
    Definition: reader_tim.c:119
    static TIMSECTION timinputSection(const TIMINPUT *timi)
    Definition: reader_tim.c:392
    SCIP_CONS ** SCIPtimGetStageConss(SCIP *scip, int stagenum)
    Definition: reader_tim.c:1115
    static void timinputSyntaxerror(TIMINPUT *timi)
    Definition: reader_tim.c:534
    static SCIP_RETCODE readPeriods(TIMINPUT *timi, SCIP *scip)
    Definition: reader_tim.c:689
    static SCIP_Bool timinputHasError(const TIMINPUT *timi)
    Definition: reader_tim.c:447
    int SCIPtimGetStageNConss(SCIP *scip, int stagenum)
    Definition: reader_tim.c:1157
    const char * SCIPtimConsGetStageName(SCIP *scip, const char *consname)
    Definition: reader_tim.c:1015
    TIM file reader - the stage information for a stochastic programming instance in SMPS format.
    public methods for memory management
    public methods for message handling
    public methods for numerical tolerances
    public methods for global and local (sub)problems
    public methods for reader plugins
    int stagesize
    Definition: reader_tim.c:113
    SCIP_FILE * fp
    Definition: reader_tim.c:100
    const char * f1
    Definition: reader_tim.c:105
    SCIP_Bool haserror
    Definition: reader_tim.c:102
    int lineno
    Definition: reader_tim.c:101
    const char ** stagenames
    Definition: reader_tim.c:111
    char buf[TIM_MAX_LINELEN]
    Definition: reader_tim.c:103
    const char ** stagestartcons
    Definition: reader_tim.c:110
    const char * f3
    Definition: reader_tim.c:107
    int nstages
    Definition: reader_tim.c:112
    char probname[TIM_MAX_NAMELEN]
    Definition: reader_tim.c:108
    TIMSECTION section
    Definition: reader_tim.c:99
    const char * f2
    Definition: reader_tim.c:106
    const char * f0
    Definition: reader_tim.c:104
    const char ** stagestartvars
    Definition: reader_tim.c:109
    SCIP_CONS ** conss
    Definition: reader_tim.c:66
    SCIP_HASHMAP * consnametocons
    Definition: reader_tim.c:68
    SCIP_HASHMAP * varnametovar
    Definition: reader_tim.c:67
    SCIP_VAR ** vars
    Definition: reader_tim.c:65
    int conssize
    Definition: reader_tim.c:72
    int varssize
    Definition: reader_tim.c:71
    int nvars
    Definition: reader_tim.c:69
    int nconss
    Definition: reader_tim.c:70
    struct SCIP_ReaderData SCIP_READERDATA
    Definition: type_reader.h:54
    @ SCIP_DIDNOTRUN
    Definition: type_result.h:42
    @ SCIP_SUCCESS
    Definition: type_result.h:58
    enum SCIP_Result SCIP_RESULT
    Definition: type_result.h:61
    @ SCIP_NOFILE
    Definition: type_retcode.h:47
    @ SCIP_READERROR
    Definition: type_retcode.h:45
    @ SCIP_PLUGINNOTFOUND
    Definition: type_retcode.h:54
    @ SCIP_OKAY
    Definition: type_retcode.h:42
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63