reader_ref.c
Go to the documentation of this file.
35 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
233 SCIPerrorMessage("Error: line %d exceeds %d characters\n", refinput->linenumber, REF_MAX_LINELEN-2);
238 refinput->linebuf[REF_MAX_LINELEN-2] = '\0'; /* we want to use lookahead of one char -> we need two \0 at the end */
249 *(commentstart+1) = '\0'; /* we want to use lookahead of one char -> we need two \0 at the end */
256 /** reads the next token from the input file into the token buffer; returns whether a token was read */
273 SCIPswapPointers((void**)&refinput->token, (void**)&refinput->pushedtokens[refinput->npushedtokens-1]);
313 if( isValueChar(buf[refinput->linepos], buf[refinput->linepos+1], TRUE, &hasdot, &exptype) ) /*lint !e679*/
326 while( isValueChar(buf[refinput->linepos], buf[refinput->linepos+1], FALSE, &hasdot, &exptype) ); /*lint !e679*/
344 * if the token is an equality token '=' and the next character is a '<' or '>', replace the token by the inequality sense
347 && (refinput->token[tokenlen-1] == '<' || refinput->token[tokenlen-1] == '>' || refinput->token[tokenlen-1] == '=')
352 else if( refinput->token[tokenlen-1] == '=' && (buf[refinput->linepos] == '<' || buf[refinput->linepos] == '>') )
377 assert(!(strcasecmp(refinput->token, "INFINITY") == 0) && !(strcasecmp(refinput->token, "INF") == 0));
484 SCIPdebugMessage("Reading constraints of block %d/%d\n", refinput->blocknr + 1, refinput->nblocks);
514 SCIP_CALL( SCIPhashmapSetImage(refinput->constoblock, cons, (void*) (size_t) (refinput->blocknr+1) ) );
530 SCIP_CALL( SCIPhashmapSetImage(refinput->vartoblock, var, (void*) (size_t) (refinput->nblocks+1)) );
535 SCIP_CALL( SCIPhashmapSetImage(refinput->vartoblock, var, (void*) (size_t) (refinput->blocknr+1)) );
587 SCIPverbMessage(scip, SCIP_VERBLEVEL_MINIMAL, NULL, "Reader 'ref' can only read in unpresolved structures.\n Please re-read the problem and read the decomposition again.\n");
625 SCIP_CALL_QUIET( DECfilloutDecompFromHashmaps(scip, decomp, refinput->vartoblock, refinput->constoblock, refinput->nblocks, FALSE) );
685 SCIP_CALL( SCIPhashmapInsert(cons2origindex, cons, (void*)(size_t)(ind)) ); /* shift by 1 to enable error checking */
737 if( SCIPgetStage(scip) == SCIP_STAGE_INIT || SCIPgetNVars(scip) == 0 || SCIPgetNConss(scip) == 0 )
739 SCIPverbMessage(scip, SCIP_VERBLEVEL_DIALOG, NULL, "No problem exists, will not detect structure!\n");
781 const char* filename, /**< full path and name of file to read, or NULL if stdin should be used */
803 SCIP_CALL( SCIPallocMemoryArray(scip, &refinput.pushedtokens[i], REF_MAX_LINELEN) ); /*lint !e506 !e866*/
829 SCIPdebugMessage("Read %d/%d conss in ref-file\n", refinput.totalreadconss, refinput.totalconss);
830 SCIPdebugMessage("Assigned %d variables to %d blocks.\n", refinput.nassignedvars, refinput.nblocks);
void DECdecompSetNBlocks(DEC_DECOMP *decomp, int nblocks)
Definition: decomp.c:733
Definition: reader_ref.c:77
GCG interface methods.
Definition: struct_decomp.h:51
constraint handler for structure detection
SCIP_RETCODE DECfilloutDecompFromHashmaps(SCIP *scip, DEC_DECOMP *decomp, SCIP_HASHMAP *vartoblock, SCIP_HASHMAP *constoblock, int nblocks, SCIP_Bool staircase)
Definition: decomp.c:1271
SCIP_RETCODE GCGconshdlrDecompAddPreexistingDecomp(SCIP *scip, DEC_DECOMP *decomp)
adds a decomp that exists before the detection is called
Definition: cons_decomp.cpp:3534
static SCIP_RETCODE writeREFFile(SCIP *scip, SCIP_READER *reader, FILE *file)
Definition: reader_ref.c:635
int * DECdecompGetNSubscipconss(DEC_DECOMP *decomp)
Definition: decomp.c:917
static void syntaxError(SCIP *scip, REFINPUT *refinput, const char *msg)
Definition: reader_ref.c:113
static SCIP_RETCODE readBlockSizes(SCIP *scip, REFINPUT *refinput)
Definition: reader_ref.c:443
static SCIP_RETCODE readNBlocks(SCIP *scip, REFINPUT *refinput)
Definition: reader_ref.c:409
void DECdecompSetPresolved(DEC_DECOMP *decomp, SCIP_Bool presolved)
Definition: decomp.c:712
static SCIP_RETCODE readBlocks(SCIP *scip, REFINPUT *refinput)
Definition: reader_ref.c:471
SCIP_CONS *** DECdecompGetSubscipconss(DEC_DECOMP *decomp)
Definition: decomp.c:908
static SCIP_Bool isValueChar(char c, char nextc, SCIP_Bool firstchar, SCIP_Bool *hasdot, REFEXPTYPE *exptype)
Definition: reader_ref.c:170
static SCIP_RETCODE readREFFile(SCIP *scip, SCIP_READER *reader, REFINPUT *refinput, DEC_DECOMP *decomp, const char *filename)
Definition: reader_ref.c:559
GCG relaxator.
SCIP_RETCODE SCIPreadRef(SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
Definition: reader_ref.c:778
void DECdecompSetDetector(DEC_DECOMP *decomp, DEC_DETECTOR *detector)
Definition: decomp.c:1579
SCIP_RETCODE DECdecompCreate(SCIP *scip, DEC_DECOMP **decdecomp)
Definition: decomp.c:471
REF file reader for structure information.
DEC_DECOMP * DECgetBestDecomp(SCIP *scip, SCIP_Bool printwarnings)
Gets the best known decomposition.
Definition: cons_decomp.cpp:2898