Loading...
Searching...
No Matches
reader_blk.cpp
Go to the documentation of this file.
36 * The structure is defined variable-wise, i.e., the number of blocks and the variables belonging to each block are
37 * defined. Afterwards, each constraint that has only variables of one block is added to that block,
38 * constraints having variables of more than one block go into the master. If needed, constraints can also be
42 * - Presolved: to be followed by either 0 or 1 indicating that the decomposition is for the presolved or unpresolved problem
44 * - Block i with 1 <= i <= nblocks: to be followed by the names of the variables belonging to block i, one per line.
45 * - Masterconss: to be followed by names of constraints, one per line, that should go into the master,
49/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
260 SCIPerrorMessage("Error: line %d exceeds %d characters\n", blkinput->linenumber, BLK_MAX_LINELEN-2);
265 blkinput->linebuf[BLK_MAX_LINELEN-2] = '\0'; /* we want to use lookahead of one char -> we need two \0 at the end */
297/** reads the next token from the input file into the token buffer; returns whether a token was read */
343 if( isValueChar(buf[blkinput->linepos], buf[blkinput->linepos+1], TRUE, &hasdot, &exptype) ) /*lint !e679*/
356 while( isValueChar(buf[blkinput->linepos], buf[blkinput->linepos+1], FALSE, &hasdot, &exptype) ); /*lint !e679*/
374 * if the token is an equality token '=' and the next character is a '<' or '>', replace the token by the inequality sense
377 && (blkinput->token[tokenlen-1] == '<' || blkinput->token[tokenlen-1] == '>' || blkinput->token[tokenlen-1] == '=')
396/** puts the current token on the token stack, such that it is read at the next call to getNextToken() */
433 assert(!(SCIPstrcasecmp(blkinput->token, "INFINITY") == 0) && !(SCIPstrcasecmp(blkinput->token, "INF") == 0));
448/** checks whether the current token is a section identifier, and if yes, switches to the corresponding section */
682 /* variable was assigned to another (non-linking) block before, so it becomes a linking variable, now */
686 SCIPdebugMessage("\tVar %s is linking (old %d != %d new).\n", SCIPvarGetName(var), oldblock, blockid);
690 /* decrease the number of variables in the old block and increase the number of linking variables */
696 SCIP_CALL( SCIPallocMemoryArray(scip, &readerdata->linkingvarsblocks[varidx], 2) ); /*lint !e506 !e866*/
709 SCIP_CALL( SCIPreallocMemoryArray(scip, &readerdata->linkingvarsblocks[varidx], (size_t) readerdata->nlinkingvarsblocks[varidx] + 1) ); /*lint !e866*/
748 SCIP_CALL( SCIPhashmapSetImage(readerdata->constoblock, cons, (void*) (size_t) (blkinput->nblocks +1)) );
839 /* if a contained variable is directly transferred to the master, the constraint is a linking constraint */
846 if( blocknr == -1 && readerdata->varstoblock[SCIPvarGetProbindex(consvars[j])] != LINKINGVALUE )
905 retcode = GCGfilloutDecompFromConstoblock(readerdata->gcg, decomp, constoblock, nblocks, FALSE);
995 // SCIPverbMessage(scip, SCIP_VERBLEVEL_MINIMAL, NULL, "decomposition belongs to the presolved problem, please presolve the problem first.\n");
1006 if( blkinput->haspresolvesection && !blkinput->presolved && SCIPgetStage(scip) >= SCIP_STAGE_PRESOLVED )
1008 SCIPverbMessage(scip, SCIP_VERBLEVEL_MINIMAL, NULL, "decomposition belongs to the original problem, please re-read the problem and read the decomposition without presolving.\n");
1013 SCIPwarningMessage(scip, "decomposition has no presolve section at beginning. It is assumed to belong to the unpresolved problem but the behaviour is undefined. See the FAQ for further information.\n");
1096 const char* filename, /**< full path and name of file to read, or NULL if stdin should be used */
1127 SCIP_CALL( SCIPallocMemoryArray(scip, &blkinput.pushedtokens[i], BLK_MAX_LINELEN) ); /*lint !e506 !e866*/
1187 if( SCIPgetStage(scip) == SCIP_STAGE_INIT || SCIPgetNVars(scip) == 0 || SCIPgetNConss(scip) == 0 )
1189 SCIPverbMessage(scip, SCIP_VERBLEVEL_DIALOG, NULL, "Please read in a problem before reading in the corresponding structure file!\n");
SCIP_DECL_READERREAD(ReaderTSP::scip_read)
SCIP_DECL_READERWRITE(ReaderTSP::scip_write)
SCIP_DECL_READERFREE(ReaderTSP::scip_free)
class storing (potentially incomplete) decompositions
GCG_EXPORT bool fixVarToMasterByName(const char *varname)
assigns a variable with given name as master
Definition class_partialdecomp.cpp:5687
GCG_EXPORT bool fixConsToMasterByName(const char *consname)
assgins a constraint by name as master
Definition class_partialdecomp.cpp:5673
GCG_EXPORT bool fixConsToBlockByName(const char *consname, int blockid)
assigns a constraint by name to a block
Definition class_partialdecomp.cpp:5639
GCG_EXPORT void setNBlocks(int nblocks)
sets number of blocks, only increasing number allowed
Definition class_partialdecomp.cpp:5350
GCG_EXPORT bool fixVarToLinkingByName(const char *varname)
assigns a variable by name to the linking variables
Definition class_partialdecomp.cpp:5701
GCG_EXPORT bool fixVarToBlockByName(const char *varname, int blockid)
assigns a variable by name to a block
Definition class_partialdecomp.cpp:5655
GCG_EXPORT void setUsergiven(USERGIVEN usergiven)
sets whether this partialdec is user given
Definition class_partialdecomp.cpp:5411
SCIP_RETCODE GCGconshdlrDecompAddPreexisitingPartialDec(GCG *gcg, PARTIALDECOMP *partialdec)
adds a preexisting partial dec to be considered at the beginning of the detection
Definition cons_decomp.cpp:3133
constraint handler for structure detection
C++ interface of cons_decomp.
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_RETCODE GCGdecompSetType(GCG_DECOMP *decomp, GCG_DECTYPE type)
Definition decomp.c:659
SCIP_RETCODE GCGfilloutDecompFromConstoblock(GCG *gcg, GCG_DECOMP *decomp, SCIP_HASHMAP *constoblock, int nblocks, SCIP_Bool staircase)
Definition decomp.c:1479
SCIP_RETCODE GCGdecompCreate(GCG *gcg, GCG_DECOMP **decdecomp)
Definition decomp.c:480
#define SCIP_MAXSTRLEN
#define SCIP_Bool
#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)
void SCIPsplitFilename(char *filename, char **path, char **name, char **extension, char **compression)
SCIP_STAGE SCIPgetStage(SCIP *scip)
SCIP_CONS ** SCIPgetConss(SCIP *scip)
int SCIPgetNVars(SCIP *scip)
int SCIPgetNConss(SCIP *scip)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
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_RETCODE GCGconsGetVars(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int nvars)
Definition scip_misc.c:487
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,...)
const char * SCIPconsGetName(SCIP_CONS *cons)
#define SCIPreallocMemoryArray(scip, ptr, newnum)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
#define SCIPallocMemoryArray(scip, ptr, num)
#define SCIPallocMemory(scip, ptr)
#define SCIPfreeMemoryArray(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_READER * SCIPfindReader(SCIP *scip, const char *name)
SCIP_RETCODE SCIPtransformProb(SCIP *scip)
SCIP_RETCODE SCIPpresolve(SCIP *scip)
int SCIPvarGetProbindex(SCIP_VAR *var)
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)
SCIPfreeMemory(GCGgetOrigprob(gcg), &divingdata)
static assert(heur !=NULL)
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
SCIPdebugMessage("feasibility pump finished [%d iterations done].\n", nloops)
#define NULL
#define BMSclearMemoryArray(ptr, num)
Definition class_conspartition.cpp:44
public methods for working with decomposition structures
struct SCIP_File SCIP_FILE
public methods for GCG variables
#define SCIPerrorMessage
static SCIP_RETCODE readBLKFile(SCIP *scip, SCIP_READER *reader, BLKINPUT *blkinput, const char *filename)
Definition reader_blk.cpp:913
static void syntaxError(SCIP *scip, BLKINPUT *blkinput, const char *msg)
Definition reader_blk.cpp:140
static SCIP_RETCODE readBlock(SCIP *scip, BLKINPUT *blkinput, gcg::PARTIALDECOMP *partialdec, SCIP_READERDATA *readerdata)
Definition reader_blk.cpp:639
static SCIP_RETCODE fillDecompStruct(SCIP *scip, BLKINPUT *blkinput, GCG_DECOMP *decomp, gcg::PARTIALDECOMP *partialdec, SCIP_READERDATA *readerdata)
Definition reader_blk.cpp:758
static SCIP_RETCODE readPresolved(SCIP *scip, BLKINPUT *blkinput)
Definition reader_blk.cpp:561
static SCIP_RETCODE readMasterconss(SCIP *scip, BLKINPUT *blkinput, gcg::PARTIALDECOMP *partialdec, SCIP_READERDATA *readerdata)
Definition reader_blk.cpp:720
static SCIP_Bool isInt(SCIP *scip, BLKINPUT *blkinput, int *value)
Definition reader_blk.cpp:422
static SCIP_Bool isValueChar(char c, char nextc, SCIP_Bool firstchar, SCIP_Bool *hasdot, BLKEXPTYPE *exptype)
Definition reader_blk.cpp:197
static SCIP_RETCODE readNBlocks(SCIP *scip, gcg::PARTIALDECOMP *partialdec, BLKINPUT *blkinput)
Definition reader_blk.cpp:597
static SCIP_RETCODE readBlk(SCIP *scip, const char *filename, SCIP_RESULT *result)
Definition reader_blk.cpp:1094
static SCIP_Bool isNewSection(SCIP *scip, BLKINPUT *blkinput)
Definition reader_blk.cpp:450
BLK file reader for structure information.
GCG relaxator.
various SCIP helper methods
Definition reader_blk.cpp:92
Definition reader_blk.cpp:112
struct SCIP_Cons SCIP_CONS
SCIP_VERBLEVEL_DIALOG
SCIP_VERBLEVEL_MINIMAL
struct SCIP_HashMap SCIP_HASHMAP
struct SCIP_ReaderData SCIP_READERDATA
struct SCIP_Reader SCIP_READER
SCIP_SUCCESS
enum SCIP_Result SCIP_RESULT
SCIP_NOFILE
SCIP_READERROR
SCIP_INVALIDDATA
SCIP_ERROR
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
SCIP_STAGE_TRANSFORMED
SCIP_STAGE_INIT
SCIP_STAGE_PRESOLVED
struct SCIP_Var SCIP_VAR