FlatZinc file reader.
FlatZinc is a low-level solver input language that is the target language for MiniZinc. It is designed to be easy to translate into the form required by a solver. For more details see http://www.g12.cs.mu.oz.au/minizinc/ .
Definition in file reader_fzn.c.
#include <stdlib.h>#include <assert.h>#include <string.h>#include <ctype.h>#include "scip/cons_and.h"#include "scip/cons_cumulative.h"#include "scip/cons_knapsack.h"#include "scip/cons_linear.h"#include "scip/cons_logicor.h"#include "scip/cons_or.h"#include "scip/cons_quadratic.h"#include "scip/cons_setppc.h"#include "scip/cons_varbound.h"#include "scip/cons_xor.h"#include "scip/pub_misc.h"#include "scip/reader_fzn.h"Go to the source code of this file.
Macros | |
| #define | READER_NAME "fznreader" |
| #define | READER_DESC "file reader for FlatZinc format" |
| #define | READER_EXTENSION "fzn" |
| #define | FZN_BUFFERLEN 8192 |
| #define | FZN_MAX_PUSHEDTOKENS 1 |
| #define | CREATE_CONSTRAINT(x) SCIP_RETCODE x (SCIP* scip, FZNINPUT* fzninput, const char* fname, char** ftokens, int nftokens, SCIP_Bool* created) |
Typedefs | |
| typedef enum FznNumberType | FZNNUMBERTYPE |
| typedef enum FznExpType | FZNEXPTYPE |
| typedef struct Dimensions | DIMENSIONS |
| typedef struct FznConstant | FZNCONSTANT |
| typedef struct ConstArray | CONSTARRAY |
| typedef struct VarArray | VARARRAY |
| typedef struct FznInput | FZNINPUT |
| typedef struct FznOutput | FZNOUTPUT |
Enumerations | |
| enum | FznNumberType { FZN_BOOL, FZN_INT, FZN_FLOAT } |
| enum | FznExpType { FZN_EXP_NONE, FZN_EXP_UNSIGNED, FZN_EXP_SIGNED } |
Functions | |
| static | SCIP_DECL_HASHGETKEY (hashGetKeyVar) |
| static | SCIP_DECL_HASHGETKEY (hashGetKeyConstant) |
| static | SCIP_DECL_SORTPTRCOMP (vararraysComp) |
| static void | freeStringBufferArray (SCIP *scip, char **array, int nelements) |
| static SCIP_Bool | isDelimChar (char c) |
| static SCIP_Bool | isTokenChar (char c) |
| static SCIP_Bool | isChar (const char *token, char c) |
| static SCIP_Bool | isBoolExp (const char *name, SCIP_Bool *value) |
| static SCIP_Bool | isIdentifier (const char *name) |
| static SCIP_Bool | isValueChar (char c, char nextc, SCIP_Bool firstchar, SCIP_Bool *hasdot, FZNEXPTYPE *exptype) |
| static SCIP_Bool | equalTokens (SCIP *scip, const char *token1, const char *token2) |
| static SCIP_Bool | getNextLine (SCIP *scip, FZNINPUT *fzninput) |
| static SCIP_Bool | getNextToken (SCIP *scip, FZNINPUT *fzninput) |
| static void | pushToken (FZNINPUT *fzninput) |
| static SCIP_Bool | isEndStatement (FZNINPUT *fzninput) |
| static SCIP_Bool | isValue (const char *token, SCIP_Real *value) |
| static void | syntaxError (SCIP *scip, FZNINPUT *fzninput, const char *msg) |
| static SCIP_Bool | hasError (FZNINPUT *fzninput) |
| static SCIP_RETCODE | readerdataCreate (SCIP *scip, SCIP_READERDATA **readerdata) |
| static SCIP_RETCODE | ensureVararrySize (SCIP *scip, SCIP_READERDATA *readerdata) |
| static SCIP_RETCODE | ensureVararrySizeFznInput (SCIP *scip, FZNINPUT *fzninput) |
| static SCIP_RETCODE | ensureConstarrySizeFznInput (SCIP *scip, FZNINPUT *fzninput) |
| static void | printValue (SCIP *scip, FILE *file, SCIP_Real value, FZNNUMBERTYPE type) |
| static SCIP_RETCODE | copyDimensions (SCIP *scip, DIMENSIONS **target, DIMENSIONS *source) |
| static SCIP_RETCODE | createVararray (SCIP *scip, VARARRAY **vararray, const char *name, SCIP_VAR **vars, int nvars, FZNNUMBERTYPE type, DIMENSIONS *info) |
| static void | freeDimensions (SCIP *scip, DIMENSIONS **dim) |
| static void | freeVararray (SCIP *scip, VARARRAY **vararray) |
| static VARARRAY * | findVararray (SCIP *scip, FZNINPUT *fzninput, const char *name) |
| static SCIP_RETCODE | createConstarray (SCIP *scip, CONSTARRAY **constarray, const char *name, FZNCONSTANT **constants, int nconstants, FZNNUMBERTYPE type) |
| static void | freeConstarray (SCIP *scip, CONSTARRAY **constarray) |
| static CONSTARRAY * | findConstarray (SCIP *scip, FZNINPUT *fzninput, const char *name) |
| static SCIP_RETCODE | readerdataAddOutputvar (SCIP *scip, SCIP_READERDATA *readerdata, SCIP_VAR *var, FZNNUMBERTYPE type) |
| static SCIP_RETCODE | readerdataAddOutputvararray (SCIP *scip, SCIP_READERDATA *readerdata, const char *name, SCIP_VAR **vars, int nvars, FZNNUMBERTYPE type, DIMENSIONS *info) |
| static SCIP_RETCODE | fzninputAddVararray (SCIP *scip, FZNINPUT *fzninput, const char *name, SCIP_VAR **vars, int nvars, FZNNUMBERTYPE type, DIMENSIONS *info) |
| static SCIP_RETCODE | fzninputAddConstarray (SCIP *scip, FZNINPUT *fzninput, const char *name, FZNCONSTANT **constants, int nconstants, FZNNUMBERTYPE type) |
| static SCIP_RETCODE | createQuadraticCons (SCIP *scip, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadterms, SCIP_VAR **quadvars1, SCIP_VAR **quadvars2, SCIP_Real *quadcoefs, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initialconss, SCIP_Bool dynamicconss, SCIP_Bool dynamicrows) |
| static SCIP_RETCODE | createLinearCons (SCIP *scip, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initialconss, SCIP_Bool dynamicconss, SCIP_Bool dynamicrows) |
| static SCIP_RETCODE | createLinking (SCIP *scip, FZNINPUT *fzninput, const char *consname, const char *name1, const char *name2, SCIP_Real lhs, SCIP_Real rhs) |
| static void | parseArrayIndex (SCIP *scip, FZNINPUT *fzninput, int *idx) |
| static void | flattenAssignment (SCIP *scip, FZNINPUT *fzninput, char *assignment) |
| static void | computeLinearConsSides (SCIP *scip, FZNINPUT *fzninput, const char *name, SCIP_Real sidevalue, SCIP_Real *lhs, SCIP_Real *rhs) |
| static SCIP_RETCODE | parseList (SCIP *scip, FZNINPUT *fzninput, char ***elements, int *nelements, int selements) |
| static void | parseRange (SCIP *scip, FZNINPUT *fzninput, FZNNUMBERTYPE *type, SCIP_Real *lb, SCIP_Real *ub) |
| static SCIP_RETCODE | parseOutputDimensioninfo (SCIP *scip, FZNINPUT *fzninput, DIMENSIONS **info) |
| static SCIP_RETCODE | parseName (SCIP *scip, FZNINPUT *fzninput, char *name, SCIP_Bool *output, DIMENSIONS **info) |
| static void | parseType (SCIP *scip, FZNINPUT *fzninput, FZNNUMBERTYPE *type, SCIP_Real *lb, SCIP_Real *ub) |
| static SCIP_RETCODE | applyVariableAssignment (SCIP *scip, FZNINPUT *fzninput, SCIP_VAR *var, FZNNUMBERTYPE type, const char *assignment) |
| static SCIP_RETCODE | createConstantAssignment (SCIP *scip, FZNCONSTANT **constant, FZNINPUT *fzninput, const char *name, FZNNUMBERTYPE type, const char *assignment) |
| static void | parseArrayType (SCIP *scip, FZNINPUT *fzninput, SCIP_Bool *isvararray, FZNNUMBERTYPE *type, SCIP_Real *lb, SCIP_Real *ub) |
| static SCIP_RETCODE | parseArrayAssignment (SCIP *scip, FZNINPUT *fzninput, char ***elements, int *nelements, int selements) |
| static void | parseArrayDimension (SCIP *scip, FZNINPUT *fzninput, int *nelements) |
| static SCIP_RETCODE | createVariable (SCIP *scip, FZNINPUT *fzninput, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, FZNNUMBERTYPE type) |
| static SCIP_RETCODE | parseVariableArray (SCIP *scip, SCIP_READERDATA *readerdata, FZNINPUT *fzninput, const char *name, int nvars, FZNNUMBERTYPE type, SCIP_Real lb, SCIP_Real ub, DIMENSIONS *info) |
| static SCIP_RETCODE | parseConstantArray (SCIP *scip, FZNINPUT *fzninput, const char *name, int nconstants, FZNNUMBERTYPE type) |
| static SCIP_RETCODE | parsePredicate (SCIP *scip, FZNINPUT *fzninput) |
| static SCIP_RETCODE | parseArray (SCIP *scip, SCIP_READERDATA *readerdata, FZNINPUT *fzninput) |
| static SCIP_RETCODE | parseVariable (SCIP *scip, SCIP_READERDATA *readerdata, FZNINPUT *fzninput) |
| static SCIP_RETCODE | parseConstant (SCIP *scip, FZNINPUT *fzninput, FZNNUMBERTYPE type) |
| static void | parseValue (SCIP *scip, FZNINPUT *fzninput, SCIP_Real *value, const char *assignment) |
| static SCIP_RETCODE | parseConstantArrayAssignment (SCIP *scip, FZNINPUT *fzninput, SCIP_Real **vals, int *nvals, int sizevals) |
| static SCIP_RETCODE | parseVariableArrayAssignment (SCIP *scip, FZNINPUT *fzninput, SCIP_VAR ***vars, int *nvars, int sizevars) |
| static SCIP_RETCODE | parseQuadratic (SCIP *scip, FZNINPUT *fzninput, const char *name) |
| static SCIP_RETCODE | parseAggregation (SCIP *scip, FZNINPUT *fzninput, const char *name, const char *type) |
| static SCIP_RETCODE | parseLinking (SCIP *scip, FZNINPUT *fzninput, const char *name, const char *type, SCIP_Real sidevalue) |
| static | CREATE_CONSTRAINT (createCoercionOpCons) |
| static | CREATE_CONSTRAINT (createSetOpCons) |
| static | CREATE_CONSTRAINT (createArrayOpCons) |
| static | CREATE_CONSTRAINT (createLogicalOpCons) |
| static | CREATE_CONSTRAINT (createComparisonOpCons) |
| static | CREATE_CONSTRAINT (createAlldifferentOpCons) |
| static | CREATE_CONSTRAINT (createCumulativeOpCons) |
| static | CREATE_CONSTRAINT ((*constypes[])) |
| static SCIP_RETCODE | parseConstraint (SCIP *scip, FZNINPUT *fzninput) |
| static SCIP_RETCODE | parseSolveItem (SCIP *scip, FZNINPUT *fzninput) |
| static SCIP_RETCODE | readFZNFile (SCIP *scip, SCIP_READERDATA *readerdata, FZNINPUT *fzninput, const char *filename) |
| static SCIP_RETCODE | getActiveVariables (SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed) |
| static void | writeBuffer (SCIP *scip, FILE *file, char *buffer, int bufferpos) |
| static SCIP_RETCODE | appendBuffer (SCIP *scip, char **buffer, int *bufferlen, int *bufferpos, const char *extension) |
| static void | flattenFloat (SCIP *scip, SCIP_Real val, char *buffer) |
| static SCIP_RETCODE | printRow (SCIP *scip, FZNOUTPUT *fznoutput, const char *type, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Real rhs, SCIP_Bool hasfloats) |
| static SCIP_RETCODE | printLinearCons (SCIP *scip, FZNOUTPUT *fznoutput, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool transformed, SCIP_Bool mayhavefloats) |
| static SCIP_RETCODE | writeFzn (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 (readerCopyFzn) |
| static | SCIP_DECL_READERFREE (readerFreeFzn) |
| static | SCIP_DECL_READERREAD (readerReadFzn) |
| static | SCIP_DECL_READERWRITE (readerWriteFzn) |
| SCIP_RETCODE | SCIPincludeReaderFzn (SCIP *scip) |
| SCIP_RETCODE | SCIPprintSolReaderFzn (SCIP *scip, SCIP_SOL *sol, FILE *file) |
Variables | |
| static const char | delimchars [] = " \f\n\r\t\v" |
| static const char | tokenchars [] = ":<>=;{}[],()" |
| static const char | commentchars [] = "%" |
| static int | nconstypes = 7 |
| #define READER_NAME "fznreader" |
Definition at line 50 of file reader_fzn.c.
Referenced by SCIP_DECL_READERCOPY(), SCIPincludeReaderFzn(), and SCIPprintSolReaderFzn().
| #define READER_DESC "file reader for FlatZinc format" |
Definition at line 51 of file reader_fzn.c.
Referenced by SCIPincludeReaderFzn().
| #define READER_EXTENSION "fzn" |
Definition at line 52 of file reader_fzn.c.
Referenced by SCIPincludeReaderFzn().
| #define FZN_BUFFERLEN 8192 |
size of the line buffer for reading or writing
Definition at line 55 of file reader_fzn.c.
Referenced by CREATE_CONSTRAINT(), flattenAssignment(), flattenFloat(), getNextLine(), getNextToken(), parseArray(), parseConstant(), parseConstantArray(), parseConstraint(), parseList(), parseName(), parseSolveItem(), parseVariable(), parseVariableArray(), printLinearCons(), printRow(), SCIP_DECL_READERREAD(), and writeFzn().
| #define FZN_MAX_PUSHEDTOKENS 1 |
Definition at line 56 of file reader_fzn.c.
Referenced by pushToken(), and SCIP_DECL_READERREAD().
| #define CREATE_CONSTRAINT | ( | x | ) | SCIP_RETCODE x (SCIP* scip, FZNINPUT* fzninput, const char* fname, char** ftokens, int nftokens, SCIP_Bool* created) |
tries to creates and adds a constraint; sets parameter created to TRUE if method was successful
input:
output
Definition at line 140 of file reader_fzn.c.
Referenced by CREATE_CONSTRAINT().
| typedef enum FznNumberType FZNNUMBERTYPE |
Definition at line 69 of file reader_fzn.c.
| typedef enum FznExpType FZNEXPTYPE |
Definition at line 78 of file reader_fzn.c.
| typedef struct Dimensions DIMENSIONS |
Definition at line 88 of file reader_fzn.c.
| typedef struct FznConstant FZNCONSTANT |
Definition at line 97 of file reader_fzn.c.
| typedef struct ConstArray CONSTARRAY |
Definition at line 107 of file reader_fzn.c.
| typedef struct VarArray VARARRAY |
Definition at line 118 of file reader_fzn.c.
| typedef struct FznInput FZNINPUT |
Definition at line 178 of file reader_fzn.c.
| typedef struct FznOutput FZNOUTPUT |
Definition at line 195 of file reader_fzn.c.
| enum FznNumberType |
| enum FznExpType |
Expression type in FlatZinc File
| Enumerator | |
|---|---|
| FZN_EXP_NONE | |
| FZN_EXP_UNSIGNED | |
| FZN_EXP_SIGNED | |
Definition at line 72 of file reader_fzn.c.
|
static |
gets the key (i.e. the name) of the given variable
Definition at line 207 of file reader_fzn.c.
References NULL, and SCIPvarGetName().
|
static |
gets the key (i.e. the name) of the flatzinc constant
Definition at line 217 of file reader_fzn.c.
References NULL.
|
static |
comparison method for sorting variable arrays w.r.t. to their name
Definition at line 227 of file reader_fzn.c.
|
static |
frees a given buffer char* array
| scip | SCIP data structure |
| array | buffer array to free |
| nelements | number of elements |
Definition at line 235 of file reader_fzn.c.
References SCIPfreeBufferArray.
Referenced by CREATE_CONSTRAINT(), parseAggregation(), parseConstantArray(), parseConstantArrayAssignment(), parseLinking(), parseQuadratic(), parseVariableArray(), and parseVariableArrayAssignment().
|
static |
returns whether the given character is a token delimiter
| c | input character |
Definition at line 253 of file reader_fzn.c.
References delimchars, and NULL.
Referenced by getNextToken().
|
static |
returns whether the given character is a single token
| c | input character |
Definition at line 262 of file reader_fzn.c.
References NULL, and tokenchars.
Referenced by getNextToken().
|
static |
check if the current token is equal to give char
| token | token to be checked |
| c | char to compare |
Definition at line 271 of file reader_fzn.c.
Referenced by CREATE_CONSTRAINT(), flattenAssignment(), isEndStatement(), parseArrayAssignment(), parseArrayDimension(), parseArrayIndex(), parseConstant(), parseConstantArray(), parseConstantArrayAssignment(), parseConstraint(), parseList(), parseName(), parseOutputDimensioninfo(), parseSolveItem(), parseType(), parseVariable(), parseVariableArray(), and parseVariableArrayAssignment().
check if the current token is Bool expression, this means false or true
| name | name to check |
| value | pointer to store the Bool value |
Definition at line 284 of file reader_fzn.c.
Referenced by applyVariableAssignment(), and createConstantAssignment().
|
static |
check if the current token is an identifier, this means [A-Za-z][A-Za-z0-9_]*
| name | name to check |
Definition at line 319 of file reader_fzn.c.
Referenced by flattenAssignment(), parseArrayIndex(), parseConstraint(), parseName(), parseValue(), and SCIP_DECL_READERWRITE().
|
static |
returns whether the current character is member of a value string
| 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 342 of file reader_fzn.c.
References FALSE, FZN_EXP_NONE, FZN_EXP_SIGNED, FZN_EXP_UNSIGNED, NULL, and TRUE.
Referenced by getNextToken().
compares two token if they are equal
| scip | SCIP data structure |
| token1 | first token |
| token2 | second token |
Definition at line 386 of file reader_fzn.c.
Referenced by computeLinearConsSides(), CREATE_CONSTRAINT(), findConstarray(), findVararray(), parseAggregation(), parseArrayType(), parseName(), parseRange(), parseSolveItem(), parseType(), and readFZNFile().
reads the next line from the input file into the line buffer; skips comments; returns whether a line could be read
| scip | SCIP data structure |
| fzninput | FZN reading data |
Definition at line 405 of file reader_fzn.c.
References BMSclearMemoryArray, commentchars, FALSE, FZN_BUFFERLEN, NULL, SCIPdebugMsg, SCIPfgets(), SCIPfseek(), SCIPwarningMessage(), and TRUE.
Referenced by getNextToken().
reads the next token from the input file into the token buffer; returns whether a token was read
| scip | SCIP data structure |
| fzninput | FZN reading data |
Definition at line 500 of file reader_fzn.c.
References FALSE, FZN_BUFFERLEN, FZN_EXP_NONE, getNextLine(), isDelimChar(), isTokenChar(), isValueChar(), NULL, SCIP_Bool, SCIPdebugMsg, SCIPswapPointers(), and TRUE.
Referenced by CREATE_CONSTRAINT(), flattenAssignment(), parseArrayAssignment(), parseArrayDimension(), parseArrayIndex(), parseArrayType(), parseConstant(), parseConstantArray(), parseConstantArrayAssignment(), parseConstraint(), parseList(), parseName(), parseOutputDimensioninfo(), parseRange(), parseSolveItem(), parseType(), parseVariable(), parseVariableArray(), parseVariableArrayAssignment(), and readFZNFile().
|
static |
puts the current token on the token stack, such that it is read at the next call to getNextToken()
| fzninput | FZN reading data |
Definition at line 619 of file reader_fzn.c.
References FZN_MAX_PUSHEDTOKENS, NULL, and SCIPswapPointers().
Referenced by flattenAssignment(), parseArrayType(), parseConstantArrayAssignment(), parseList(), parseName(), parseType(), parseVariable(), parseVariableArray(), parseVariableArrayAssignment(), and readFZNFile().
checks whether the current token is a semicolon which closes a statement
| fzninput | FZN reading data |
Definition at line 632 of file reader_fzn.c.
References isChar(), and NULL.
Referenced by flattenAssignment(), parseArrayIndex(), parseName(), parseType(), parseVariableArray(), and readFZNFile().
returns whether the current token is a value
| token | token to check |
| value | pointer to store the value (unchanged, if token is no value) |
Definition at line 643 of file reader_fzn.c.
References FALSE, NULL, and TRUE.
Referenced by applyVariableAssignment(), createConstantAssignment(), createLinking(), parseArrayIndex(), parseRange(), parseValue(), and parseVariableArrayAssignment().
issues an error message and marks the FlatZinc data to have errors
| scip | SCIP data structure |
| fzninput | FZN reading data |
| msg | error message |
Definition at line 669 of file reader_fzn.c.
References NULL, SCIPerrorMessage, and TRUE.
Referenced by applyVariableAssignment(), computeLinearConsSides(), CREATE_CONSTRAINT(), createConstantAssignment(), createVariable(), flattenAssignment(), parseArrayAssignment(), parseArrayDimension(), parseArrayIndex(), parseArrayType(), parseConstant(), parseConstantArray(), parseConstantArrayAssignment(), parseConstraint(), parseName(), parseOutputDimensioninfo(), parseRange(), parseSolveItem(), parseType(), parseValue(), parseVariable(), parseVariableArray(), parseVariableArrayAssignment(), and readFZNFile().
returns whether a syntax error was detected
| fzninput | FZN reading data |
Definition at line 685 of file reader_fzn.c.
References NULL.
Referenced by CREATE_CONSTRAINT(), parseAggregation(), parseArray(), parseArrayAssignment(), parseConstant(), parseConstantArray(), parseConstantArrayAssignment(), parseConstraint(), parseLinking(), parseList(), parseQuadratic(), parseSolveItem(), parseVariable(), parseVariableArray(), and readFZNFile().
|
static |
create reader data
| scip | SCIP data structure |
| readerdata | pointer to reader data |
Definition at line 696 of file reader_fzn.c.
References NULL, SCIP_CALL, SCIP_OKAY, and SCIPallocBlockMemory.
Referenced by SCIPincludeReaderFzn().
|
static |
ensure the size if the variable array
| scip | SCIP data structure |
| readerdata | reader data |
Definition at line 712 of file reader_fzn.c.
References SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemoryArray, and SCIPreallocBlockMemoryArray.
Referenced by readerdataAddOutputvar(), and readerdataAddOutputvararray().
|
static |
ensure the size if the variable array
| scip | SCIP data structure |
| fzninput | FZN reading data |
Definition at line 744 of file reader_fzn.c.
References SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemoryArray, and SCIPreallocBlockMemoryArray.
Referenced by fzninputAddVararray().
|
static |
ensure the size if the variable array
| scip | SCIP data structure |
| fzninput | FZN reading data |
Definition at line 776 of file reader_fzn.c.
References SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemoryArray, and SCIPreallocBlockMemoryArray.
Referenced by fzninputAddConstarray().
|
static |
print given value in FlatZinc format to given stream
| scip | SCIP data structure |
| file | output file (or NULL for standard output) |
| value | value to print |
| type | FlatZinc number type |
Definition at line 808 of file reader_fzn.c.
References FZN_BOOL, FZN_FLOAT, FZN_INT, SCIP_Longint, SCIPconvertRealToLongint(), SCIPinfoMessage(), and SCIPisIntegral().
Referenced by SCIPprintSolReaderFzn().
|
static |
free dimension structure
| scip | SCIP data structure |
| target | pointer to dimension target structure |
| source | dimension source |
Definition at line 852 of file reader_fzn.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, and SCIPduplicateBlockMemoryArray.
Referenced by createVararray().
|
static |
create variable array data structure
| scip | SCIP data structure |
| vararray | pointer to variable array |
| name | name of the variable array |
| vars | array of variables |
| nvars | number of variables |
| type | variable type |
| info | dimension information for output |
Definition at line 875 of file reader_fzn.c.
References copyDimensions(), SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, and SCIPduplicateBlockMemoryArray.
Referenced by fzninputAddVararray(), and readerdataAddOutputvararray().
|
static |
free dimension structure
| scip | SCIP data structure |
| dim | pointer to dimension structure |
Definition at line 904 of file reader_fzn.c.
References NULL, SCIPfreeBlockMemory, and SCIPfreeBlockMemoryArrayNull.
Referenced by freeVararray(), and parseArray().
free variable array data structure
| scip | SCIP data structure |
| vararray | pointer to variable array |
Definition at line 919 of file reader_fzn.c.
References freeDimensions(), SCIPfreeBlockMemory, and SCIPfreeBlockMemoryArray.
Referenced by SCIP_DECL_READERFREE(), and SCIP_DECL_READERREAD().
searches the variable array data base if a constant array exists with the given name; if it exists it is returned
| scip | SCIP data structure |
| fzninput | FZN reading data |
| name | variable array name |
Definition at line 934 of file reader_fzn.c.
References equalTokens(), and NULL.
Referenced by parseConstantArrayAssignment(), and parseVariableArrayAssignment().
|
static |
create constant array data structure
| scip | SCIP data structure |
| constarray | pointer to constant array |
| name | name of the variable array |
| constants | array of constants |
| nconstants | number of constants |
| type | constant type |
Definition at line 961 of file reader_fzn.c.
References SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPdebugMsg, and SCIPduplicateBlockMemoryArray.
Referenced by fzninputAddConstarray().
|
static |
free constant array data structure
| scip | SCIP data structure |
| constarray | pointer to constant array |
Definition at line 989 of file reader_fzn.c.
References SCIPdebugMsg, SCIPfreeBlockMemory, and SCIPfreeBlockMemoryArray.
Referenced by SCIP_DECL_READERREAD().
|
static |
searches the constant array data base if a constant array exists with the given name; if it exists it is returned
| scip | SCIP data structure |
| fzninput | FZN reading data |
| name | constant array name |
Definition at line 1008 of file reader_fzn.c.
References equalTokens(), and NULL.
Referenced by parseConstantArrayAssignment().
|
static |
add variable to the reader data
| scip | SCIP data structure |
| readerdata | reader data |
| var | variable to add to the reader data |
| type | variable type |
Definition at line 1031 of file reader_fzn.c.
References ensureVararrySize(), NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPduplicateBlockMemoryArray, and SCIPvarGetName().
Referenced by parseVariable().
|
static |
add variable to the reader data
| scip | SCIP data structure |
| readerdata | reader data |
| name | name of the variable array |
| vars | array of variable to add to the reader data |
| nvars | number of variables |
| type | variable type |
| info | dimension information for output |
Definition at line 1078 of file reader_fzn.c.
References createVararray(), ensureVararrySize(), SCIP_CALL, and SCIP_OKAY.
Referenced by parseVariableArray().
|
static |
add variable to the input data
| scip | SCIP data structure |
| fzninput | FZN reading data |
| name | name of the variable array |
| vars | array of variables |
| nvars | number of variables |
| type | variable type |
| info | dimension information for output |
Definition at line 1107 of file reader_fzn.c.
References createVararray(), ensureVararrySizeFznInput(), SCIP_CALL, and SCIP_OKAY.
Referenced by parseVariableArray().
|
static |
add variable to the reader data
| scip | SCIP data structure |
| fzninput | FZN reading data |
| name | name of the variable array |
| constants | array of constants |
| nconstants | number of constants |
| type | variable type |
Definition at line 1136 of file reader_fzn.c.
References createConstarray(), ensureConstarrySizeFznInput(), SCIP_CALL, and SCIP_OKAY.
Referenced by parseConstantArray().
|
static |
creates, adds, and releases a linear constraint
| scip | SCIP data structure |
| name | name of constraint |
| nlinvars | number of linear terms (n) |
| linvars | array with variables in linear part (x_i) |
| lincoefs | array with coefficients of variables in linear part (b_i) |
| nquadterms | number of quadratic terms (m) |
| quadvars1 | array with first variables in quadratic terms (y_j) |
| quadvars2 | array with second variables in quadratic terms (z_j) |
| quadcoefs | array with coefficients of quadratic terms (a_j) |
| lhs | left hand side of quadratic equation (ell) |
| rhs | right hand side of quadratic equation (u) |
| initialconss | should model constraints be marked as initial? |
| dynamicconss | should model constraints be subject to aging? |
| dynamicrows | should rows be added and removed dynamically to the LP? |
Definition at line 1164 of file reader_fzn.c.
References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPaddCons(), SCIPcreateConsQuadratic(), SCIPdebugPrintCons, SCIPreleaseCons(), and TRUE.
Referenced by parseQuadratic().
|
static |
creates, adds, and releases a linear constraint
| scip | SCIP data structure |
| name | name of constraint |
| nvars | number of nonzeros in the constraint |
| vars | array with variables of constraint entries |
| vals | array with coefficients of constraint entries |
| lhs | left hand side of constraint |
| rhs | right hand side of constraint |
| initialconss | should model constraints be marked as initial? |
| dynamicconss | should model constraints be subject to aging? |
| dynamicrows | should rows be added and removed dynamically to the LP? |
Definition at line 1196 of file reader_fzn.c.
References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPaddCons(), SCIPcreateConsLinear(), SCIPdebugPrintCons, SCIPreleaseCons(), and TRUE.
Referenced by applyVariableAssignment(), CREATE_CONSTRAINT(), createLinking(), parseAggregation(), parseConstraint(), and parseQuadratic().
|
static |
create a linking between the two given identifiers
| scip | SCIP data structure |
| fzninput | FZN reading data |
| consname | name of constraint |
| name1 | name of first identifier |
| name2 | name of second identifier |
| lhs | left hand side of the linking |
| rhs | right hand side of the linking |
Definition at line 1224 of file reader_fzn.c.
References createLinearCons(), isValue(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPhashtableRetrieve(), and SCIPisInfinity().
Referenced by parseLinking().
parse array index expression
| scip | SCIP data structure |
| fzninput | FZN reading data |
| idx | pointer to store the array index |
Definition at line 1293 of file reader_fzn.c.
References FALSE, FZN_INT, getNextToken(), isChar(), isEndStatement(), isIdentifier(), isValue(), NULL, SCIP_Real, SCIPhashtableRetrieve(), and syntaxError().
Referenced by flattenAssignment().
unroll assignment if it is an array access one
| scip | SCIP data structure |
| fzninput | FZN reading data |
| assignment | assignment to unroll |
Definition at line 1336 of file reader_fzn.c.
References FZN_BUFFERLEN, getNextToken(), isChar(), isEndStatement(), isIdentifier(), NULL, parseArrayIndex(), pushToken(), SCIPdebugMsg, SCIPsnprintf(), and syntaxError().
Referenced by CREATE_CONSTRAINT(), parseConstant(), parseConstraint(), parseList(), parseSolveItem(), and parseVariable().
|
static |
computes w.r.t. to the given side value and relation the left and right side for a SCIP linear constraint
| scip | SCIP data structure |
| fzninput | FZN reading data |
| name | name of the relation |
| sidevalue | parsed side value |
| lhs | pointer to left hand side |
| rhs | pointer to right hand side |
Definition at line 1397 of file reader_fzn.c.
References equalTokens(), SCIPdebugMsg, and syntaxError().
Referenced by CREATE_CONSTRAINT(), and parseLinking().
|
static |
parse a list of elements which is separates by a comma
| scip | SCIP data structure |
| fzninput | FZN reading data |
| elements | pointer to char* array for storing the elements of the list |
| nelements | pointer to store the number of elements |
| selements | size of the elements char* array |
Definition at line 1440 of file reader_fzn.c.
References flattenAssignment(), FZN_BUFFERLEN, getNextToken(), hasError(), isChar(), pushToken(), SCIP_CALL, SCIP_OKAY, SCIPdebugMsg, SCIPduplicateBufferArray, and SCIPreallocBufferArray.
Referenced by CREATE_CONSTRAINT(), parseAggregation(), parseArrayAssignment(), parseLinking(), and parseQuadratic().
|
static |
parse range expression
| scip | SCIP data structure |
| fzninput | FZN reading data |
| type | pointer to store the number type |
| lb | pointer to store the lower bound |
| ub | pointer to store the upper bound |
Definition at line 1493 of file reader_fzn.c.
References equalTokens(), FZN_FLOAT, FZN_INT, getNextToken(), isValue(), SCIPisIntegral(), SCIPwarningMessage(), and syntaxError().
Referenced by parseArrayDimension(), parseOutputDimensioninfo(), parseType(), and readFZNFile().
|
static |
parse dimension information
| scip | SCIP data structure |
| fzninput | FZN reading data |
| info | pointer to store the output dimension information if one |
Definition at line 1544 of file reader_fzn.c.
References FZN_INT, getNextToken(), isChar(), parseRange(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, SCIPreallocBlockMemoryArray, and syntaxError().
Referenced by parseName().
|
static |
parse identifier name without annotations
| scip | SCIP data structure |
| fzninput | FZN reading data |
| name | pointer to store the name |
| output | pointer to store if the name has the annotations to output |
| info | pointer to store the output dimension information if one |
Definition at line 1605 of file reader_fzn.c.
References equalTokens(), FALSE, FZN_BUFFERLEN, getNextToken(), isChar(), isEndStatement(), isIdentifier(), NULL, parseOutputDimensioninfo(), pushToken(), SCIP_CALL, SCIP_OKAY, SCIPsnprintf(), syntaxError(), and TRUE.
Referenced by parseArray(), parseConstant(), and parseVariable().
|
static |
parse variable/constant (array) type (integer, float, bool, or set)
| scip | SCIP data structure |
| fzninput | FZN reading data |
| type | pointer to store the number type |
| lb | pointer to store the lower bound |
| ub | pointer to store the lower bound |
Definition at line 1665 of file reader_fzn.c.
References equalTokens(), FALSE, FZN_BOOL, FZN_FLOAT, FZN_INT, getNextToken(), isChar(), isEndStatement(), parseRange(), pushToken(), SCIPdebugMsg, SCIPinfinity(), SCIPwarningMessage(), and syntaxError().
Referenced by parseArrayType(), and parseVariable().
|
static |
applies assignment
| scip | SCIP data structure |
| fzninput | FZN reading data |
| var | variable to assign something |
| type | number type |
| assignment | assignment |
Definition at line 1718 of file reader_fzn.c.
References createLinearCons(), FALSE, FZN_BOOL, isBoolExp(), isValue(), NULL, SCIP_Bool, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPhashtableRetrieve(), and syntaxError().
Referenced by parseVariable(), and parseVariableArray().
|
static |
applies constant assignment expression
| scip | SCIP data structure |
| constant | pointer to constant |
| fzninput | FZN reading data |
| name | constant name |
| type | number type |
| assignment | assignment to apply |
Definition at line 1774 of file reader_fzn.c.
References FALSE, FZN_BOOL, isBoolExp(), isValue(), NULL, SCIP_Bool, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPallocBuffer, SCIPduplicateBufferArray, SCIPhashtableInsert(), SCIPhashtableRetrieve(), SCIPreallocBufferArray, and syntaxError().
Referenced by parseConstant(), and parseConstantArray().
|
static |
parse array type ( (i) variable or constant; (ii) integer, float, bool, or set)
| scip | SCIP data structure |
| fzninput | FZN reading data |
| isvararray | pointer to store if it is a variable or constant array |
| type | pointer to store number type |
| lb | pointer to store the lower bound |
| ub | pointer to store the lower bound |
Definition at line 1842 of file reader_fzn.c.
References equalTokens(), FALSE, getNextToken(), parseType(), pushToken(), syntaxError(), and TRUE.
Referenced by parseArray().
|
static |
parse an array assignment
| scip | SCIP data structure |
| fzninput | FZN reading data |
| elements | pointer to string array to store the parsed elements |
| nelements | pointer to store the number of parsed elements |
| selements | size of the string array elements |
Definition at line 1879 of file reader_fzn.c.
References getNextToken(), hasError(), isChar(), NULL, parseList(), SCIP_CALL, SCIP_OKAY, and syntaxError().
Referenced by parseConstantArray(), parseConstantArrayAssignment(), parseVariableArray(), and parseVariableArrayAssignment().
parse array dimension
| scip | SCIP data structure |
| fzninput | FZN reading data |
| nelements | pointer to store the size of the array |
Definition at line 1913 of file reader_fzn.c.
References FZN_INT, getNextToken(), isChar(), parseRange(), SCIP_Real, and syntaxError().
Referenced by parseArray().
|
static |
creates and adds a variable to SCIP and stores it for latter use in fzninput structure
| scip | SCIP data structure |
| fzninput | FZN reading data |
| var | pointer to hold the created variable, or NULL |
| name | name of the variable |
| lb | lower bound of the variable |
| ub | upper bound of the variable |
| type | number type |
Definition at line 1952 of file reader_fzn.c.
References FZN_BOOL, FZN_FLOAT, FZN_INT, NULL, SCIP_CALL, SCIP_OKAY, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_CONTINUOUS, SCIP_VARTYPE_INTEGER, SCIPaddVar(), SCIPcreateVar(), SCIPdebug, SCIPdebugMsg, SCIPhashtableInsert(), SCIPhashtableRetrieve(), SCIPprintVar(), SCIPreleaseVar(), and syntaxError().
Referenced by parseVariable(), parseVariableArray(), parseVariableArrayAssignment(), and readFZNFile().
|
static |
parse variable array assignment and create the variables
| scip | SCIP data structure |
| readerdata | reader data |
| fzninput | FZN reading data |
| name | array name |
| nvars | number of variables |
| type | number type |
| lb | lower bound of the variables |
| ub | lower bound of the variables |
| info | dimension information |
Definition at line 2011 of file reader_fzn.c.
References applyVariableAssignment(), createVariable(), freeStringBufferArray(), FZN_BUFFERLEN, fzninputAddVararray(), getNextToken(), hasError(), isChar(), isEndStatement(), NULL, parseArrayAssignment(), pushToken(), readerdataAddOutputvararray(), SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPsnprintf(), and syntaxError().
Referenced by parseArray().
|
static |
parse constant array assignment and create the constants
| scip | SCIP data structure |
| fzninput | FZN reading data |
| name | array name |
| nconstants | number of constants |
| type | number type |
Definition at line 2088 of file reader_fzn.c.
References createConstantAssignment(), freeStringBufferArray(), FZN_BUFFERLEN, fzninputAddConstarray(), getNextToken(), hasError(), isChar(), parseArrayAssignment(), SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPsnprintf(), and syntaxError().
Referenced by parseArray().
|
static |
parse predicate expression
| scip | SCIP data structure |
| fzninput | FZN reading data |
Definition at line 2134 of file reader_fzn.c.
References SCIP_OKAY, and TRUE.
Referenced by readFZNFile().
|
static |
parse array expression
| scip | SCIP data structure |
| readerdata | reader data |
| fzninput | FZN reading data |
Definition at line 2147 of file reader_fzn.c.
References FALSE, freeDimensions(), FZN_BOOL, FZN_BUFFERLEN, FZN_INT, hasError(), NULL, parseArrayDimension(), parseArrayType(), parseConstantArray(), parseName(), parseVariableArray(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, and SCIPdebugMsg.
Referenced by readFZNFile().
|
static |
parse variable expression
| scip | SCIP data structure |
| readerdata | reader data |
| fzninput | FZN reading data |
Definition at line 2207 of file reader_fzn.c.
References applyVariableAssignment(), createVariable(), flattenAssignment(), FZN_BOOL, FZN_BUFFERLEN, FZN_FLOAT, FZN_INT, getNextToken(), hasError(), isChar(), NULL, parseName(), parseType(), pushToken(), readerdataAddOutputvar(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPdebugMsg, and syntaxError().
Referenced by readFZNFile().
|
static |
parse constant expression
| scip | SCIP data structure |
| fzninput | FZN reading data |
| type | constant type |
Definition at line 2271 of file reader_fzn.c.
References createConstantAssignment(), flattenAssignment(), FZN_BOOL, FZN_BUFFERLEN, FZN_FLOAT, FZN_INT, getNextToken(), hasError(), isChar(), NULL, parseName(), SCIP_CALL, SCIP_OKAY, SCIPdebugMsg, and syntaxError().
Referenced by readFZNFile().
|
static |
evaluates current token as constant
| scip | SCIP data structure |
| fzninput | FZN reading data |
| value | pointer to store value |
| assignment | assignment to parse a value |
Definition at line 2310 of file reader_fzn.c.
References isIdentifier(), isValue(), NULL, SCIPhashtableRetrieve(), SCIPisEQ(), SCIPvarGetLbOriginal(), SCIPvarGetUbOriginal(), and syntaxError().
Referenced by CREATE_CONSTRAINT(), parseAggregation(), parseConstantArrayAssignment(), and parseQuadratic().
|
static |
parse array expression containing constants
| scip | SCIP data structure |
| fzninput | FZN reading data |
| vals | pointer to value array |
| nvals | pointer to store the number if values |
| sizevals | size of the vals array |
Definition at line 2353 of file reader_fzn.c.
References findConstarray(), findVararray(), freeStringBufferArray(), getNextToken(), hasError(), isChar(), NULL, parseArrayAssignment(), parseValue(), pushToken(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPisEQ(), SCIPreallocBufferArray, SCIPvarGetLbOriginal(), SCIPvarGetUbOriginal(), and syntaxError().
Referenced by CREATE_CONSTRAINT(), and parseSolveItem().
|
static |
parse array expression containing variables
| scip | SCIP data structure |
| fzninput | FZN reading data |
| vars | pointer to variable array |
| nvars | pointer to store the number if variable |
| sizevars | size of the variable array |
Definition at line 2479 of file reader_fzn.c.
References createVariable(), findVararray(), freeStringBufferArray(), FZN_FLOAT, getNextToken(), isChar(), isValue(), NULL, parseArrayAssignment(), pushToken(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPhashtableRetrieve(), SCIPreallocBufferArray, and syntaxError().
Referenced by CREATE_CONSTRAINT(), and parseSolveItem().
|
static |
parse linking statement
| scip | SCIP data structure |
| fzninput | FZN reading data |
| name | name of constraint |
Definition at line 2589 of file reader_fzn.c.
References createLinearCons(), createQuadraticCons(), freeStringBufferArray(), hasError(), NULL, parseList(), parseValue(), SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPhashtableRetrieve(), and SCIPswapPointers().
Referenced by CREATE_CONSTRAINT().
|
static |
parse aggregation statement (plus, minus, negate)
| scip | SCIP data structure |
| fzninput | FZN reading data |
| name | name of constraint |
| type | linear constraint type |
Definition at line 2718 of file reader_fzn.c.
References createLinearCons(), equalTokens(), freeStringBufferArray(), hasError(), NULL, parseList(), parseValue(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, and SCIPhashtableRetrieve().
Referenced by CREATE_CONSTRAINT().
|
static |
parse linking statement
| scip | SCIP data structure |
| fzninput | FZN reading data |
| name | name of constraint |
| type | linear constraint type |
| sidevalue | side value of constraint |
Definition at line 2827 of file reader_fzn.c.
References computeLinearConsSides(), createLinking(), freeStringBufferArray(), hasError(), parseList(), SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, and SCIPallocBufferArray.
Referenced by CREATE_CONSTRAINT().
|
static |
creates a linear constraint for an array operation
Definition at line 2865 of file reader_fzn.c.
References equalTokens(), NULL, parseLinking(), SCIP_CALL, SCIP_OKAY, and TRUE.
|
static |
creates a linear constraint for an array operation
Definition at line 2883 of file reader_fzn.c.
References equalTokens(), FALSE, NULL, SCIP_OKAY, and SCIPwarningMessage().
|
static |
creates linear constraint for an array operation
Definition at line 2900 of file reader_fzn.c.
References equalTokens(), FALSE, NULL, SCIP_OKAY, and SCIPwarningMessage().
|
static |
creates a linear constraint for a logical operation
Definition at line 2917 of file reader_fzn.c.
References equalTokens(), FALSE, freeStringBufferArray(), getNextToken(), hasError(), isChar(), NULL, parseList(), parseVariableArrayAssignment(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPallocBufferArray, SCIPcreateConsAnd(), SCIPcreateConsLinear(), SCIPcreateConsOr(), SCIPcreateConsXor(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPfreeBufferArray, SCIPhashtableRetrieve(), SCIPreleaseCons(), SCIPswapPointers(), SCIPwarningMessage(), syntaxError(), and TRUE.
|
static |
creates a linear constraint for a comparison operation
Definition at line 3112 of file reader_fzn.c.
References computeLinearConsSides(), createLinearCons(), equalTokens(), FALSE, flattenAssignment(), FZN_BUFFERLEN, getNextToken(), hasError(), isChar(), NULL, parseAggregation(), parseConstantArrayAssignment(), parseLinking(), parseQuadratic(), parseValue(), parseVariableArrayAssignment(), SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPdebugMsg, SCIPfreeBufferArray, SCIPinfinity(), SCIPwarningMessage(), syntaxError(), and TRUE.
|
static |
creates an alldifferent constraint
Definition at line 3267 of file reader_fzn.c.
References equalTokens(), FALSE, NULL, parseVariableArrayAssignment(), SCIP_CALL, SCIP_OKAY, SCIPaddCons(), SCIPallocBufferArray, SCIPdebugMsg, SCIPdebugPrintCons, SCIPfreeBufferArray, SCIPreleaseCons(), and TRUE.
|
static |
creates an alldifferent constraint
Definition at line 3313 of file reader_fzn.c.
References CREATE_CONSTRAINT, equalTokens(), FALSE, flattenAssignment(), FZN_BUFFERLEN, getNextToken(), hasError(), isChar(), NULL, parseConstantArrayAssignment(), parseValue(), parseVariableArrayAssignment(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPallocBufferArray, SCIPcreateConsCumulative(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPreleaseCons(), syntaxError(), and TRUE.
|
static |
|
static |
parse constraint expression
| scip | SCIP data structure |
| fzninput | FZN reading data |
Definition at line 3440 of file reader_fzn.c.
References createLinearCons(), FALSE, flattenAssignment(), FZN_BUFFERLEN, getNextToken(), hasError(), isChar(), isIdentifier(), nconstypes, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPdebugMsg, SCIPdebugMsgPrint, SCIPduplicateBufferArray, SCIPfreeBufferArray, SCIPhashtableRetrieve(), SCIPsnprintf(), SCIPstrtok(), SCIPwarningMessage(), and syntaxError().
Referenced by readFZNFile().
|
static |
parse solve item expression
| scip | SCIP data structure |
| fzninput | FZN reading data |
Definition at line 3544 of file reader_fzn.c.
References equalTokens(), flattenAssignment(), FZN_BUFFERLEN, getNextToken(), hasError(), isChar(), MAX, NULL, parseConstantArrayAssignment(), parseVariableArrayAssignment(), SCIP_CALL, SCIP_OBJSENSE_MAXIMIZE, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPchgVarObj(), SCIPdebugMsg, SCIPfreeBufferArray, SCIPhashtableRetrieve(), and syntaxError().
Referenced by readFZNFile().
|
static |
reads a FlatZinc model
| scip | SCIP data structure |
| readerdata | reader data |
| fzninput | FZN reading data |
| filename | name of the input file |
Definition at line 3708 of file reader_fzn.c.
References createVariable(), equalTokens(), FALSE, FZN_BOOL, FZN_FLOAT, FZN_INT, getNextToken(), hasError(), isEndStatement(), NULL, parseArray(), parseConstant(), parseConstraint(), parsePredicate(), parseRange(), parseSolveItem(), parseVariable(), pushToken(), SCIP_CALL, SCIP_NOFILE, SCIP_OKAY, SCIP_Real, SCIPABORT, SCIPcreateProb(), SCIPdebugMsg, SCIPerrorMessage, SCIPfclose(), SCIPfeof(), SCIPfopen(), SCIPfreeProb(), SCIPprintSysError(), SCIPsetObjsense(), SCIPwarningMessage(), and syntaxError().
Referenced by SCIP_DECL_READERREAD().
|
static |
transforms given variables, scalars, and constant to the corresponding active variables, scalars, and constant
| scip | SCIP data structure |
| vars | vars array to get active variables for |
| scalars | 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 3876 of file reader_fzn.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPgetProbvarLinearSum(), SCIPreallocBufferArray, SCIPvarGetOrigvarSum(), and TRUE.
Referenced by printLinearCons().
|
static |
ends the given line with '\0' and prints it to the given file stream
| scip | SCIP data structure |
| file | output file (or NULL for standard output) |
| buffer | line |
| bufferpos | number of characters in buffer |
Definition at line 3920 of file reader_fzn.c.
References NULL, and SCIPinfoMessage().
Referenced by writeFzn().
|
static |
appends extension to line and prints it to the give file stream if the line buffer get full
| scip | SCIP data structure |
| buffer | buffer which should be extended |
| bufferlen | length of the buffer |
| bufferpos | current position in the buffer |
| extension | string to extend the line |
Definition at line 3940 of file reader_fzn.c.
References MAX, NULL, SCIP_CALL, SCIP_OKAY, and SCIPreallocBufferArray.
Referenced by printLinearCons(), printRow(), and writeFzn().
| scip | SCIP data structure |
| val | value to flatten |
| buffer | string buffer to print in |
Definition at line 3974 of file reader_fzn.c.
References FZN_BUFFERLEN, SCIPisIntegral(), SCIPround(), and SCIPsnprintf().
Referenced by printRow(), and writeFzn().
|
static |
| scip | SCIP data structure |
| fznoutput | output data structure containing the buffers to write to |
| type | row type ("eq", "le" or "ge") |
| vars | array of variables |
| vals | array of values |
| nvars | number of variables |
| rhs | right hand side |
| hasfloats | are there continuous variables or coefficients in the constraint? |
Definition at line 3989 of file reader_fzn.c.
References appendBuffer(), flattenFloat(), FZN_BUFFERLEN, NULL, SCIP_CALL, SCIP_OKAY, SCIPisZero(), SCIPsnprintf(), SCIPvarGetName(), and SCIPvarGetProbindex().
Referenced by printLinearCons().
|
static |
prints given linear constraint information in FZN format to file stream
| scip | SCIP data structure |
| fznoutput | output data structure containing the buffers to write to |
| vars | array of variables |
| vals | array of coefficients values (or NULL if all coefficient values are 1) |
| nvars | number of variables |
| lhs | left hand side |
| rhs | right hand side |
| transformed | transformed constraint? |
| mayhavefloats | may there be continuous variables in the constraint? |
Definition at line 4090 of file reader_fzn.c.
References appendBuffer(), FALSE, FZN_BUFFERLEN, getActiveVariables(), NULL, printRow(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_INTEGER, SCIPallocBufferArray, SCIPduplicateBufferArray, SCIPfreeBufferArray, SCIPisEQ(), SCIPisInfinity(), SCIPisIntegral(), SCIPsnprintf(), SCIPvarGetName(), SCIPvarGetProbindex(), SCIPvarGetType(), and TRUE.
Referenced by writeFzn().
|
static |
| scip | SCIP data structure |
| file | output file, or NULL if standard output should be used |
| name | problem name |
| transformed | TRUE iff problem is the transformed problem |
| objsense | objective sense |
| objscale | scalar applied to objective function; external objective value is extobj = objsense * objscale * (intobj + objoffset) |
| objoffset | objective offset from bound shifting and fixing |
| vars | array with active variables ordered binary, integer, implicit, continuous |
| nvars | number of active variables in the problem |
| nbinvars | number of binary variables |
| nintvars | number of general integer variables |
| nimplvars | number of implicit integer variables |
| ncontvars | number of continuous variables |
| conss | array with constraints of the problem |
| nconss | number of constraints in the problem |
| result | pointer to store the result of the file writing call |
Definition at line 4228 of file reader_fzn.c.
References appendBuffer(), FALSE, flattenFloat(), FZN_BUFFERLEN, NULL, printLinearCons(), SCIP_Bool, SCIP_BOUNDTYPE_LOWER, SCIP_BOUNDTYPE_UPPER, SCIP_CALL, SCIP_Longint, SCIP_MAXSTRLEN, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIP_Real, SCIP_SETPPCTYPE_COVERING, SCIP_SETPPCTYPE_PACKING, SCIP_SETPPCTYPE_PARTITIONING, SCIP_SUCCESS, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_CONTINUOUS, SCIP_VARTYPE_IMPLINT, SCIP_VARTYPE_INTEGER, SCIPallocBufferArray, SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPconsIsEnabled(), SCIPconsIsTransformed(), SCIPdebugMsg, SCIPfreeBufferArray, SCIPgetCapacityCumulative(), SCIPgetCapacityKnapsack(), SCIPgetDemandsCumulative(), SCIPgetDurationsCumulative(), SCIPgetLhsLinear(), SCIPgetLhsVarbound(), SCIPgetNVarsCumulative(), SCIPgetNVarsKnapsack(), SCIPgetNVarsLinear(), SCIPgetNVarsLogicor(), SCIPgetNVarsSetppc(), SCIPgetRhsLinear(), SCIPgetRhsVarbound(), SCIPgetTypeSetppc(), SCIPgetValsLinear(), SCIPgetVarsCumulative(), SCIPgetVarsKnapsack(), SCIPgetVarsLinear(), SCIPgetVarsLogicor(), SCIPgetVarsSetppc(), SCIPgetVarVarbound(), SCIPgetVbdcoefVarbound(), SCIPgetVbdvarVarbound(), SCIPgetWeightsKnapsack(), SCIPinfinity(), SCIPinfoMessage(), SCIPisEQ(), SCIPisFeasIntegral(), SCIPisInfinity(), SCIPisIntegral(), SCIPisZero(), SCIPsnprintf(), SCIPvarGetLbLocal(), SCIPvarGetLbOriginal(), SCIPvarGetName(), SCIPvarGetObj(), SCIPvarGetType(), SCIPvarGetUbLocal(), SCIPvarGetUbOriginal(), SCIPwarningMessage(), TRUE, and writeBuffer().
Referenced by SCIP_DECL_READERWRITE().
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 4724 of file reader_fzn.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderFzn(), and SCIPreaderGetName().
|
static |
destructor of reader to free user data (called when SCIP is exiting)
Definition at line 4739 of file reader_fzn.c.
References freeVararray(), NULL, SCIP_OKAY, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArrayNull, and SCIPreaderGetData().
|
static |
problem reading method of reader
Definition at line 4764 of file reader_fzn.c.
References FALSE, freeConstarray(), freeVararray(), FZN_BUFFERLEN, FZN_MAX_PUSHEDTOKENS, NULL, readFZNFile(), SCIP_CALL, SCIP_HASHSIZE_NAMES, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIP_READERROR, SCIP_SUCCESS, SCIPallocBufferArray, SCIPblkmem(), SCIPfreeBlockMemoryArrayNull, SCIPfreeBuffer, SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPgetBoolParam(), SCIPhashtableCreate(), SCIPhashtableFree(), SCIPreaderGetData(), and TRUE.
|
static |
problem writing method of reader
Definition at line 4858 of file reader_fzn.c.
References isIdentifier(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_SUCCESS, SCIPprintOrigProblem(), SCIPprintTransProblem(), SCIPvarGetName(), SCIPwarningMessage(), TRUE, and writeFzn().
|
static |
Definition at line 197 of file reader_fzn.c.
Referenced by getMaxAndConsDim(), and isDelimChar().
|
static |
Definition at line 198 of file reader_fzn.c.
Referenced by isTokenChar().
|
static |
Definition at line 199 of file reader_fzn.c.
Referenced by getNextLine().
|
static |
size of the function pointer array
Definition at line 3435 of file reader_fzn.c.
Referenced by parseConstraint().