reader_ref.c
Go to the documentation of this file.
36/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
63};
69};
235 SCIPerrorMessage("Error: line %d exceeds %d characters\n", refinput->linenumber, REF_MAX_LINELEN-2);
240 refinput->linebuf[REF_MAX_LINELEN-2] = '\0'; /* we want to use lookahead of one char -> we need two \0 at the end */
251 *(commentstart+1) = '\0'; /* we want to use lookahead of one char -> we need two \0 at the end */
258/** reads the next token from the input file into the token buffer; returns whether a token was read */
275 SCIPswapPointers((void**)&refinput->token, (void**)&refinput->pushedtokens[refinput->npushedtokens-1]);
315 if( isValueChar(buf[refinput->linepos], buf[refinput->linepos+1], TRUE, &hasdot, &exptype) ) /*lint !e679*/
328 while( isValueChar(buf[refinput->linepos], buf[refinput->linepos+1], FALSE, &hasdot, &exptype) ); /*lint !e679*/
346 * if the token is an equality token '=' and the next character is a '<' or '>', replace the token by the inequality sense
349 && (refinput->token[tokenlen-1] == '<' || refinput->token[tokenlen-1] == '>' || refinput->token[tokenlen-1] == '=')
354 else if( refinput->token[tokenlen-1] == '=' && (buf[refinput->linepos] == '<' || buf[refinput->linepos] == '>') )
379 assert(!(SCIPstrcasecmp(refinput->token, "INFINITY") == 0) && !(SCIPstrcasecmp(refinput->token, "INF") == 0));
486 SCIPdebugMessage("Reading constraints of block %d/%d\n", refinput->blocknr + 1, refinput->nblocks);
516 SCIP_CALL( SCIPhashmapSetImage(refinput->constoblock, cons, (void*) (size_t) (refinput->blocknr+1) ) );
532 SCIP_CALL( SCIPhashmapSetImage(refinput->vartoblock, var, (void*) (size_t) (refinput->nblocks+1)) );
537 SCIP_CALL( SCIPhashmapSetImage(refinput->vartoblock, var, (void*) (size_t) (refinput->blocknr+1)) );
590 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");
628 SCIP_CALL_QUIET( GCGfilloutDecompFromHashmaps(readerdata->gcg, decomp, refinput->vartoblock, refinput->constoblock, refinput->nblocks, FALSE) );
690 SCIP_CALL( SCIPhashmapInsert(cons2origindex, cons, (void*)(size_t)(ind)) ); /* shift by 1 to enable error checking */
735 const char* filename, /**< full path and name of file to read, or NULL if stdin should be used */
761 SCIP_CALL( SCIPallocMemoryArray(scip, &refinput.pushedtokens[i], REF_MAX_LINELEN) ); /*lint !e506 !e866*/
787 SCIPdebugMessage("Read %d/%d conss in ref-file\n", refinput.totalreadconss, refinput.totalconss);
788 SCIPdebugMessage("Assigned %d variables to %d blocks.\n", refinput.nassignedvars, refinput.nblocks);
847 if( SCIPgetStage(scip) == SCIP_STAGE_INIT || SCIPgetNVars(scip) == 0 || SCIPgetNConss(scip) == 0 )
849 SCIPverbMessage(scip, SCIP_VERBLEVEL_DIALOG, NULL, "No problem exists, will not detect structure!\n");
SCIP_RETCODE GCGconshdlrDecompAddPreexistingDecomp(GCG *gcg, GCG_DECOMP *decomp)
adds a decomp that exists before the detection is called
Definition: cons_decomp.cpp:3112
GCG_DECOMP * GCGgetBestDecomp(GCG *gcg, SCIP_Bool printwarnings)
Gets the best known decomposition.
Definition: cons_decomp.cpp:2413
constraint handler for structure detection
void GCGdecompSetPresolved(GCG_DECOMP *decomp, SCIP_Bool presolved)
Definition: decomp.c:724
void GCGdecompSetDetector(GCG_DECOMP *decomp, GCG_DETECTOR *detector)
Definition: decomp.c:1605
SCIP_CONS *** GCGdecompGetSubscipconss(GCG_DECOMP *decomp)
Definition: decomp.c:924
SCIP_RETCODE GCGdecompCreate(GCG *gcg, GCG_DECOMP **decdecomp)
Definition: decomp.c:480
SCIP_RETCODE GCGfilloutDecompFromHashmaps(GCG *gcg, GCG_DECOMP *decomp, SCIP_HASHMAP *vartoblock, SCIP_HASHMAP *constoblock, int nblocks, SCIP_Bool staircase)
Definition: decomp.c:1293
void GCGdecompSetNBlocks(GCG_DECOMP *decomp, int nblocks)
Definition: decomp.c:745
int * GCGdecompGetNSubscipconss(GCG_DECOMP *decomp)
Definition: decomp.c:933
#define SCIP_Bool
#define SCIP_CALL_QUIET(x)
#define SCIP_CALL(x)
#define TRUE
#define FALSE
SCIP_FILE * SCIPfopen(const char *path, const char *mode)
int SCIPfclose(SCIP_FILE *fp)
char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
GCG interface methods.
SCIP_VAR ** SCIPgetVarsLinear(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_STAGE SCIPgetStage(SCIP *scip)
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
int SCIPgetNOrigConss(SCIP *scip)
SCIP_CONS ** SCIPgetConss(SCIP *scip)
int SCIPgetNVars(SCIP *scip)
int SCIPgetNConss(SCIP *scip)
SCIP_CONS ** SCIPgetOrigConss(SCIP *scip)
SCIP_CONS * SCIPfindCons(SCIP *scip, const char *name)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
SCIP_RETCODE SCIPhashmapSetImage(SCIP_HASHMAP *hashmap, void *origin, void *image)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
void SCIPswapPointers(void **pointer1, void **pointer2)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
const char * SCIPconsGetName(SCIP_CONS *cons)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
#define SCIPallocMemoryArray(scip, ptr, num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPallocMemory(scip, ptr)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPfreeMemoryArray(scip, ptr)
#define SCIPfreeMemory(scip, ptr)
SCIP_RETCODE SCIPincludeReader(SCIP *scip, const char *name, const char *desc, const char *extension, SCIP_DECL_READERCOPY((*readercopy)), SCIP_DECL_READERFREE((*readerfree)), SCIP_DECL_READERREAD((*readerread)), SCIP_DECL_READERWRITE((*readerwrite)), SCIP_READERDATA *readerdata)
SCIP_READERDATA * SCIPreaderGetData(SCIP_READER *reader)
SCIP_RETCODE SCIPtransformProb(SCIP *scip)
const char * SCIPvarGetName(SCIP_VAR *var)
int SCIPstrcasecmp(const char *s1, const char *s2)
int SCIPsnprintf(char *t, int len, const char *s,...)
void SCIPprintSysError(const char *message)
#define NULL
#define BMSclearMemoryArray(ptr, num)
Definition: class_conspartition.cpp:44
struct SCIP_File SCIP_FILE
#define SCIPerrorMessage
#define SCIPdebugMessage
static SCIP_RETCODE readNBlocks(SCIP *scip, REFINPUT *refinput)
Definition: reader_ref.c:411
static SCIP_RETCODE writeREFFile(SCIP *scip, SCIP_READER *reader, FILE *file)
Definition: reader_ref.c:638
static void syntaxError(SCIP *scip, REFINPUT *refinput, const char *msg)
Definition: reader_ref.c:115
static SCIP_RETCODE readRef(SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result)
Definition: reader_ref.c:732
static SCIP_RETCODE readBlockSizes(SCIP *scip, REFINPUT *refinput)
Definition: reader_ref.c:445
static SCIP_RETCODE readREFFile(SCIP *scip, SCIP_READER *reader, REFINPUT *refinput, GCG_DECOMP *decomp, const char *filename)
Definition: reader_ref.c:561
static SCIP_RETCODE readBlocks(SCIP *scip, REFINPUT *refinput)
Definition: reader_ref.c:473
static SCIP_Bool isValueChar(char c, char nextc, SCIP_Bool firstchar, SCIP_Bool *hasdot, REFEXPTYPE *exptype)
Definition: reader_ref.c:172
REF file reader for structure information.
GCG relaxator.
Definition: struct_decomp.h:53
Definition: struct_gcg.h:55
Definition: reader_ref.c:75
Definition: reader_blk.cpp:112
SCIP_VERBLEVEL_DIALOG
SCIP_VERBLEVEL_MINIMAL
SCIP_SUCCESS
enum SCIP_Result SCIP_RESULT
SCIP_NOFILE
SCIP_READERROR
SCIP_INVALIDDATA
SCIP_OKAY
enum SCIP_Retcode SCIP_RETCODE
SCIP_STAGE_TRANSFORMED
SCIP_STAGE_INIT
SCIP_STAGE_PRESOLVED