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 https://www.minizinc.org. The format is described at https://github.com/MiniZinc/minizinc-doc/blob/develop/en/fzn-spec.rst.
Definition in file reader_fzn.c.
#include "blockmemshell/memory.h"
#include <ctype.h>
#include "scip/cons_nonlinear.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_setppc.h"
#include "scip/cons_varbound.h"
#include "scip/cons_xor.h"
#include "scip/pub_cons.h"
#include "scip/pub_fileio.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/pub_misc_sort.h"
#include "scip/pub_reader.h"
#include "scip/pub_var.h"
#include "scip/reader_fzn.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_sol.h"
#include "scip/scip_solvingstats.h"
#include "scip/scip_var.h"
#include <stdlib.h>
#include <string.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 65536 |
#define | FZN_INIT_LINELEN 65536 |
#define | FZN_MAX_PUSHEDTOKENS 1 |
#define | CREATE_CONSTRAINT(x) |
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 (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 (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 (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 const int | nconstypes = 7 |
#define READER_NAME "fznreader" |
Definition at line 77 of file reader_fzn.c.
#define READER_DESC "file reader for FlatZinc format" |
Definition at line 78 of file reader_fzn.c.
#define READER_EXTENSION "fzn" |
Definition at line 79 of file reader_fzn.c.
#define FZN_BUFFERLEN 65536 |
size of the line buffer for reading or writing
Definition at line 82 of file reader_fzn.c.
Referenced by CREATE_CONSTRAINT(), CREATE_CONSTRAINT(), flattenAssignment(), flattenFloat(), parseArray(), parseConstant(), parseConstantArray(), parseConstraint(), parseList(), parseName(), parseSolveItem(), parseVariable(), parseVariableArray(), printLinearCons(), printRow(), SCIP_DECL_READERREAD(), and writeFzn().
#define FZN_INIT_LINELEN 65536 |
initial size of the line buffer for reading
Definition at line 83 of file reader_fzn.c.
Referenced by SCIP_DECL_READERREAD().
#define FZN_MAX_PUSHEDTOKENS 1 |
Definition at line 84 of file reader_fzn.c.
Referenced by pushToken(), and SCIP_DECL_READERREAD().
#define CREATE_CONSTRAINT | ( | x | ) |
tries to creates and adds a constraint; sets parameter created to TRUE if method was successful
input:
output
Definition at line 168 of file reader_fzn.c.
typedef enum FznNumberType FZNNUMBERTYPE |
Definition at line 97 of file reader_fzn.c.
typedef enum FznExpType FZNEXPTYPE |
Definition at line 106 of file reader_fzn.c.
typedef struct Dimensions DIMENSIONS |
Definition at line 116 of file reader_fzn.c.
typedef struct FznConstant FZNCONSTANT |
Definition at line 125 of file reader_fzn.c.
typedef struct ConstArray CONSTARRAY |
Definition at line 135 of file reader_fzn.c.
typedef struct VarArray VARARRAY |
Definition at line 146 of file reader_fzn.c.
typedef struct FznInput FZNINPUT |
Definition at line 206 of file reader_fzn.c.
typedef struct FznOutput FZNOUTPUT |
Definition at line 223 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 100 of file reader_fzn.c.
|
static |
gets the key (i.e. the name) of the given variable
Definition at line 235 of file reader_fzn.c.
References assert(), NULL, SCIPvarGetName(), and var.
|
static |
gets the key (i.e. the name) of the flatzinc constant
Definition at line 245 of file reader_fzn.c.
|
static |
comparison method for sorting variable arrays w.r.t. to their name
Definition at line 255 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 263 of file reader_fzn.c.
References i, and 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 279 of file reader_fzn.c.
References c, delimchars, NULL, and SCIP_Bool.
Referenced by getNextToken().
|
static |
returns whether the given character is a single token
c | input character |
Definition at line 288 of file reader_fzn.c.
References c, NULL, SCIP_Bool, 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 297 of file reader_fzn.c.
References c, FALSE, SCIP_Bool, and TRUE.
Referenced by CREATE_CONSTRAINT(), CREATE_CONSTRAINT(), 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 310 of file reader_fzn.c.
References FALSE, SCIP_Bool, and TRUE.
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 345 of file reader_fzn.c.
References FALSE, i, SCIP_Bool, and TRUE.
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 368 of file reader_fzn.c.
References assert(), c, FALSE, FZN_EXP_NONE, FZN_EXP_SIGNED, FZN_EXP_UNSIGNED, NULL, SCIP_Bool, and TRUE.
Referenced by getNextToken().
|
static |
compares two token if they are equal
token1 | first token |
token2 | second token |
Definition at line 412 of file reader_fzn.c.
References assert(), FALSE, NULL, and SCIP_Bool.
Referenced by computeLinearConsSides(), CREATE_CONSTRAINT(), CREATE_CONSTRAINT(), CREATE_CONSTRAINT(), CREATE_CONSTRAINT(), CREATE_CONSTRAINT(), CREATE_CONSTRAINT(), 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 430 of file reader_fzn.c.
References assert(), BMSclearMemoryArray, commentchars, FALSE, i, NULL, SCIP_Bool, SCIP_CALL_ABORT, SCIPcalcMemGrowSize(), SCIPfgets(), SCIPreallocBlockMemoryArray, 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 488 of file reader_fzn.c.
References assert(), FALSE, FZN_EXP_NONE, getNextLine(), getNextLine(), isDelimChar(), isTokenChar(), isTokenChar(), isValueChar(), NULL, SCIP_Bool, SCIPdebugMsg, SCIPswapPointers(), and TRUE.
Referenced by CREATE_CONSTRAINT(), CREATE_CONSTRAINT(), 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 609 of file reader_fzn.c.
References assert(), 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 622 of file reader_fzn.c.
References assert(), isChar(), NULL, and SCIP_Bool.
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 633 of file reader_fzn.c.
References assert(), FALSE, NULL, SCIP_Bool, SCIP_Real, 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 659 of file reader_fzn.c.
References assert(), NULL, SCIPerrorMessage, and TRUE.
Referenced by applyVariableAssignment(), computeLinearConsSides(), CREATE_CONSTRAINT(), CREATE_CONSTRAINT(), 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 676 of file reader_fzn.c.
References assert(), NULL, and SCIP_Bool.
Referenced by CREATE_CONSTRAINT(), CREATE_CONSTRAINT(), 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 687 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 703 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 735 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 767 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 799 of file reader_fzn.c.
References FZN_BOOL, FZN_FLOAT, FZN_INT, printValue(), SCIP_Longint, SCIP_LONGINT_FORMAT, SCIP_Real, SCIPconvertRealToLongint(), SCIPinfoMessage(), and SCIPisIntegral().
Referenced by printValue(), SCIP_DECL_EXPRPRINT(), SCIPincludeExprhdlrValue(), and SCIPprintSolReaderFzn().
|
static |
free dimension structure
scip | SCIP data structure |
target | pointer to dimension target structure |
source | dimension source |
Definition at line 843 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 866 of file reader_fzn.c.
References copyDimensions(), nvars, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPduplicateBlockMemoryArray, and vars.
Referenced by fzninputAddVararray(), and readerdataAddOutputvararray().
|
static |
free dimension structure
scip | SCIP data structure |
dim | pointer to dimension structure |
Definition at line 895 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 910 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
fzninput | FZN reading data |
name | variable array name |
Definition at line 925 of file reader_fzn.c.
References c, 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 951 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 979 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
fzninput | FZN reading data |
name | constant array name |
Definition at line 998 of file reader_fzn.c.
References c, 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 1020 of file reader_fzn.c.
References assert(), ensureVararrySize(), NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPduplicateBlockMemoryArray, SCIPvarGetName(), and var.
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 1067 of file reader_fzn.c.
References assert(), createVararray(), ensureVararrySize(), nvars, SCIP_CALL, SCIP_OKAY, and vars.
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 1096 of file reader_fzn.c.
References assert(), createVararray(), ensureVararrySizeFznInput(), nvars, SCIP_CALL, SCIP_OKAY, and vars.
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 1125 of file reader_fzn.c.
References assert(), createConstarray(), ensureConstarrySizeFznInput(), SCIP_CALL, and SCIP_OKAY.
Referenced by parseConstantArray().
|
static |
creates, adds, and releases a quadratic 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 1153 of file reader_fzn.c.
References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPcreateConsQuadraticNonlinear(), 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 1186 of file reader_fzn.c.
References FALSE, NULL, nvars, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPcreateConsLinear(), SCIPdebugPrintCons, SCIPreleaseCons(), TRUE, and vars.
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 1214 of file reader_fzn.c.
References assert(), createLinearCons(), isValue(), NULL, nvars, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPhashtableRetrieve(), SCIPisInfinity(), and vars.
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 1283 of file reader_fzn.c.
References assert(), 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 1326 of file reader_fzn.c.
References assert(), FZN_BUFFERLEN, getNextToken(), isChar(), isEndStatement(), isIdentifier(), NULL, parseArrayIndex(), pushToken(), SCIPdebugMsg, SCIPsnprintf(), and syntaxError().
Referenced by CREATE_CONSTRAINT(), 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 1387 of file reader_fzn.c.
References equalTokens(), SCIP_Real, 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 1430 of file reader_fzn.c.
References assert(), 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 1482 of file reader_fzn.c.
References equalTokens(), FZN_FLOAT, FZN_INT, getNextToken(), isValue(), SCIP_Real, 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 1533 of file reader_fzn.c.
References assert(), FZN_INT, getNextToken(), isChar(), parseRange(), SCIP_CALL, SCIP_INVALID, 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 1594 of file reader_fzn.c.
References assert(), equalTokens(), FALSE, FZN_BUFFERLEN, getNextToken(), isChar(), isEndStatement(), isIdentifier(), NULL, parseOutputDimensioninfo(), pushToken(), SCIP_Bool, 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 1654 of file reader_fzn.c.
References assert(), equalTokens(), FALSE, FZN_BOOL, FZN_FLOAT, FZN_INT, getNextToken(), isChar(), isEndStatement(), parseRange(), pushToken(), SCIP_Real, 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 1707 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(), syntaxError(), var, and vars.
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 1763 of file reader_fzn.c.
References assert(), 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 1831 of file reader_fzn.c.
References equalTokens(), FALSE, getNextToken(), parseType(), pushToken(), SCIP_Bool, SCIP_Real, 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 1868 of file reader_fzn.c.
References assert(), 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 1902 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 1941 of file reader_fzn.c.
References assert(), FZN_BOOL, FZN_FLOAT, FZN_INT, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_CONTINUOUS, SCIP_VARTYPE_INTEGER, SCIPaddVar(), SCIPcreateVar(), SCIPdebug, SCIPdebugMsg, SCIPhashtableInsert(), SCIPhashtableRetrieve(), SCIPprintVar(), SCIPreleaseVar(), syntaxError(), and var.
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 2000 of file reader_fzn.c.
References applyVariableAssignment(), assert(), createVariable(), freeStringBufferArray(), FZN_BUFFERLEN, fzninputAddVararray(), getNextToken(), hasError(), isChar(), isEndStatement(), NULL, nvars, parseArrayAssignment(), pushToken(), readerdataAddOutputvararray(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPsnprintf(), syntaxError(), and vars.
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 2077 of file reader_fzn.c.
References c, 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 2123 of file reader_fzn.c.
References assert(), NULL, 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 2138 of file reader_fzn.c.
References assert(), 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 2198 of file reader_fzn.c.
References applyVariableAssignment(), assert(), 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, syntaxError(), and var.
Referenced by readFZNFile().
|
static |
parse constant expression
scip | SCIP data structure |
fzninput | FZN reading data |
type | constant type |
Definition at line 2262 of file reader_fzn.c.
References assert(), 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 2301 of file reader_fzn.c.
References isIdentifier(), isValue(), NULL, SCIP_Real, SCIPhashtableRetrieve(), SCIPisEQ(), SCIPvarGetLbOriginal(), SCIPvarGetUbOriginal(), syntaxError(), and var.
Referenced by CREATE_CONSTRAINT(), 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 2344 of file reader_fzn.c.
References assert(), c, findConstarray(), findVararray(), freeStringBufferArray(), getNextToken(), hasError(), isChar(), NULL, nvars, parseArrayAssignment(), parseValue(), pushToken(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPisEQ(), SCIPreallocBufferArray, SCIPvarGetLbOriginal(), SCIPvarGetUbOriginal(), syntaxError(), and var.
Referenced by CREATE_CONSTRAINT(), 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 2470 of file reader_fzn.c.
References assert(), createVariable(), findVararray(), freeStringBufferArray(), FZN_FLOAT, getNextToken(), isChar(), isValue(), NULL, nvars, parseArrayAssignment(), pushToken(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPhashtableRetrieve(), SCIPreallocBufferArray, syntaxError(), and vars.
Referenced by CREATE_CONSTRAINT(), CREATE_CONSTRAINT(), CREATE_CONSTRAINT(), CREATE_CONSTRAINT(), and parseSolveItem().
|
static |
parse linking statement
scip | SCIP data structure |
fzninput | FZN reading data |
name | name of constraint |
Definition at line 2580 of file reader_fzn.c.
References assert(), createLinearCons(), createQuadraticCons(), freeStringBufferArray(), hasError(), NULL, nvars, parseList(), parseValue(), SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPhashtableRetrieve(), SCIPswapPointers(), and vars.
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 2709 of file reader_fzn.c.
References assert(), createLinearCons(), equalTokens(), freeStringBufferArray(), hasError(), NULL, nvars, parseList(), parseValue(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPhashtableRetrieve(), and vars.
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 2818 of file reader_fzn.c.
References assert(), computeLinearConsSides(), createLinking(), freeStringBufferArray(), hasError(), parseList(), SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, and SCIPallocBufferArray.
Referenced by CREATE_CONSTRAINT(), and CREATE_CONSTRAINT().
|
static |
creates a linear constraint for an array operation
Definition at line 2856 of file reader_fzn.c.
References assert(), equalTokens(), NULL, parseLinking(), SCIP_CALL, SCIP_OKAY, and TRUE.
|
static |
creates a linear constraint for an array operation
Definition at line 2874 of file reader_fzn.c.
References assert(), equalTokens(), FALSE, NULL, SCIP_OKAY, and SCIPwarningMessage().
|
static |
creates linear constraint for an array operation
Definition at line 2891 of file reader_fzn.c.
References assert(), equalTokens(), FALSE, NULL, SCIP_OKAY, and SCIPwarningMessage().
|
static |
creates a linear constraint for a logical operation
Definition at line 2908 of file reader_fzn.c.
References assert(), equalTokens(), FALSE, freeStringBufferArray(), getNextToken(), hasError(), isChar(), NULL, nvars, parseList(), parseVariableArrayAssignment(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPallocBufferArray, SCIPcreateConsAnd(), SCIPcreateConsLinear(), SCIPcreateConsOr(), SCIPcreateConsXor(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPfreeBufferArray, SCIPhashtableRetrieve(), SCIPreleaseCons(), SCIPswapPointers(), SCIPwarningMessage(), syntaxError(), TRUE, and vars.
|
static |
creates a linear constraint for a comparison operation
Definition at line 3101 of file reader_fzn.c.
References assert(), computeLinearConsSides(), createLinearCons(), equalTokens(), FALSE, flattenAssignment(), FZN_BUFFERLEN, getNextToken(), hasError(), isChar(), NULL, nvars, parseAggregation(), parseConstantArrayAssignment(), parseLinking(), parseQuadratic(), parseValue(), parseVariableArrayAssignment(), SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPdebugMsg, SCIPfreeBufferArray, SCIPinfinity(), SCIPwarningMessage(), syntaxError(), TRUE, and vars.
|
static |
creates an alldifferent constraint
Definition at line 3256 of file reader_fzn.c.
References assert(), equalTokens(), FALSE, NULL, nvars, parseVariableArrayAssignment(), SCIP_CALL, SCIP_OKAY, SCIPaddCons(), SCIPallocBufferArray, SCIPdebugMsg, SCIPdebugPrintCons, SCIPfreeBufferArray, SCIPreleaseCons(), TRUE, and vars.
|
static |
creates an alldifferent constraint
Definition at line 3302 of file reader_fzn.c.
References assert(), equalTokens(), FALSE, flattenAssignment(), FZN_BUFFERLEN, getNextToken(), hasError(), i, isChar(), NULL, nvars, parseConstantArrayAssignment(), parseValue(), parseVariableArrayAssignment(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPallocBufferArray, SCIPcreateConsCumulative(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPreleaseCons(), syntaxError(), TRUE, and vars.
|
static |
|
static |
parse constraint expression
scip | SCIP data structure |
fzninput | FZN reading data |
Definition at line 3429 of file reader_fzn.c.
References assert(), c, createLinearCons(), FALSE, flattenAssignment(), FZN_BUFFERLEN, getNextToken(), hasError(), i, isChar(), isIdentifier(), nconstypes, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPdebugMsg, SCIPdebugMsgPrint, SCIPduplicateBufferArray, SCIPfreeBufferArray, SCIPhashtableRetrieve(), SCIPsnprintf(), SCIPstrtok(), SCIPwarningMessage(), syntaxError(), and var.
Referenced by readFZNFile().
|
static |
parse solve item expression
scip | SCIP data structure |
fzninput | FZN reading data |
Definition at line 3533 of file reader_fzn.c.
References assert(), equalTokens(), flattenAssignment(), FZN_BUFFERLEN, getNextToken(), hasError(), isChar(), MAX, NULL, nvars, parseConstantArrayAssignment(), parseVariableArrayAssignment(), SCIP_CALL, SCIP_OBJSENSE_MAXIMIZE, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPchgVarObj(), SCIPdebugMsg, SCIPfreeBufferArray, SCIPhashtableRetrieve(), syntaxError(), var, and vars.
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 3697 of file reader_fzn.c.
References assert(), createVariable(), equalTokens(), FALSE, FZN_BOOL, FZN_FLOAT, FZN_INT, getNextToken(), hasError(), 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 | 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 3864 of file reader_fzn.c.
References assert(), NULL, nvars, scalars, SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIP_VARSTATUS_NEGATED, SCIPABORT, SCIPerrorMessage, SCIPgetProbvarLinearSum(), SCIPreallocBufferArray, SCIPvarGetNegatedVar(), SCIPvarGetOrigvarSum(), SCIPvarGetStatus(), TRUE, and vars.
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 3926 of file reader_fzn.c.
References assert(), 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 3946 of file reader_fzn.c.
References assert(), MAX, NULL, SCIP_CALL, SCIP_OKAY, SCIPreallocBufferArray, and SCIPstrncpy().
Referenced by printLinearCons(), printRow(), and writeFzn().
scip | SCIP data structure |
val | value to flatten |
buffer | string buffer to print in |
Definition at line 3982 of file reader_fzn.c.
References FZN_BUFFERLEN, SCIP_Real, 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 3996 of file reader_fzn.c.
References appendBuffer(), assert(), flattenFloat(), FZN_BUFFERLEN, NULL, nvars, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPisZero(), SCIPsnprintf(), SCIPvarGetName(), SCIPvarGetProbindex(), var, and vars.
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 4099 of file reader_fzn.c.
References appendBuffer(), assert(), FALSE, FZN_BUFFERLEN, getActiveVariables(), NULL, nvars, printRow(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_INTEGER, SCIPallocBufferArray, SCIPduplicateBufferArray, SCIPfreeBufferArrayNull, SCIPisEQ(), SCIPisInfinity(), SCIPisIntegral(), SCIPsnprintf(), SCIPvarGetName(), SCIPvarGetProbindex(), SCIPvarGetType(), TRUE, var, and vars.
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 4235 of file reader_fzn.c.
References appendBuffer(), assert(), c, FALSE, flattenFloat(), FZN_BUFFERLEN, nbinvars, nintvars, NULL, nvars, obj, objscale, printLinearCons(), result, 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, var, vars, and writeBuffer().
Referenced by SCIP_DECL_READERWRITE().
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 4731 of file reader_fzn.c.
References assert(), 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 4746 of file reader_fzn.c.
References assert(), freeVararray(), NULL, SCIP_OKAY, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArrayNull, and SCIPreaderGetData().
|
static |
problem reading method of reader
Definition at line 4771 of file reader_fzn.c.
References FALSE, freeConstarray(), freeVararray(), FZN_BUFFERLEN, FZN_INIT_LINELEN, FZN_MAX_PUSHEDTOKENS, i, NULL, readFZNFile(), result, SCIP_CALL, SCIP_HASHSIZE_NAMES, SCIP_OBJSENSE_MINIMIZE, SCIP_OKAY, SCIP_READERROR, SCIP_SUCCESS, SCIPallocBlockMemoryArray, SCIPallocBufferArray, SCIPblkmem(), SCIPfreeBlockMemoryArray, SCIPfreeBlockMemoryArrayNull, SCIPfreeBuffer, SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPgetBoolParam(), SCIPhashtableCreate(), SCIPhashtableFree(), SCIPreaderGetData(), and TRUE.
|
static |
problem writing method of reader
Definition at line 4868 of file reader_fzn.c.
References i, isIdentifier(), nbinvars, nintvars, nvars, objscale, result, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_SUCCESS, SCIPprintOrigProblem(), SCIPprintTransProblem(), SCIPvarGetName(), SCIPwarningMessage(), TRUE, vars, and writeFzn().
|
static |
Definition at line 225 of file reader_fzn.c.
Referenced by getMaxAndConsDim(), isDelimChar(), isDelimChar(), and isDelimChar().
|
static |
Definition at line 226 of file reader_fzn.c.
Referenced by isTokenChar(), and isTokenChar().
|
static |
Definition at line 227 of file reader_fzn.c.
|
static |
size of the function pointer array
Definition at line 3424 of file reader_fzn.c.
Referenced by parseConstraint().