38 #if defined(_WIN32) || defined(_WIN64) 46 #define READER_NAME "bndreader" 47 #define READER_DESC "file reader for variable bounds" 48 #define READER_EXTENSION "bnd" 50 #define DEFAULT_IMPROVEONLY FALSE 54 struct SCIP_ReaderData
79 assert(fname !=
NULL);
85 SCIPerrorMessage(
"Cannot read bounds file if vartable is disabled. Make sure parameter 'misc/usevartable' is set to TRUE.\n");
100 unknownvariablemessage =
FALSE;
122 (void) sscanf(buffer, format, varname, lbstring, ubstring);
127 nread = sscanf(endptr,
"%s %s\n", lbstring, ubstring);
130 SCIPerrorMessage(
"invalid input line %d in bounds file <%s>: <%s>\n", lineno, fname, buffer);
137 if( !unknownvariablemessage )
139 SCIPwarningMessage(scip,
"unable to parse variable name in line %d of bounds file <%s>:\n", lineno, fname);
142 unknownvariablemessage =
TRUE;
148 if( strncasecmp(lbstring,
"inv", 3) == 0 )
150 else if( strncasecmp(lbstring,
"+inf", 4) == 0 || strncasecmp(lbstring,
"inf", 3) == 0 )
152 else if( strncasecmp(lbstring,
"-inf", 4) == 0 )
156 nread = sscanf(lbstring,
"%lf", &lb);
159 SCIPerrorMessage(
"invalid lower bound value <%s> for variable <%s> in line %d of bounds file <%s>\n",
160 lbstring, varname, lineno, fname);
167 if( strncasecmp(ubstring,
"inv", 3) == 0 )
169 else if( strncasecmp(ubstring,
"+inf", 4) == 0 || strncasecmp(ubstring,
"inf", 3) == 0 )
171 else if( strncasecmp(ubstring,
"-inf", 4) == 0 )
175 nread = sscanf(ubstring,
"%lf", &ub);
178 SCIPerrorMessage(
"invalid lower bound value <%s> for variable <%s> in line %d of bounds file <%s>\n",
179 ubstring, varname, lineno, fname);
185 if( readerdata->improveonly )
189 SCIPwarningMessage(scip,
"not applying lower bound value %s for variable <%s> in line %d of bounds file %s," 190 " because it does not improve existing bound of %f\n",
195 SCIPwarningMessage(scip,
"not applying upper bound value %s for variable <%s> in line %d of bounds file %s, " 196 "because it does not improve existing bound of %f\n",
230 assert(reader !=
NULL);
248 assert(reader !=
NULL);
250 assert(result !=
NULL);
256 SCIPerrorMessage(
"reading of bounds file is only possible after a problem was created\n");
262 SCIPerrorMessage(
"reading of bounds file is only possible during problem creation stage\n");
316 assert(result !=
NULL);
327 for( i = 0; i < nvars; ++i )
333 assert( var !=
NULL );
339 varname = varname + 2;
368 assert(reader !=
NULL);
384 assert(readerdata !=
NULL);
416 "reading/bndreader/improveonly",
"only use improving bounds",
enum SCIP_Result SCIP_RESULT
SCIP_STAGE SCIPgetStage(SCIP *scip)
static SCIP_DECL_READERCOPY(readerCopyBnd)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
const char * SCIPreaderGetName(SCIP_READER *reader)
SCIP_RETCODE SCIPparseVarName(SCIP *scip, const char *str, SCIP_VAR **var, char **endptr)
static SCIP_RETCODE readBounds(SCIP *scip, const char *fname, SCIP_READERDATA *readerdata)
SCIP_RETCODE SCIPincludeReaderBnd(SCIP *scip)
SCIP_Real SCIPinfinity(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
enum SCIP_Retcode SCIP_RETCODE
#define SCIPfreeBlockMemory(scip, ptr)
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
SCIP_RETCODE SCIPchgVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
#define SCIPallocBlockMemory(scip, ptr)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
file reader for variable bounds
static void printBounds(SCIP *scip, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, SCIP_Real lb, SCIP_Real ub)
SCIP_FILE * SCIPfopen(const char *path, const char *mode)
SCIP_READERDATA * SCIPreaderGetData(SCIP_READER *reader)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbOriginal(SCIP_VAR *var)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPvarGetUbOriginal(SCIP_VAR *var)
SCIP_Bool SCIPvarIsTransformedOrigvar(SCIP_VAR *var)
int SCIPfeof(SCIP_FILE *stream)
struct SCIP_File SCIP_FILE
char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
SCIP_RETCODE SCIPchgVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
static SCIP_RETCODE SCIPwriteBnd(SCIP *scip, FILE *file, SCIP_VAR **vars, int nvars, SCIP_RESULT *result)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
#define DEFAULT_IMPROVEONLY
struct SCIP_ReaderData SCIP_READERDATA
public data structures and miscellaneous methods
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
void SCIPprintSysError(const char *message)
SCIP_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERWRITE((*readerwrite)))
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERCOPY((*readercopy)))
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_DECL_READERFREE(readerFreeBnd)
void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
static SCIP_DECL_READERREAD(readerReadBnd)
SCIP_RETCODE SCIPsetReaderRead(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERREAD((*readerread)))
SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
int SCIPfclose(SCIP_FILE *fp)
SCIP_RETCODE SCIPsetReaderFree(SCIP *scip, SCIP_READER *reader, SCIP_DECL_READERFREE((*readerfree)))
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
static SCIP_DECL_READERWRITE(readerWriteBnd)