Detailed Description
file reader for polynomial mixed-integer programs in PIP format
Definition in file reader_pip.c.
#include <ctype.h>
#include "blockmemshell/memory.h"
#include "scip/reader_pip.h"
#include "scip/cons_and.h"
#include "scip/cons_nonlinear.h"
#include "scip/cons_knapsack.h"
#include "scip/cons_linear.h"
#include "scip/cons_logicor.h"
#include "scip/cons_setppc.h"
#include "scip/cons_varbound.h"
#include "scip/expr_sum.h"
#include "scip/expr_var.h"
#include "scip/pub_cons.h"
#include "scip/pub_expr.h"
#include "scip/pub_fileio.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/pub_nlp.h"
#include "scip/pub_reader.h"
#include "scip/pub_var.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 "pipreader" |
#define | READER_DESC "file reader for polynomial mixed-integer programs in PIP format" |
#define | READER_EXTENSION "pip" |
#define | PIP_MAX_LINELEN 65536 |
#define | PIP_MAX_PUSHEDTOKENS 2 |
#define | PIP_INIT_MONOMIALSSIZE 128 |
#define | PIP_INIT_FACTORSSIZE 16 |
#define | PIP_MAX_PRINTLEN 561 |
#define | PIP_MAX_NAMELEN 256 |
#define | PIP_PRINTLEN 100 |
Typedefs | |
typedef enum PipSection | PIPSECTION |
typedef enum PipExpType | PIPEXPTYPE |
typedef enum PipSense | PIPSENSE |
typedef struct PipInput | PIPINPUT |
Enumerations | |
enum | PipSection { PIP_START, PIP_OBJECTIVE, PIP_CONSTRAINTS, PIP_BOUNDS, PIP_GENERALS, PIP_BINARIES, PIP_END } |
enum | PipExpType { PIP_EXP_NONE, PIP_EXP_UNSIGNED, PIP_EXP_SIGNED } |
enum | PipSense { PIP_SENSE_NOTHING, PIP_SENSE_LE, PIP_SENSE_GE, PIP_SENSE_EQ } |
Functions | |
static void | syntaxError (SCIP *scip, PIPINPUT *pipinput, const char *msg) |
static SCIP_Bool | hasError (PIPINPUT *pipinput) |
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, PIPEXPTYPE *exptype) |
static SCIP_Bool | getNextLine (SCIP *scip, PIPINPUT *pipinput) |
static void | swapPointers (char **pointer1, char **pointer2) |
static SCIP_Bool | getNextToken (SCIP *scip, PIPINPUT *pipinput) |
static void | pushToken (PIPINPUT *pipinput) |
static void | pushBufferToken (PIPINPUT *pipinput) |
static void | swapTokenBuffer (PIPINPUT *pipinput) |
static SCIP_Bool | isNewSection (SCIP *scip, PIPINPUT *pipinput) |
static SCIP_Bool | isSign (PIPINPUT *pipinput, int *sign) |
static SCIP_Bool | isValue (SCIP *scip, PIPINPUT *pipinput, SCIP_Real *value) |
static SCIP_Bool | isSense (PIPINPUT *pipinput, PIPSENSE *sense) |
static SCIP_RETCODE | getVariable (SCIP *scip, char *name, SCIP_Bool dynamiccols, SCIP_VAR **var, SCIP_Bool *created) |
static SCIP_RETCODE | readStart (SCIP *scip, PIPINPUT *pipinput) |
static SCIP_RETCODE | ensureMonomialsSize (SCIP *scip, SCIP_EXPR ***monomials, SCIP_Real **monomialscoef, int *monomialssize, int minnmonomials) |
static SCIP_RETCODE | ensureFactorsSize (SCIP *scip, SCIP_VAR ***vars, SCIP_Real **exponents, int *factorssize, int minnfactors) |
static SCIP_RETCODE | readPolynomial (SCIP *scip, PIPINPUT *pipinput, char *name, SCIP_EXPR **expr, SCIP_Bool *islinear, SCIP_Bool *newsection) |
static SCIP_RETCODE | readObjective (SCIP *scip, PIPINPUT *pipinput) |
static SCIP_RETCODE | readConstraints (SCIP *scip, PIPINPUT *pipinput) |
static SCIP_RETCODE | readBounds (SCIP *scip, PIPINPUT *pipinput) |
static SCIP_RETCODE | readGenerals (SCIP *scip, PIPINPUT *pipinput) |
static SCIP_RETCODE | readBinaries (SCIP *scip, PIPINPUT *pipinput) |
static SCIP_RETCODE | readPIPFile (SCIP *scip, PIPINPUT *pipinput, 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 SCIP_Bool | isExprSignomial (SCIP *scip, SCIP_EXPR *expr) |
static SCIP_Bool | isExprPolynomial (SCIP *scip, SCIP_EXPR *expr) |
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 SCIP_RETCODE | printRow (SCIP *scip, FILE *file, const char *rowname, const char *rownameextension, const char *type, SCIP_VAR **linvars, SCIP_Real *linvals, int nlinvars, SCIP_EXPR *quadexpr, SCIP_Real rhs, SCIP_Bool transformed) |
static void | printSignomial (SCIP *scip, FILE *file, char *linebuffer, int *linecnt, SCIP_EXPR *expr, SCIP_Real coef, SCIP_Bool needsign) |
static void | printRowNl (SCIP *scip, FILE *file, const char *rowname, const char *rownameextension, const char *type, SCIP_EXPR *expr, SCIP_Real rhs) |
static void | printRowAnd (SCIP *scip, FILE *file, const char *rowname, SCIP_CONS *cons) |
static SCIP_RETCODE | printQuadraticCons (SCIP *scip, FILE *file, const char *rowname, SCIP_VAR **linvars, SCIP_Real *linvals, int nlinvars, SCIP_EXPR *quadexpr, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool transformed) |
static SCIP_RETCODE | printNonlinearCons (SCIP *scip, FILE *file, const char *rowname, SCIP_EXPR *expr, SCIP_Real lhs, SCIP_Real rhs) |
static SCIP_RETCODE | collectAggregatedVars (int nvars, SCIP_VAR **vars, int *nAggregatedVars, SCIP_VAR ***aggregatedVars, SCIP_HASHTABLE **varAggregated) |
static SCIP_RETCODE | printAggregatedCons (SCIP *scip, FILE *file, SCIP_Bool transformed, int nvars, int nAggregatedVars, SCIP_VAR **aggregatedVars) |
static SCIP_Bool | isNameValid (const char *name) |
static void | checkVarnames (SCIP *scip, SCIP_VAR **vars, int nvars) |
static void | checkConsnames (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool transformed) |
SCIP_RETCODE | SCIPwritePip (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) |
static | SCIP_DECL_READERCOPY (readerCopyPip) |
static | SCIP_DECL_READERREAD (readerReadPip) |
static | SCIP_DECL_READERWRITE (readerWritePip) |
SCIP_RETCODE | SCIPincludeReaderPip (SCIP *scip) |
SCIP_RETCODE | SCIPreadPip (SCIP *scip, SCIP_READER *reader, const char *filename, SCIP_RESULT *result) |
Variables | |
static const char | delimchars [] = " \f\n\r\t\v" |
static const char | tokenchars [] = "-+:<>=*^" |
static const char | commentchars [] = "\\" |
static const char | namechars [] = "!#$%&;?@_" |
Macro Definition Documentation
◆ READER_NAME
#define READER_NAME "pipreader" |
Definition at line 71 of file reader_pip.c.
Referenced by SCIP_DECL_READERCOPY(), and SCIPincludeReaderPip().
◆ READER_DESC
#define READER_DESC "file reader for polynomial mixed-integer programs in PIP format" |
Definition at line 72 of file reader_pip.c.
Referenced by SCIPincludeReaderPip().
◆ READER_EXTENSION
#define READER_EXTENSION "pip" |
Definition at line 73 of file reader_pip.c.
Referenced by SCIPincludeReaderPip().
◆ PIP_MAX_LINELEN
#define PIP_MAX_LINELEN 65536 |
Definition at line 79 of file reader_pip.c.
Referenced by getNextLine(), getNextToken(), readConstraints(), readObjective(), readPolynomial(), and SCIPreadPip().
◆ PIP_MAX_PUSHEDTOKENS
#define PIP_MAX_PUSHEDTOKENS 2 |
Definition at line 80 of file reader_pip.c.
Referenced by pushBufferToken(), pushToken(), and SCIPreadPip().
◆ PIP_INIT_MONOMIALSSIZE
#define PIP_INIT_MONOMIALSSIZE 128 |
Definition at line 81 of file reader_pip.c.
Referenced by readPolynomial().
◆ PIP_INIT_FACTORSSIZE
#define PIP_INIT_FACTORSSIZE 16 |
Definition at line 82 of file reader_pip.c.
Referenced by readPolynomial().
◆ PIP_MAX_PRINTLEN
#define PIP_MAX_PRINTLEN 561 |
the maximum length of any line is 560 + '\0' = 561
Definition at line 83 of file reader_pip.c.
Referenced by appendLine(), endLine(), printRow(), printRowAnd(), printRowNl(), printSignomial(), and SCIPwritePip().
◆ PIP_MAX_NAMELEN
#define PIP_MAX_NAMELEN 256 |
the maximum length for any name is 255 + '\0' = 256
Definition at line 84 of file reader_pip.c.
Referenced by checkConsnames(), isNameValid(), printAggregatedCons(), printRow(), printRowNl(), and SCIPwritePip().
◆ PIP_PRINTLEN
#define PIP_PRINTLEN 100 |
Definition at line 85 of file reader_pip.c.
Referenced by appendLine().
Typedef Documentation
◆ PIPSECTION
typedef enum PipSection PIPSECTION |
Definition at line 98 of file reader_pip.c.
◆ PIPEXPTYPE
typedef enum PipExpType PIPEXPTYPE |
Definition at line 106 of file reader_pip.c.
◆ PIPSENSE
Definition at line 115 of file reader_pip.c.
◆ PIPINPUT
typedef struct PipInput PIPINPUT |
Definition at line 138 of file reader_pip.c.
Enumeration Type Documentation
◆ PipSection
enum PipSection |
Section in PIP File
Enumerator | |
---|---|
PIP_START | |
PIP_OBJECTIVE | |
PIP_CONSTRAINTS | |
PIP_BOUNDS | |
PIP_GENERALS | |
PIP_BINARIES | |
PIP_END |
Definition at line 88 of file reader_pip.c.
◆ PipExpType
enum PipExpType |
Enumerator | |
---|---|
PIP_EXP_NONE | |
PIP_EXP_UNSIGNED | |
PIP_EXP_SIGNED |
Definition at line 100 of file reader_pip.c.
◆ PipSense
enum PipSense |
Enumerator | |
---|---|
PIP_SENSE_NOTHING | |
PIP_SENSE_LE | |
PIP_SENSE_GE | |
PIP_SENSE_EQ |
Definition at line 108 of file reader_pip.c.
Function Documentation
◆ syntaxError()
issues an error message and marks the PIP data to have errors
- Parameters
-
scip SCIP data structure pipinput PIP reading data msg error message
Definition at line 152 of file reader_pip.c.
References NULL, PIP_END, SCIP_VERBLEVEL_MINIMAL, SCIPerrorMessage, SCIPsnprintf(), SCIPverbMessage(), and TRUE.
Referenced by readBinaries(), readBounds(), readConstraints(), readGenerals(), and readPolynomial().
◆ hasError()
returns whether a syntax error was detected
- Parameters
-
pipinput PIP reading data
Definition at line 179 of file reader_pip.c.
References NULL.
Referenced by readConstraints(), readObjective(), and readPIPFile().
◆ isDelimChar()
|
static |
returns whether the given character is a token delimiter
- Parameters
-
c input character
Definition at line 190 of file reader_pip.c.
References delimchars, and NULL.
Referenced by getNextToken().
◆ isTokenChar()
|
static |
returns whether the given character is a single token
- Parameters
-
c input character
Definition at line 199 of file reader_pip.c.
References NULL, and tokenchars.
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 208 of file reader_pip.c.
References FALSE, NULL, PIP_EXP_NONE, PIP_EXP_SIGNED, PIP_EXP_UNSIGNED, 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 pipinput PIP reading data
Definition at line 252 of file reader_pip.c.
References BMSclearMemoryArray, commentchars, FALSE, NULL, PIP_MAX_LINELEN, SCIPerrorMessage, SCIPfgets(), and TRUE.
Referenced by getNextToken().
◆ swapPointers()
|
static |
swaps the addresses of two pointers
- Parameters
-
pointer1 first pointer pointer2 second pointer
Definition at line 297 of file reader_pip.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 pipinput PIP reading data
Definition at line 311 of file reader_pip.c.
References FALSE, getNextLine(), isDelimChar(), isTokenChar(), isValueChar(), NULL, PIP_END, PIP_EXP_NONE, PIP_MAX_LINELEN, SCIP_Bool, SCIPdebugMsg, swapPointers(), and TRUE.
Referenced by isNewSection(), readBinaries(), readBounds(), readConstraints(), readGenerals(), readPolynomial(), and readStart().
◆ pushToken()
|
static |
puts the current token on the token stack, such that it is read at the next call to getNextToken()
- Parameters
-
pipinput PIP reading data
Definition at line 410 of file reader_pip.c.
References NULL, PIP_MAX_PUSHEDTOKENS, and swapPointers().
Referenced by isNewSection(), readBounds(), and readPolynomial().
◆ pushBufferToken()
|
static |
puts the buffered token on the token stack, such that it is read at the next call to getNextToken()
- Parameters
-
pipinput PIP reading data
Definition at line 423 of file reader_pip.c.
References NULL, PIP_MAX_PUSHEDTOKENS, and swapPointers().
Referenced by readPolynomial().
◆ swapTokenBuffer()
|
static |
swaps the current token with the token buffer
- Parameters
-
pipinput PIP reading data
Definition at line 436 of file reader_pip.c.
References NULL, and swapPointers().
Referenced by isNewSection(), and readPolynomial().
◆ isNewSection()
checks whether the current token is a section identifier, and if yes, switches to the corresponding section
- Parameters
-
scip SCIP data structure pipinput PIP reading data
Definition at line 447 of file reader_pip.c.
References FALSE, getNextToken(), NULL, PIP_BINARIES, PIP_BOUNDS, PIP_CONSTRAINTS, PIP_END, PIP_GENERALS, PIP_OBJECTIVE, pushToken(), SCIP_Bool, SCIP_OBJSENSE_MAXIMIZE, SCIP_OBJSENSE_MINIMIZE, SCIPdebugMsg, swapTokenBuffer(), and TRUE.
Referenced by readBinaries(), readBounds(), readGenerals(), readPolynomial(), and readStart().
◆ isSign()
returns whether the current token is a sign
- Parameters
-
pipinput PIP reading data sign pointer to update the sign
Definition at line 580 of file reader_pip.c.
References FALSE, NULL, and TRUE.
Referenced by readBounds(), readConstraints(), and readPolynomial().
◆ isValue()
returns whether the current token is a value
- Parameters
-
scip SCIP data structure pipinput PIP reading data value pointer to store the value (unchanged, if token is no value)
Definition at line 605 of file reader_pip.c.
References FALSE, NULL, SCIPinfinity(), and TRUE.
Referenced by readBounds(), readConstraints(), and readPolynomial().
◆ isSense()
returns whether the current token is an equation sense
- Parameters
-
pipinput PIP reading data sense pointer to store the equation sense, or NULL
Definition at line 637 of file reader_pip.c.
References FALSE, NULL, PIP_SENSE_EQ, PIP_SENSE_GE, PIP_SENSE_LE, and TRUE.
Referenced by readBounds(), readConstraints(), and readPolynomial().
◆ 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 dynamiccols should columns be added and removed dynamically to the LP? var pointer to store the variable created pointer to store whether a new variable was created, or NULL
Definition at line 668 of file reader_pip.c.
References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_VARTYPE_CONTINUOUS, SCIPaddVar(), SCIPcreateVar(), SCIPdebugMsg, SCIPfindVar(), SCIPinfinity(), SCIPreleaseVar(), and TRUE.
Referenced by readBinaries(), readBounds(), readGenerals(), and readPolynomial().
◆ readStart()
|
static |
reads the header of the file
- Parameters
-
scip SCIP data structure pipinput PIP reading data
Definition at line 707 of file reader_pip.c.
References getNextToken(), isNewSection(), NULL, and SCIP_OKAY.
Referenced by readPIPFile().
◆ ensureMonomialsSize()
|
static |
ensure that an array of monomials can hold a minimum number of entries
- Parameters
-
scip SCIP data structure monomials pointer to current array of monomials monomialscoef pointer to current array of monomial coefficients monomialssize current size of monomials array at input; new size at exit minnmonomials required minimal size of monomials array
Definition at line 728 of file reader_pip.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPcalcMemGrowSize(), and SCIPreallocBufferArray.
Referenced by readPolynomial().
◆ ensureFactorsSize()
|
static |
ensure that arrays of exponents and variable indices can hold a minimum number of entries
- Parameters
-
scip SCIP data structure vars pointer to current array of variables exponents pointer to current array of exponents factorssize current size of arrays at input; new size at exit minnfactors required minimal size of arrays
Definition at line 772 of file reader_pip.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPcalcMemGrowSize(), and SCIPreallocBufferArray.
Referenced by readPolynomial().
◆ readPolynomial()
|
static |
reads an objective or constraint with name and coefficients
- Parameters
-
scip SCIP data structure pipinput PIP reading data name pointer to store the name of the line; must be at least of size PIP_MAX_LINELEN expr pointer to store the constraint function as expression islinear pointer to store polynomial is linear newsection pointer to store whether a new section was encountered
Definition at line 811 of file reader_pip.c.
References ensureFactorsSize(), ensureMonomialsSize(), FALSE, getNextToken(), getVariable(), isNewSection(), isSense(), isSign(), isValue(), NULL, PIP_INIT_FACTORSSIZE, PIP_INIT_MONOMIALSSIZE, PIP_MAX_LINELEN, pushBufferToken(), pushToken(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPcreateExprMonomial(), SCIPcreateExprSum(), SCIPdebugMsg, SCIPfreeBufferArray, SCIPinfoMessage(), SCIPisIntegral(), SCIPprintExpr(), SCIPreleaseExpr(), SCIPstrncpy(), SCIPvarGetName(), swapTokenBuffer(), syntaxError(), and TRUE.
Referenced by readConstraints(), and readObjective().
◆ readObjective()
|
static |
reads the objective section
- Parameters
-
scip SCIP data structure pipinput PIP reading data
Definition at line 1098 of file reader_pip.c.
References FALSE, hasError(), NULL, PIP_MAX_LINELEN, readPolynomial(), SCIP_Bool, SCIP_CALL, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPaddCons(), SCIPaddVar(), SCIPappendExprSumExpr(), SCIPchgVarObj(), SCIPconsGetName(), SCIPcreateConsNonlinear(), SCIPcreateExprVar(), SCIPcreateVar(), SCIPcreateVarBasic(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPexprGetChildren(), SCIPexprGetNChildren(), SCIPgetCoefsExprSum(), SCIPgetConstantExprSum(), SCIPgetVarExprVar(), SCIPinfinity(), SCIPisExprVar(), SCIPreleaseCons(), SCIPreleaseExpr(), SCIPreleaseVar(), SCIPsetConstantExprSum(), SCIPvarGetObj(), and TRUE.
Referenced by readPIPFile().
◆ readConstraints()
|
static |
reads the constraints section
- Parameters
-
scip SCIP data structure pipinput PIP reading data
Definition at line 1229 of file reader_pip.c.
References FALSE, getNextToken(), hasError(), isSense(), isSign(), isValue(), NULL, PIP_MAX_LINELEN, PIP_SENSE_EQ, PIP_SENSE_GE, PIP_SENSE_LE, PIP_SENSE_NOTHING, readPolynomial(), SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_READERROR, SCIP_Real, SCIPaddCons(), SCIPallocBufferArray, SCIPcreateConsLinear(), SCIPcreateConsNonlinear(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPerrorMessage, SCIPexprGetChildren(), SCIPexprGetNChildren(), SCIPfreeBufferArray, SCIPgetCoefsExprSum(), SCIPgetConstantExprSum(), SCIPgetVarExprVar(), SCIPinfinity(), SCIPisExprVar(), SCIPisInfinity(), SCIPreleaseCons(), SCIPreleaseExpr(), syntaxError(), and TRUE.
Referenced by readPIPFile().
◆ readBounds()
|
static |
reads the bounds section
- Parameters
-
scip SCIP data structure pipinput PIP reading data
Definition at line 1398 of file reader_pip.c.
References getNextToken(), getVariable(), isNewSection(), isSense(), isSign(), isValue(), NULL, PIP_SENSE_EQ, PIP_SENSE_GE, PIP_SENSE_LE, PIP_SENSE_NOTHING, pushToken(), SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPchgVarLb(), SCIPchgVarUb(), SCIPdebugMsg, SCIPerrorMessage, SCIPinfinity(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), and syntaxError().
Referenced by readPIPFile().
◆ readGenerals()
|
static |
reads the generals section
- Parameters
-
scip SCIP data structure pipinput PIP reading data
Definition at line 1569 of file reader_pip.c.
References getNextToken(), getVariable(), isNewSection(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_VARTYPE_INTEGER, SCIPchgVarType(), and syntaxError().
Referenced by readPIPFile().
◆ readBinaries()
|
static |
reads the binaries section
- Parameters
-
scip SCIP data structure pipinput PIP reading data
Definition at line 1604 of file reader_pip.c.
References getNextToken(), getVariable(), isNewSection(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_VARTYPE_BINARY, SCIPchgVarLb(), SCIPchgVarType(), SCIPchgVarUb(), SCIPvarGetLbGlobal(), SCIPvarGetUbGlobal(), and syntaxError().
Referenced by readPIPFile().
◆ readPIPFile()
|
static |
reads a PIP file
- Parameters
-
scip SCIP data structure pipinput PIP reading data filename name of the input file
Definition at line 1648 of file reader_pip.c.
References hasError(), NULL, PIP_BINARIES, PIP_BOUNDS, PIP_CONSTRAINTS, PIP_END, PIP_GENERALS, PIP_OBJECTIVE, PIP_START, readBinaries(), readBounds(), readConstraints(), readGenerals(), readObjective(), readStart(), SCIP_CALL, SCIP_INVALIDDATA, SCIP_NOFILE, SCIP_OKAY, SCIPcreateProb(), SCIPerrorMessage, SCIPfclose(), SCIPfopen(), and SCIPprintSysError().
Referenced by SCIPreadPip().
◆ SCIP_DECL_HASHGETKEY()
|
static |
hash key retrieval function for variables
Definition at line 1718 of file reader_pip.c.
◆ SCIP_DECL_HASHKEYEQ()
|
static |
returns TRUE iff the indices of both variables are equal
Definition at line 1725 of file reader_pip.c.
◆ SCIP_DECL_HASHKEYVAL()
|
static |
returns the hash value of the key
Definition at line 1734 of file reader_pip.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 1742 of file reader_pip.c.
References NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_VARSTATUS_NEGATED, SCIPABORT, SCIPerrorMessage, SCIPgetProbvarLinearSum(), SCIPreallocBufferArray, SCIPvarGetNegatedVar(), SCIPvarGetOrigvarSum(), SCIPvarGetStatus(), and TRUE.
Referenced by printAggregatedCons(), printQuadraticCons(), and printRow().
◆ isExprSignomial()
checks whether a given expression is a signomial
assumes simplified expression
- Parameters
-
scip SCIP data structure expr expression
Definition at line 1807 of file reader_pip.c.
References FALSE, NULL, SCIPexprGetChildren(), SCIPexprGetNChildren(), SCIPisExprPower(), SCIPisExprProduct(), SCIPisExprValue(), SCIPisExprVar(), and TRUE.
Referenced by isExprPolynomial(), and printSignomial().
◆ isExprPolynomial()
checks whether a given expression is a sum of signomials (i.e., like a polynomial, but negative and fractional exponents allowed)
assumes simplified expression; does not check whether variables in powers with fractional exponent are nonnegative; does not check whether variables in powers with negative exponent are bounded away from zero (the format specification does not require that, too)
- Parameters
-
scip SCIP data structure expr expression
Definition at line 1854 of file reader_pip.c.
References FALSE, isExprSignomial(), NULL, SCIPexprGetChildren(), SCIPexprGetNChildren(), SCIPisExprSum(), and TRUE.
Referenced by SCIPwritePip().
◆ clearLine()
|
static |
clears the given line buffer
- Parameters
-
linebuffer line linecnt number of characters in line
Definition at line 1877 of file reader_pip.c.
References NULL.
Referenced by endLine(), printRow(), printRowAnd(), printRowNl(), and SCIPwritePip().
◆ 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 1891 of file reader_pip.c.
References clearLine(), NULL, PIP_MAX_PRINTLEN, and SCIPinfoMessage().
Referenced by appendLine(), printRow(), printRowAnd(), printRowNl(), and SCIPwritePip().
◆ appendLine()
|
static |
appends extension to line and prints it to the give file stream if the line exceeded the length given in the define PIP_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 1914 of file reader_pip.c.
References endLine(), NULL, PIP_MAX_PRINTLEN, PIP_PRINTLEN, and SCIPdebugMsg.
Referenced by printRow(), printRowAnd(), printRowNl(), printSignomial(), and SCIPwritePip().
◆ printRow()
|
static |
print linear or quadratic row in PIP format to file stream
- 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 quadexpr quadratic expression rhs right hand side transformed transformed constraint?
Definition at line 1945 of file reader_pip.c.
References appendLine(), clearLine(), endLine(), getActiveVariables(), NULL, PIP_MAX_NAMELEN, PIP_MAX_PRINTLEN, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPduplicateBufferArray, SCIPexprGetQuadraticBilinTerm(), SCIPexprGetQuadraticData(), SCIPexprGetQuadraticQuadTerm(), SCIPfreeBufferArray, SCIPgetVarExprVar(), SCIPisExprVar(), SCIPisInfinity(), SCIPisZero(), SCIPsnprintf(), and SCIPvarGetName().
Referenced by printAggregatedCons(), and printQuadraticCons().
◆ printSignomial()
|
static |
print signomial in PIP format to file stream
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) linebuffer line buffer to append to linecnt count on line buffer use expr sigomial expression coef coefficient needsign whether a sign needs to be ensured
Definition at line 2177 of file reader_pip.c.
References appendLine(), isExprSignomial(), PIP_MAX_PRINTLEN, REALABS, SCIPexprGetChildren(), SCIPexprGetNChildren(), SCIPgetCoefExprProduct(), SCIPgetExponentExprPow(), SCIPgetValueExprValue(), SCIPgetVarExprVar(), SCIPisExprPower(), SCIPisExprProduct(), SCIPisExprValue(), SCIPisExprVar(), SCIPsnprintf(), and SCIPvarGetName().
Referenced by printRowNl(), and SCIP_DECL_NLHDLRESTIMATE().
◆ printRowNl()
|
static |
print polynomial row in PIP format to file stream
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) rowname row name rownameextension row name extension type row type ("=", "<=", or ">=") expr polynomial expression rhs right hand side
Definition at line 2267 of file reader_pip.c.
References appendLine(), clearLine(), endLine(), FALSE, NULL, PIP_MAX_NAMELEN, PIP_MAX_PRINTLEN, printSignomial(), SCIP_Bool, SCIPexprGetChildren(), SCIPexprGetNChildren(), SCIPgetCoefsExprSum(), SCIPgetConstantExprSum(), SCIPisExprSum(), SCIPsnprintf(), and TRUE.
Referenced by printNonlinearCons().
◆ printRowAnd()
print "and" constraint as row in PIP format to file stream
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) rowname row name cons "and" constraint
Definition at line 2335 of file reader_pip.c.
References appendLine(), clearLine(), endLine(), NULL, PIP_MAX_PRINTLEN, SCIPgetNVarsAnd(), SCIPgetResultantAnd(), SCIPgetVarsAnd(), and SCIPvarGetName().
Referenced by SCIPwritePip().
◆ 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 quadexpr quadratic expression (or NULL if nlinvars > 0) lhs left hand side rhs right hand side transformed transformed constraint?
Definition at line 2383 of file reader_pip.c.
References getActiveVariables(), NULL, printRow(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPduplicateBufferArray, SCIPfreeBufferArray, SCIPisEQ(), and SCIPisInfinity().
Referenced by SCIPwritePip().
◆ printNonlinearCons()
|
static |
prints given nonlinear 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 expr polynomial expression lhs left hand side rhs right hand side
Definition at line 2470 of file reader_pip.c.
References NULL, printRowNl(), SCIP_OKAY, SCIPisEQ(), and SCIPisInfinity().
Referenced by SCIPwritePip().
◆ collectAggregatedVars()
|
static |
check whether given variables are aggregated and put them into an array without duplication
- Parameters
-
nvars number of active variables in the problem vars variable array nAggregatedVars number of aggregated variables on output aggregatedVars array storing the aggregated variables on output varAggregated hashtable for checking duplicates
Definition at line 2514 of file reader_pip.c.
References SCIP_CALL, SCIP_OKAY, SCIP_VARSTATUS_AGGREGATED, SCIP_VARSTATUS_MULTAGGR, SCIP_VARSTATUS_NEGATED, SCIPhashtableExists(), SCIPhashtableInsert(), and SCIPvarGetStatus().
Referenced by SCIPwritePip().
◆ 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 2554 of file reader_pip.c.
References getActiveVariables(), NULL, PIP_MAX_NAMELEN, printRow(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPsnprintf(), and SCIPvarGetName().
Referenced by SCIPwritePip().
◆ isNameValid()
|
static |
returns whether name is valid according to PIP specification
Checks these two conditions from http://polip.zib.de/pipformat.php:
- Names/labels can contain at most 255 characters.
- Name/labels have to consist of the following characters: a-z, A-Z, 0-9, "!", "#", "$", "%", "&", ";", "?", "@", "_". They cannot start with a number.
In addition checks that the length is not zero.
- Parameters
-
name name to check
Definition at line 2615 of file reader_pip.c.
References FALSE, namechars, NULL, PIP_MAX_NAMELEN, and TRUE.
Referenced by checkConsnames(), and checkVarnames().
◆ checkVarnames()
method check if the variable names are valid according to PIP specification
- Parameters
-
scip SCIP data structure vars array of variables nvars number of variables
Definition at line 2651 of file reader_pip.c.
References isNameValid(), NULL, SCIPvarGetName(), and SCIPwarningMessage().
Referenced by SCIPwritePip().
◆ checkConsnames()
|
static |
method check if the constraint names are valid according to PIP specification
- Parameters
-
scip SCIP data structure conss array of constraints nconss number of constraints transformed TRUE iff problem is the transformed problem
Definition at line 2675 of file reader_pip.c.
References isNameValid(), NULL, PIP_MAX_NAMELEN, SCIP_Real, SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPconsIsEnabled(), SCIPconsIsTransformed(), SCIPgetLhsLinear(), SCIPgetRhsLinear(), SCIPisEQ(), and SCIPwarningMessage().
Referenced by SCIPwritePip().
◆ SCIP_DECL_READERCOPY()
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 3172 of file reader_pip.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderPip(), and SCIPreaderGetName().
◆ SCIP_DECL_READERREAD()
|
static |
problem reading method of reader
Definition at line 3187 of file reader_pip.c.
References SCIP_CALL, SCIP_OKAY, and SCIPreadPip().
◆ SCIP_DECL_READERWRITE()
|
static |
problem writing method of reader
Definition at line 3198 of file reader_pip.c.
References SCIP_CALL, SCIP_OKAY, and SCIPwritePip().
Variable Documentation
◆ delimchars
|
static |
Definition at line 140 of file reader_pip.c.
Referenced by isDelimChar().
◆ tokenchars
|
static |
Definition at line 141 of file reader_pip.c.
Referenced by isTokenChar().
◆ commentchars
|
static |
Definition at line 142 of file reader_pip.c.
Referenced by getNextLine().
◆ namechars
|
static |
Definition at line 143 of file reader_pip.c.
Referenced by isNameValid().