Detailed Description
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 "scip/pub_fileio.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/pub_reader.h"
#include "scip/pub_var.h"
#include "scip/reader_bnd.h"
#include "scip/scip_general.h"
#include "scip/scip_mem.h"
#include "scip/scip_message.h"
#include "scip/scip_numerics.h"
#include "scip/scip_param.h"
#include "scip/scip_reader.h"
#include "scip/scip_var.h"
#include <string.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) |
Macro Definition Documentation
◆ READER_NAME
#define READER_NAME "bndreader" |
Definition at line 61 of file reader_bnd.c.
◆ READER_DESC
#define READER_DESC "file reader for variable bounds" |
Definition at line 62 of file reader_bnd.c.
◆ READER_EXTENSION
#define READER_EXTENSION "bnd" |
Definition at line 63 of file reader_bnd.c.
◆ DEFAULT_IMPROVEONLY
#define DEFAULT_IMPROVEONLY FALSE |
only use improving bounds
Definition at line 65 of file reader_bnd.c.
Function Documentation
◆ readBounds()
|
static |
reads a given bound file, problem has to be in problem stage
- Parameters
-
scip SCIP data structure fname name of the input file readerdata pointer to the data of the reader
Definition at line 81 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(), SCIPstrncasecmp(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), SCIPwarningMessage(), and TRUE.
Referenced by SCIP_DECL_READERREAD().
◆ SCIP_DECL_READERCOPY()
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 263 of file reader_bnd.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderBnd(), and SCIPreaderGetName().
◆ SCIP_DECL_READERREAD()
|
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 282 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().
◆ printBounds()
|
static |
outputs given bounds into a file stream
- Parameters
-
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 312 of file reader_bnd.c.
References SCIP_REAL_FORMAT, SCIPisInfinity(), and SCIPmessageFPrintInfo().
Referenced by SCIPwriteBnd().
◆ SCIPwriteBnd()
|
static |
writes problem to file
- Parameters
-
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 339 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().
◆ SCIP_DECL_READERWRITE()
|
static |
problem writing method of reader
Definition at line 402 of file reader_bnd.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPreaderGetName(), and SCIPwriteBnd().
◆ SCIP_DECL_READERFREE()
|
static |
destructor of reader to free reader data (called when SCIP is exiting)
Definition at line 414 of file reader_bnd.c.
References NULL, READER_NAME, SCIP_OKAY, SCIPfreeBlockMemory, SCIPreaderGetData(), and SCIPreaderGetName().