Detailed Description
LP file reader.
Definition in file reader_lp.c.
#include "blockmemshell/memory.h"
#include <ctype.h>
#include "scip/cons_and.h"
#include "scip/cons_bounddisjunction.h"
#include "scip/cons_indicator.h"
#include "scip/cons_knapsack.h"
#include "scip/cons_linear.h"
#include "scip/cons_logicor.h"
#include "scip/cons_quadratic.h"
#include "scip/cons_setppc.h"
#include "scip/cons_soc.h"
#include "scip/cons_sos1.h"
#include "scip/cons_sos2.h"
#include "scip/cons_varbound.h"
#include "scip/pub_cons.h"
#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_lp.h"
#include "scip/scip_cons.h"
#include "scip/scip_mem.h"
#include "scip/scip_message.h"
#include "scip/scip_numerics.h"
#include "scip/scip_param.h"
#include "scip/scip_prob.h"
#include "scip/scip_reader.h"
#include "scip/scip_var.h"
#include <stdlib.h>
#include <string.h>
#include <strings.h>
Go to the source code of this file.
Macros | |
#define | READER_NAME "lpreader" |
#define | READER_DESC "file reader for MIPs in IBM CPLEX's LP file format" |
#define | READER_EXTENSION "lp" |
#define | DEFAULT_LINEARIZE_ANDS TRUE |
#define | DEFAULT_AGGRLINEARIZATION_ANDS TRUE |
#define | LP_MAX_LINELEN 65536 |
#define | LP_MAX_PUSHEDTOKENS 2 |
#define | LP_INIT_COEFSSIZE 8192 |
#define | LP_INIT_QUADCOEFSSIZE 16 |
#define | LP_MAX_PRINTLEN 561 |
#define | LP_MAX_NAMELEN 256 |
#define | LP_PRINTLEN 100 |
Typedefs | |
typedef enum LpSection | LPSECTION |
typedef enum LpExpType | LPEXPTYPE |
typedef enum LpSense | LPSENSE |
typedef struct LpInput | LPINPUT |
Enumerations | |
enum | LpSection { LP_START, LP_OBJECTIVE, LP_END, LP_START, LP_OBJECTIVE, LP_CONSTRAINTS, LP_BOUNDS, LP_GENERALS, LP_BINARIES, LP_SEMICONTINUOUS, LP_SOS, LP_END } |
enum | LpExpType { LP_EXP_NONE, LP_EXP_UNSIGNED, LP_EXP_SIGNED, LP_EXP_NONE, LP_EXP_UNSIGNED, LP_EXP_SIGNED } |
enum | LpSense { LP_SENSE_LE, LP_SENSE_GE, LP_SENSE_EQ, LP_SENSE_NOTHING, LP_SENSE_LE, LP_SENSE_GE, LP_SENSE_EQ } |
Functions | |
static void | syntaxError (SCIP *scip, LPINPUT *lpinput, const char *msg) |
static SCIP_Bool | hasError (LPINPUT *lpinput) |
static SCIP_Bool | isDelimChar (char c) |
static SCIP_Bool | isTokenChar (char c) |
static SCIP_Bool | isValueChar (char c, char nextc, SCIP_Bool firstchar, SCIP_Bool *hasdot, LPEXPTYPE *exptype) |
static SCIP_Bool | getNextLine (SCIP *scip, LPINPUT *lpinput) |
static void | swapPointers (char **pointer1, char **pointer2) |
static SCIP_Bool | getNextToken (SCIP *scip, LPINPUT *lpinput) |
static void | pushToken (LPINPUT *lpinput) |
static void | pushBufferToken (LPINPUT *lpinput) |
static void | swapTokenBuffer (LPINPUT *lpinput) |
static SCIP_Bool | isNewSection (SCIP *scip, LPINPUT *lpinput) |
static SCIP_Bool | isSign (LPINPUT *lpinput, int *sign) |
static SCIP_Bool | isValue (SCIP *scip, LPINPUT *lpinput, SCIP_Real *value) |
static SCIP_Bool | isSense (LPINPUT *lpinput, LPSENSE *sense) |
static SCIP_RETCODE | getVariable (SCIP *scip, char *name, SCIP_VAR **var, SCIP_Bool *created) |
static SCIP_RETCODE | readStart (SCIP *scip, LPINPUT *lpinput) |
static SCIP_RETCODE | readCoefficients (SCIP *scip, LPINPUT *lpinput, SCIP_Bool isobjective, char *name, int *coefssize, SCIP_VAR ***vars, SCIP_Real **coefs, int *ncoefs, int *quadcoefssize, SCIP_VAR ***quadvars1, SCIP_VAR ***quadvars2, SCIP_Real **quadcoefs, int *nquadcoefs, SCIP_Real *objoffset, SCIP_Bool *newsection) |
static SCIP_RETCODE | readObjective (SCIP *scip, LPINPUT *lpinput) |
static SCIP_RETCODE | createIndicatorConstraint (SCIP *scip, LPINPUT *lpinput, const char *name, SCIP_VAR *binvar, SCIP_Real binvalue) |
static SCIP_RETCODE | readConstraints (SCIP *scip, LPINPUT *lpinput) |
static SCIP_RETCODE | readBounds (SCIP *scip, LPINPUT *lpinput) |
static SCIP_RETCODE | readGenerals (SCIP *scip, LPINPUT *lpinput) |
static SCIP_RETCODE | readBinaries (SCIP *scip, LPINPUT *lpinput) |
static SCIP_RETCODE | readSemicontinuous (SCIP *scip, LPINPUT *lpinput) |
static SCIP_RETCODE | readSos (SCIP *scip, LPINPUT *lpinput) |
static SCIP_RETCODE | readLPFile (SCIP *scip, LPINPUT *lpinput, const char *filename) |
static | SCIP_DECL_HASHGETKEY (hashGetKeyVar) |
static | SCIP_DECL_HASHKEYEQ (hashKeyEqVar) |
static | SCIP_DECL_HASHKEYVAL (hashKeyValVar) |
static SCIP_RETCODE | getActiveVariables (SCIP *scip, SCIP_VAR ***vars, SCIP_Real **scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed) |
static void | clearLine (char *linebuffer, int *linecnt) |
static void | endLine (SCIP *scip, FILE *file, char *linebuffer, int *linecnt) |
static void | appendLine (SCIP *scip, FILE *file, char *linebuffer, int *linecnt, const char *extension) |
static void | printRow (SCIP *scip, FILE *file, const char *rowname, const char *rownameextension, const char *type, SCIP_VAR **linvars, SCIP_Real *linvals, int nlinvars, SCIP_QUADVARTERM *quadvarterms, int nquadvarterms, SCIP_BILINTERM *bilinterms, int nbilinterms, SCIP_Real rhs) |
static SCIP_RETCODE | printQuadraticCons (SCIP *scip, FILE *file, const char *rowname, SCIP_VAR **linvars, SCIP_Real *linvals, int nlinvars, SCIP_QUADVARTERM *quadvarterms, int nquadvarterms, SCIP_BILINTERM *bilinterms, int nbilinterms, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool transformed) |
static void | printSosCons (SCIP *scip, FILE *file, const char *rowname, SCIP_VAR **vars, SCIP_Real *weights, int nvars, int type) |
static SCIP_RETCODE | printSOCCons (SCIP *scip, FILE *file, const char *rowname, SCIP_CONS *cons) |
static SCIP_RETCODE | printAndCons (SCIP *scip, FILE *file, const char *consname, SCIP_CONS *cons, SCIP_Bool aggrlinearizationands, SCIP_Bool transformed) |
static SCIP_RETCODE | collectAggregatedVars (SCIP *scip, SCIP_VAR **vars, int nvars, SCIP_VAR ***aggvars, int *naggvars, int *saggvars, SCIP_HASHTABLE *varAggregated) |
static SCIP_RETCODE | printAggregatedCons (SCIP *scip, FILE *file, SCIP_Bool transformed, int nvars, int nAggregatedVars, SCIP_VAR **aggregatedVars) |
static void | checkVarnames (SCIP *scip, SCIP_VAR **vars, int nvars) |
static void | checkConsnames (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool transformed) |
static | SCIP_DECL_READERCOPY (readerCopyLp) |
static | SCIP_DECL_READERFREE (readerFreeLp) |
static | SCIP_DECL_READERREAD (readerReadLp) |
static | SCIP_DECL_READERWRITE (readerWriteLp) |
SCIP_RETCODE | SCIPincludeReaderLp (SCIP *scip) |
SCIP_RETCODE | SCIPreadLp (SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result) |
SCIP_RETCODE | SCIPwriteLp (SCIP *scip, FILE *file, const char *name, SCIP_Bool transformed, SCIP_OBJSENSE objsense, SCIP_Real objscale, SCIP_Real objoffset, SCIP_VAR **vars, int nvars, int nbinvars, int nintvars, int nimplvars, int ncontvars, SCIP_CONS **conss, int nconss, SCIP_RESULT *result) |
Variables | |
static const char | commentchars [] = "\\" |
Macro Definition Documentation
◆ READER_NAME
#define READER_NAME "lpreader" |
Definition at line 68 of file reader_lp.c.
Referenced by SCIP_DECL_READERCOPY(), SCIP_DECL_READERFREE(), SCIP_DECL_READERWRITE(), SCIPincludeReaderLp(), and SCIPwriteLp().
◆ READER_DESC
#define READER_DESC "file reader for MIPs in IBM CPLEX's LP file format" |
Definition at line 69 of file reader_lp.c.
Referenced by SCIPincludeReaderLp().
◆ READER_EXTENSION
#define READER_EXTENSION "lp" |
Definition at line 70 of file reader_lp.c.
Referenced by SCIPincludeReaderLp().
◆ DEFAULT_LINEARIZE_ANDS
#define DEFAULT_LINEARIZE_ANDS TRUE |
Should possible "and"-constraints be linearized when writing the lp file?
Definition at line 72 of file reader_lp.c.
Referenced by SCIPincludeReaderLp(), and SCIPwriteLp().
◆ DEFAULT_AGGRLINEARIZATION_ANDS
#define DEFAULT_AGGRLINEARIZATION_ANDS TRUE |
Should an aggregated linearization for and constraints be used?
Definition at line 73 of file reader_lp.c.
Referenced by SCIPincludeReaderLp(), and SCIPwriteLp().
◆ LP_MAX_LINELEN
#define LP_MAX_LINELEN 65536 |
Definition at line 79 of file reader_lp.c.
Referenced by createIndicatorConstraint(), getNextLine(), getNextToken(), isNewSection(), readCoefficients(), readConstraints(), readObjective(), and SCIPreadLp().
◆ LP_MAX_PUSHEDTOKENS
#define LP_MAX_PUSHEDTOKENS 2 |
Definition at line 80 of file reader_lp.c.
Referenced by pushBufferToken(), pushToken(), and SCIPreadLp().
◆ LP_INIT_COEFSSIZE
#define LP_INIT_COEFSSIZE 8192 |
Definition at line 81 of file reader_lp.c.
Referenced by readCoefficients().
◆ LP_INIT_QUADCOEFSSIZE
#define LP_INIT_QUADCOEFSSIZE 16 |
Definition at line 82 of file reader_lp.c.
Referenced by readCoefficients().
◆ LP_MAX_PRINTLEN
#define LP_MAX_PRINTLEN 561 |
the maximum length of any line is 560 + '\0' = 561
Definition at line 83 of file reader_lp.c.
Referenced by appendLine(), endLine(), printRow(), printSOCCons(), printSosCons(), and SCIPwriteLp().
◆ LP_MAX_NAMELEN
#define LP_MAX_NAMELEN 256 |
the maximum length for any name is 255 + '\0' = 256
Definition at line 84 of file reader_lp.c.
Referenced by checkConsnames(), checkVarnames(), printAggregatedCons(), printAndCons(), printRow(), printSOCCons(), printSosCons(), and SCIPwriteLp().
◆ LP_PRINTLEN
#define LP_PRINTLEN 100 |
Definition at line 85 of file reader_lp.c.
Referenced by appendLine().
Typedef Documentation
◆ LPSECTION
Definition at line 101 of file reader_lp.c.
◆ LPEXPTYPE
Definition at line 107 of file reader_lp.c.
◆ LPSENSE
Definition at line 113 of file reader_lp.c.
◆ LPINPUT
typedef struct LpInput LPINPUT |
Definition at line 140 of file reader_lp.c.
Enumeration Type Documentation
◆ LpSection
enum LpSection |
Section in LP File
Enumerator | |
---|---|
LP_START | |
LP_OBJECTIVE | |
LP_END | |
LP_START | |
LP_OBJECTIVE | |
LP_CONSTRAINTS | |
LP_BOUNDS | |
LP_GENERALS | |
LP_BINARIES | |
LP_SEMICONTINUOUS | |
LP_SOS | |
LP_END |
Definition at line 97 of file reader_lp.c.
◆ LpExpType
enum LpExpType |
Enumerator | |
---|---|
LP_EXP_NONE | |
LP_EXP_UNSIGNED | |
LP_EXP_SIGNED | |
LP_EXP_NONE | |
LP_EXP_UNSIGNED | |
LP_EXP_SIGNED |
Definition at line 103 of file reader_lp.c.
◆ LpSense
enum LpSense |
Enumerator | |
---|---|
LP_SENSE_LE | |
LP_SENSE_GE | |
LP_SENSE_EQ | |
LP_SENSE_NOTHING | |
LP_SENSE_LE | |
LP_SENSE_GE | |
LP_SENSE_EQ |
Definition at line 109 of file reader_lp.c.
Function Documentation
◆ syntaxError()
issues an error message and marks the LP data to have errors
- Parameters
-
scip SCIP data structure lpinput LP reading data msg error message
Definition at line 151 of file reader_lp.c.
References LP_END, NULL, SCIP_VERBLEVEL_MINIMAL, SCIPerrorMessage, SCIPsnprintf(), SCIPverbMessage(), and TRUE.
Referenced by createIndicatorConstraint(), readBinaries(), readBounds(), readCoefficients(), readConstraints(), readGenerals(), readSemicontinuous(), and readSos().
◆ hasError()
returns whether a syntax error was detected
- Parameters
-
lpinput LP reading data
Definition at line 178 of file reader_lp.c.
References NULL.
Referenced by createIndicatorConstraint(), readConstraints(), readLPFile(), and readObjective().
◆ isDelimChar()
|
static |
returns whether the given character is a token delimiter
- Parameters
-
c input character
Definition at line 189 of file reader_lp.c.
Referenced by getNextToken().
◆ isTokenChar()
|
static |
returns whether the given character is a single token
- Parameters
-
c input character
Definition at line 210 of file reader_lp.c.
Referenced by getNextToken().
◆ isValueChar()
|
static |
returns whether the current character is member of a value string
- Parameters
-
c input character nextc next input character firstchar is the given character the first char of the token? hasdot pointer to update the dot flag exptype pointer to update the exponent type
Definition at line 234 of file reader_lp.c.
References FALSE, LP_EXP_NONE, LP_EXP_SIGNED, LP_EXP_UNSIGNED, NULL, and TRUE.
Referenced by getNextToken().
◆ getNextLine()
reads the next line from the input file into the line buffer; skips comments; returns whether a line could be read
- Parameters
-
scip SCIP data structure lpinput LP reading data
Definition at line 278 of file reader_lp.c.
References BMSclearMemoryArray, commentchars, FALSE, LP_MAX_LINELEN, NULL, SCIPdebugMsg, SCIPfgets(), SCIPfseek(), SCIPwarningMessage(), and TRUE.
Referenced by getNextToken().
◆ swapPointers()
|
static |
swaps the addresses of two pointers
- Parameters
-
pointer1 first pointer pointer2 second pointer
Definition at line 369 of file reader_lp.c.
Referenced by getNextToken(), pushBufferToken(), pushToken(), and swapTokenBuffer().
◆ getNextToken()
reads the next token from the input file into the token buffer; returns whether a token was read
- Parameters
-
scip SCIP data structure lpinput LP reading data
Definition at line 383 of file reader_lp.c.
References FALSE, getNextLine(), isDelimChar(), isTokenChar(), isValueChar(), LP_END, LP_EXP_NONE, LP_MAX_LINELEN, NULL, SCIP_Bool, SCIPdebugMsg, swapPointers(), and TRUE.
Referenced by createIndicatorConstraint(), isNewSection(), readBinaries(), readBounds(), readCoefficients(), readConstraints(), readGenerals(), readSemicontinuous(), readSos(), and readStart().
◆ pushToken()
|
static |
puts the current token on the token stack, such that it is read at the next call to getNextToken()
- Parameters
-
lpinput LP reading data
Definition at line 488 of file reader_lp.c.
References LP_MAX_PUSHEDTOKENS, NULL, and swapPointers().
Referenced by isNewSection(), readBounds(), readCoefficients(), readConstraints(), readSemicontinuous(), and readSos().
◆ pushBufferToken()
|
static |
puts the buffered token on the token stack, such that it is read at the next call to getNextToken()
- Parameters
-
lpinput LP reading data
Definition at line 501 of file reader_lp.c.
References LP_MAX_PUSHEDTOKENS, NULL, and swapPointers().
Referenced by readCoefficients(), readConstraints(), and readSos().
◆ swapTokenBuffer()
|
static |
swaps the current token with the token buffer
- Parameters
-
lpinput LP reading data
Definition at line 514 of file reader_lp.c.
References NULL, and swapPointers().
Referenced by isNewSection(), readCoefficients(), readConstraints(), and readSos().
◆ isNewSection()
checks whether the current token is a section identifier, and if yes, switches to the corresponding section
- Parameters
-
scip SCIP data structure lpinput LP reading data
Definition at line 525 of file reader_lp.c.
References FALSE, getNextToken(), LP_BINARIES, LP_BOUNDS, LP_CONSTRAINTS, LP_END, LP_GENERALS, LP_MAX_LINELEN, LP_OBJECTIVE, LP_SEMICONTINUOUS, LP_SOS, NULL, pushToken(), SCIP_Bool, SCIP_OBJSENSE_MAXIMIZE, SCIP_OBJSENSE_MINIMIZE, SCIPdebugMsg, swapTokenBuffer(), and TRUE.
Referenced by readBinaries(), readBounds(), readCoefficients(), readConstraints(), readGenerals(), readSemicontinuous(), readSos(), and readStart().
◆ isSign()
returns whether the current token is a sign
- Parameters
-
lpinput LP reading data sign pointer to update the sign
Definition at line 736 of file reader_lp.c.
References FALSE, NULL, and TRUE.
Referenced by createIndicatorConstraint(), readBounds(), readCoefficients(), readConstraints(), and readSos().
◆ isValue()
returns whether the current token is a value
- Parameters
-
scip SCIP data structure lpinput LP reading data value pointer to store the value (unchanged, if token is no value)
Definition at line 761 of file reader_lp.c.
References FALSE, NULL, SCIPinfinity(), and TRUE.
Referenced by createIndicatorConstraint(), readBounds(), readCoefficients(), readConstraints(), and readSos().
◆ isSense()
returns whether the current token is an equation sense
- Parameters
-
lpinput LP reading data sense pointer to store the equation sense, or NULL
Definition at line 793 of file reader_lp.c.
References FALSE, LP_SENSE_EQ, LP_SENSE_GE, LP_SENSE_LE, NULL, and TRUE.
Referenced by createIndicatorConstraint(), readBounds(), readCoefficients(), and readConstraints().
◆ getVariable()
|
static |
returns the variable with the given name, or creates a new variable if it does not exist
- Parameters
-
scip SCIP data structure name name of the variable var pointer to store the variable created pointer to store whether a new variable was created, or NULL
Definition at line 824 of file reader_lp.c.
References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_VARTYPE_CONTINUOUS, SCIPaddVar(), SCIPcreateVar(), SCIPdebugMsg, SCIPfindVar(), SCIPgetBoolParam(), SCIPinfinity(), SCIPreleaseVar(), and TRUE.
Referenced by readBinaries(), readBounds(), readCoefficients(), readGenerals(), and readSemicontinuous().
◆ readStart()
|
static |
reads the header of the file
- Parameters
-
scip SCIP data structure lpinput LP reading data
Definition at line 869 of file reader_lp.c.
References getNextToken(), isNewSection(), NULL, and SCIP_OKAY.
Referenced by readLPFile().
◆ readCoefficients()
|
static |
reads an objective or constraint with name and coefficients
- Parameters
-
scip SCIP data structure lpinput LP reading data isobjective indicates whether we are currently reading the coefficients of the objective name pointer to store the name of the line; must be at least of size LP_MAX_LINELEN coefssize size of vars and coefs arrays vars pointer to store the array with variables (must be freed by caller) coefs pointer to store the array with coefficients (must be freed by caller) ncoefs pointer to store the number of coefficients quadcoefssize size of quadvars1, quadvars2, quadcoefs arrays quadvars1 pointer to store the array with first variables in quadratic terms (must be freed by caller) quadvars2 pointer to store the array with second variables in quadratic terms (must be freed by caller) quadcoefs pointer to store the array with coefficients in quadratic terms (must be freed by caller) nquadcoefs pointer to store the number of quadratic coefficients objoffset pointer to store an objective offset (or NULL if ! isobjective) newsection pointer to store whether a new section was encountered
Definition at line 890 of file reader_lp.c.
References FALSE, getNextToken(), getVariable(), isNewSection(), isSense(), isSign(), isValue(), LP_INIT_COEFSSIZE, LP_INIT_QUADCOEFSSIZE, LP_MAX_LINELEN, MAX, NULL, pushBufferToken(), pushToken(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBlockMemoryArray, SCIPdebugMsg, SCIPisZero(), SCIPmemccpy(), SCIPreallocBlockMemoryArray, SCIPvarGetName(), SCIPwarningMessage(), swapTokenBuffer(), syntaxError(), and TRUE.
Referenced by createIndicatorConstraint(), readConstraints(), and readObjective().
◆ readObjective()
|
static |
reads the objective section
- Parameters
-
scip SCIP data structure lpinput LP reading data
Definition at line 1291 of file reader_lp.c.
References FALSE, hasError(), LP_MAX_LINELEN, NULL, readCoefficients(), SCIP_Bool, SCIP_CALL, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPaddCons(), SCIPaddOrigObjoffset(), SCIPaddVar(), SCIPchgVarObj(), SCIPconsGetName(), SCIPcreateConsQuadratic(), SCIPcreateVar(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPfreeBlockMemoryArrayNull, SCIPinfinity(), SCIPisZero(), SCIPreleaseCons(), SCIPreleaseVar(), SCIPvarGetObj(), and TRUE.
Referenced by readLPFile().
◆ createIndicatorConstraint()
|
static |
create indicator constraint
- Parameters
-
scip SCIP data structure lpinput LP reading data name name of indicator constraint binvar binary indicator variable binvalue value of indicator part (0/1)
Definition at line 1386 of file reader_lp.c.
References FALSE, getNextToken(), hasError(), isSense(), isSign(), isValue(), LP_MAX_LINELEN, LP_SENSE_EQ, LP_SENSE_GE, LP_SENSE_LE, LP_SENSE_NOTHING, NULL, readCoefficients(), SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIPaddCons(), SCIPchgVarLb(), SCIPchgVarType(), SCIPchgVarUb(), SCIPcreateConsIndicator(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPerrorMessage, SCIPfreeBlockMemoryArrayNull, SCIPgetNegatedVar(), SCIPisFeasEQ(), SCIPreleaseCons(), SCIPsnprintf(), SCIPvarGetLbGlobal(), SCIPvarGetUbGlobal(), syntaxError(), and TRUE.
Referenced by readConstraints().
◆ readConstraints()
|
static |
reads the constraints section
Read linear and indicator constraints.
The CPLEX manual says that indicator constraints are of the following form:
[constraintname:] binaryvariable = value -> linear constraint
We also accept "<->".
- Parameters
-
scip SCIP data structure lpinput LP reading data
Definition at line 1601 of file reader_lp.c.
References createIndicatorConstraint(), FALSE, getNextToken(), hasError(), isNewSection(), isSense(), isSign(), isValue(), LP_MAX_LINELEN, LP_SENSE_EQ, LP_SENSE_GE, LP_SENSE_LE, LP_SENSE_NOTHING, NULL, pushBufferToken(), pushToken(), readCoefficients(), SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPcreateConsLinear(), SCIPcreateConsQuadratic(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPerrorMessage, SCIPfreeBlockMemoryArrayNull, SCIPinfinity(), SCIPisEQ(), SCIPreleaseCons(), SCIPsnprintf(), swapTokenBuffer(), syntaxError(), and TRUE.
Referenced by readLPFile().
◆ readBounds()
|
static |
reads the bounds section
- Parameters
-
scip SCIP data structure lpinput LP reading data
Definition at line 1836 of file reader_lp.c.
References getNextToken(), getVariable(), isNewSection(), isSense(), isSign(), isValue(), LP_SENSE_EQ, LP_SENSE_GE, LP_SENSE_LE, LP_SENSE_NOTHING, NULL, pushToken(), SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPchgVarLb(), SCIPchgVarUb(), SCIPdebugMsg, SCIPerrorMessage, SCIPinfinity(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), sign(), and syntaxError().
Referenced by readLPFile().
◆ readGenerals()
|
static |
reads the generals section
- Parameters
-
scip SCIP data structure lpinput LP reading data
Definition at line 2007 of file reader_lp.c.
References getNextToken(), getVariable(), isNewSection(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_INTEGER, SCIPchgVarType(), SCIPisFeasIntegral(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), SCIPwarningMessage(), and syntaxError().
Referenced by readLPFile().
◆ readBinaries()
|
static |
reads the binaries section
- Parameters
-
scip SCIP data structure lpinput LP reading data
Definition at line 2052 of file reader_lp.c.
References getNextToken(), getVariable(), isNewSection(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIPchgVarLb(), SCIPchgVarType(), SCIPchgVarUb(), SCIPisFeasEQ(), SCIPisFeasZero(), SCIPisInfinity(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), SCIPwarningMessage(), and syntaxError().
Referenced by readLPFile().
◆ readSemicontinuous()
|
static |
reads the semi-continuous section
- Parameters
-
scip SCIP data structure lpinput LP reading data
Definition at line 2106 of file reader_lp.c.
References FALSE, getNextToken(), getVariable(), isNewSection(), NULL, pushToken(), SCIP_Bool, SCIP_BOUNDTYPE_LOWER, SCIP_BOUNDTYPE_UPPER, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPchgVarLb(), SCIPcreateConsBounddisjunction(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPreleaseCons(), SCIPsnprintf(), SCIPvarGetLbGlobal(), SCIPvarGetName(), syntaxError(), and TRUE.
Referenced by readLPFile().
◆ readSos()
|
static |
reads the sos section
The format is as follows:
SOS <constraint name>: [S1|S2]:: {<variable name>:<weight>} ... <constraint name>: [S1|S2]:: {<variable name>:<weight>}
- Parameters
-
scip SCIP data structure lpinput LP reading data
Definition at line 2204 of file reader_lp.c.
References FALSE, getNextToken(), isNewSection(), isSign(), isValue(), NULL, pushBufferToken(), pushToken(), SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPABORT, SCIPaddCons(), SCIPaddVarSOS1(), SCIPaddVarSOS2(), SCIPconsGetName(), SCIPcreateConsSOS1(), SCIPcreateConsSOS2(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPerrorMessage, SCIPfindVar(), SCIPmemccpy(), SCIPreleaseCons(), SCIPsnprintf(), SCIPvarGetName(), sign(), swapTokenBuffer(), syntaxError(), and TRUE.
Referenced by readLPFile().
◆ readLPFile()
|
static |
reads an LP file
- Parameters
-
scip SCIP data structure lpinput LP reading data filename name of the input file
Definition at line 2414 of file reader_lp.c.
References hasError(), LP_BINARIES, LP_BOUNDS, LP_CONSTRAINTS, LP_END, LP_GENERALS, LP_OBJECTIVE, LP_SEMICONTINUOUS, LP_SOS, LP_START, NULL, readBinaries(), readBounds(), readConstraints(), readGenerals(), readObjective(), readSemicontinuous(), readSos(), readStart(), SCIP_CALL, SCIP_INVALIDDATA, SCIP_NOFILE, SCIP_OKAY, SCIPcreateProb(), SCIPerrorMessage, SCIPfclose(), SCIPfopen(), and SCIPprintSysError().
Referenced by SCIPreadLp().
◆ SCIP_DECL_HASHGETKEY()
|
static |
hash key retrieval function for variables
Definition at line 2492 of file reader_lp.c.
◆ SCIP_DECL_HASHKEYEQ()
|
static |
returns TRUE iff the indices of both variables are equal
Definition at line 2499 of file reader_lp.c.
◆ SCIP_DECL_HASHKEYVAL()
|
static |
returns the hash value of the key
Definition at line 2508 of file reader_lp.c.
References SCIPvarGetIndex().
◆ getActiveVariables()
|
static |
transforms given variables, scalars, and constant to the corresponding active variables, scalars, and constant
- Parameters
-
scip SCIP data structure vars pointer to vars array to get active variables for scalars pointer to scalars a_1, ..., a_n in linear sum a_1*x_1 + ... + a_n*x_n + c nvars pointer to number of variables and values in vars and vals array constant pointer to constant c in linear sum a_1*x_1 + ... + a_n*x_n + c transformed transformed constraint?
Definition at line 2516 of file reader_lp.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIP_VARSTATUS_NEGATED, SCIPgetProbvarLinearSum(), SCIPreallocBufferArray, SCIPvarGetNegatedVar(), SCIPvarGetOrigvarSum(), SCIPvarGetStatus(), and TRUE.
Referenced by printAggregatedCons(), and printQuadraticCons().
◆ clearLine()
|
static |
clears the given line buffer
- Parameters
-
linebuffer line linecnt number of characters in line
Definition at line 2571 of file reader_lp.c.
References NULL.
Referenced by endLine(), printRow(), printSOCCons(), printSosCons(), and SCIPwriteLp().
◆ endLine()
|
static |
ends the given line with '\0' and prints it to the given file stream
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) linebuffer line linecnt number of characters in line
Definition at line 2585 of file reader_lp.c.
References clearLine(), LP_MAX_PRINTLEN, NULL, and SCIPinfoMessage().
Referenced by appendLine(), printRow(), printSOCCons(), printSosCons(), and SCIPwriteLp().
◆ appendLine()
|
static |
appends extension to line and prints it to the give file stream if the line exceeded the length given in the define LP_PRINTLEN
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) linebuffer line linecnt number of characters in line extension string to extent the line
Definition at line 2608 of file reader_lp.c.
References endLine(), LP_MAX_PRINTLEN, LP_PRINTLEN, NULL, and SCIPdebugMsg.
Referenced by printRow(), printSOCCons(), printSosCons(), and SCIPwriteLp().
◆ printRow()
|
static |
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) rowname row name rownameextension row name extension type row type ("=", "<=", or ">=") linvars array of linear variables linvals array of linear coefficient values nlinvars number of linear variables quadvarterms quadratic variable terms nquadvarterms number of quadratic variable terms bilinterms bilinear terms nbilinterms number of bilinear terms rhs right hand side
Definition at line 2639 of file reader_lp.c.
References appendLine(), clearLine(), endLine(), LP_MAX_NAMELEN, LP_MAX_PRINTLEN, NULL, SCIPisZero(), SCIPsnprintf(), and SCIPvarGetName().
Referenced by printAggregatedCons(), and printQuadraticCons().
◆ printQuadraticCons()
|
static |
prints given (linear or) quadratic constraint information in LP format to file stream
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) rowname name of the row linvars array of linear variables linvals array of linear coefficients values (or NULL if all linear coefficient values are 1) nlinvars number of linear variables quadvarterms quadratic variable terms nquadvarterms number of quadratic variable terms bilinterms bilinear terms nbilinterms number of bilinear terms lhs left hand side rhs right hand side transformed transformed constraint?
Definition at line 2779 of file reader_lp.c.
References getActiveVariables(), NULL, printRow(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPduplicateBufferArray, SCIPfreeBufferArray, SCIPisEQ(), and SCIPisInfinity().
Referenced by printAndCons(), and SCIPwriteLp().
◆ printSosCons()
|
static |
prints given SOS constraint information in LP format to file stream
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) rowname name of the row vars array of variables weights array of weight values (or NULL) nvars number of variables type SOS type (SOS1 or SOS2)
Definition at line 2878 of file reader_lp.c.
References appendLine(), clearLine(), endLine(), LP_MAX_NAMELEN, LP_MAX_PRINTLEN, NULL, SCIPsnprintf(), and SCIPvarGetName().
Referenced by SCIPwriteLp().
◆ printSOCCons()
|
static |
prints given soc constraint in LP format to file stream
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) rowname name of the row cons second order cone constraint
Definition at line 2937 of file reader_lp.c.
References appendLine(), clearLine(), endLine(), LP_MAX_NAMELEN, LP_MAX_PRINTLEN, NULL, SCIP_OKAY, SCIP_Real, SCIPgetLhsCoefsSOC(), SCIPgetLhsConstantSOC(), SCIPgetLhsOffsetsSOC(), SCIPgetLhsVarsSOC(), SCIPgetNLhsVarsSOC(), SCIPgetRhsCoefSOC(), SCIPgetRhsOffsetSOC(), SCIPgetRhsVarSOC(), SCIPisZero(), SCIPsnprintf(), and SCIPvarGetName().
Referenced by SCIPwriteLp().
◆ printAndCons()
|
static |
prints a linearization of an and-constraint into the given file
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) consname name of the constraint cons and constraint aggrlinearizationands print weak or strong realaxation transformed transformed constraint?
Definition at line 3087 of file reader_lp.c.
References LP_MAX_NAMELEN, NULL, printQuadraticCons(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPgetNVarsAnd(), SCIPgetResultantAnd(), SCIPgetVarsAnd(), SCIPinfinity(), and SCIPsnprintf().
Referenced by SCIPwriteLp().
◆ collectAggregatedVars()
|
static |
check whether given variables are aggregated and put them into an array without duplication
- Parameters
-
scip SCIP data structure vars variable array nvars number of active variables in the problem aggvars pointer to array storing the aggregated variables on output naggvars pointer to number of aggregated variables on output saggvars pointer to number of slots in aggvars array varAggregated hashtable for checking duplicates
Definition at line 3174 of file reader_lp.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIP_VARSTATUS_AGGREGATED, SCIP_VARSTATUS_MULTAGGR, SCIP_VARSTATUS_NEGATED, SCIPcalcMemGrowSize(), SCIPhashtableExists(), SCIPhashtableInsert(), SCIPreallocBlockMemoryArray, and SCIPvarGetStatus().
Referenced by SCIPwriteLp().
◆ printAggregatedCons()
|
static |
print aggregated variable-constraints
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) transformed TRUE iff problem is the transformed problem nvars number of active variables in the problem nAggregatedVars number of aggregated variables aggregatedVars array storing the aggregated variables
Definition at line 3230 of file reader_lp.c.
References getActiveVariables(), LP_MAX_NAMELEN, NULL, printRow(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPsnprintf(), and SCIPvarGetName().
Referenced by SCIPwriteLp().
◆ checkVarnames()
method check if the variable names are not longer than LP_MAX_NAMELEN
- Parameters
-
scip SCIP data structure vars array of variables nvars number of variables
Definition at line 3283 of file reader_lp.c.
References FALSE, LP_MAX_NAMELEN, NULL, SCIP_Bool, SCIPvarGetName(), SCIPwarningMessage(), and TRUE.
Referenced by SCIPwriteLp().
◆ checkConsnames()
|
static |
method check if the constraint names are not longer than LP_MAX_NAMELEN
- Parameters
-
scip SCIP data structure conss array of constraints nconss number of constraints transformed TRUE iff problem is the transformed problem
Definition at line 3320 of file reader_lp.c.
References FALSE, LP_MAX_NAMELEN, NULL, SCIP_Bool, SCIP_Real, SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPconsIsEnabled(), SCIPconsIsTransformed(), SCIPgetLhsLinear(), SCIPisEQ(), SCIPwarningMessage(), and TRUE.
Referenced by SCIPwriteLp().
◆ SCIP_DECL_READERCOPY()
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 3389 of file reader_lp.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderLp(), and SCIPreaderGetName().
◆ SCIP_DECL_READERFREE()
|
static |
destructor of reader to free user data (called when SCIP is exiting)
Definition at line 3403 of file reader_lp.c.
References NULL, READER_NAME, SCIP_OKAY, SCIPfreeBlockMemory, SCIPreaderGetData(), and SCIPreaderGetName().
◆ SCIP_DECL_READERREAD()
|
static |
problem reading method of reader
Definition at line 3417 of file reader_lp.c.
References SCIP_CALL, SCIP_OKAY, and SCIPreadLp().
◆ SCIP_DECL_READERWRITE()
|
static |
problem writing method of reader
Definition at line 3428 of file reader_lp.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPreaderGetName(), and SCIPwriteLp().
Variable Documentation
◆ commentchars
|
static |
Definition at line 142 of file reader_lp.c.
Referenced by getNextLine().