file reader for variable bounds
This reader allows to read a file containing new bounds for variables of the current problem. Each line of the file should have format
<variable name> <lower bound> <upper bound>
where infinite bounds can be written as inf, +inf or -inf. Note that only a subset of the variables may appear in the file. Lines with unknown variable names are ignored. The writing functionality can be used in problem and transformed stages. Note that in transformed stage, the leading "t_" in the name of a transformed variable will not appear in the output. This way, bounds written in transformed stage can be read again in problem stage.
Definition in file reader_bnd.c.
#include <assert.h>
#include <string.h>
#include <strings.h>
#include "scip/reader_bnd.h"
#include "scip/pub_misc.h"
Go to the source code of this file.
Macros | |
#define | READER_NAME "bndreader" |
#define | READER_DESC "file reader for variable bounds" |
#define | READER_EXTENSION "bnd" |
#define | DEFAULT_IMPROVEONLY FALSE |
Functions | |
static SCIP_RETCODE | readBounds (SCIP *scip, const char *fname, SCIP_READERDATA *readerdata) |
static | SCIP_DECL_READERCOPY (readerCopyBnd) |
static | SCIP_DECL_READERREAD (readerReadBnd) |
static void | printBounds (SCIP *scip, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, SCIP_Real lb, SCIP_Real ub) |
static SCIP_RETCODE | SCIPwriteBnd (SCIP *scip, FILE *file, SCIP_VAR **vars, int nvars, SCIP_RESULT *result) |
static | SCIP_DECL_READERWRITE (readerWriteBnd) |
static | SCIP_DECL_READERFREE (readerFreeBnd) |
SCIP_RETCODE | SCIPincludeReaderBnd (SCIP *scip) |
#define READER_NAME "bndreader" |
Definition at line 46 of file reader_bnd.c.
Referenced by SCIP_DECL_READERCOPY(), SCIP_DECL_READERFREE(), SCIP_DECL_READERREAD(), SCIP_DECL_READERWRITE(), SCIPincludeReaderBnd(), and SCIPincludeReaderZpl().
#define READER_DESC "file reader for variable bounds" |
Definition at line 47 of file reader_bnd.c.
Referenced by SCIPincludeReaderBnd(), and SCIPincludeReaderZpl().
#define READER_EXTENSION "bnd" |
Definition at line 48 of file reader_bnd.c.
Referenced by SCIPincludeReaderBnd(), and SCIPincludeReaderZpl().
#define DEFAULT_IMPROVEONLY FALSE |
only use improving bounds
Definition at line 50 of file reader_bnd.c.
Referenced by SCIPincludeReaderBnd().
|
static |
reads a given bound file, problem has to be in problem stage
scip | SCIP data structure |
fname | name of the input file |
readerdata | pointer to the data of the reader |
Definition at line 66 of file reader_bnd.c.
References FALSE, MAX, MIN, NULL, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_NOFILE, SCIP_OKAY, SCIP_READERROR, SCIP_Real, SCIPchgVarLb(), SCIPchgVarUb(), SCIPerrorMessage, SCIPfclose(), SCIPfeof(), SCIPfgets(), SCIPfopen(), SCIPgetBoolParam(), SCIPinfinity(), SCIPisGT(), SCIPisLT(), SCIPparseVarName(), SCIPprintSysError(), SCIPsnprintf(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), SCIPwarningMessage(), and TRUE.
Referenced by SCIP_DECL_READERREAD().
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 227 of file reader_bnd.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderBnd(), and SCIPreaderGetName().
|
static |
problem reading method of reader
In order to determine the type of the file, we have to open it. Thus, it has to be opened twice. This might be removed, but is likely to not hurt the performance too much.
Definition at line 246 of file reader_bnd.c.
References NULL, readBounds(), READER_NAME, SCIP_CALL, SCIP_DIDNOTRUN, SCIP_OKAY, SCIP_READERROR, SCIP_STAGE_PROBLEM, SCIP_SUCCESS, SCIPerrorMessage, SCIPgetStage(), SCIPreaderGetData(), and SCIPreaderGetName().
|
static |
outputs given bounds into a file stream
scip | SCIP data structure |
messagehdlr | message handler |
file | file stream to print into, or NULL for stdout |
lb | lower bound |
ub | upper bound |
Definition at line 276 of file reader_bnd.c.
References SCIP_REAL_FORMAT, SCIPisInfinity(), and SCIPmessageFPrintInfo().
Referenced by SCIPwriteBnd().
|
static |
writes problem to file
scip | SCIP data structure |
file | file stream to print into, or NULL for stdout |
vars | array with active variables ordered binary, integer, implicit, continuous |
nvars | number of active variables in the problem |
result | pointer to store the result of the file writing call |
Definition at line 303 of file reader_bnd.c.
References NULL, printBounds(), SCIP_OKAY, SCIP_Real, SCIP_SUCCESS, SCIPgetMessagehdlr(), SCIPinfoMessage(), SCIPmessageFPrintInfo(), SCIPvarGetLbGlobal(), SCIPvarGetLbOriginal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), SCIPvarGetUbOriginal(), SCIPvarIsTransformed(), SCIPvarIsTransformedOrigvar(), and SCIPwarningMessage().
Referenced by SCIP_DECL_READERWRITE().
|
static |
problem writing method of reader
Definition at line 366 of file reader_bnd.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPreaderGetName(), and SCIPwriteBnd().
|
static |
destructor of reader to free reader data (called when SCIP is exiting)
Definition at line 378 of file reader_bnd.c.
References NULL, READER_NAME, SCIP_OKAY, SCIPfreeBlockMemory, SCIPreaderGetData(), and SCIPreaderGetName().