Detailed Description
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) 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 (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 |
Macro Definition Documentation
◆ READER_NAME
#define READER_NAME "fznreader" |
Definition at line 77 of file reader_fzn.c.
Referenced by SCIP_DECL_READERCOPY(), SCIPincludeReaderFzn(), and SCIPprintSolReaderFzn().
◆ READER_DESC
#define READER_DESC "file reader for FlatZinc format" |
Definition at line 78 of file reader_fzn.c.
Referenced by SCIPincludeReaderFzn().
◆ READER_EXTENSION
#define READER_EXTENSION "fzn" |
Definition at line 79 of file reader_fzn.c.
Referenced by SCIPincludeReaderFzn().
◆ FZN_BUFFERLEN
#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(), flattenAssignment(), flattenFloat(), parseArray(), parseConstant(), parseConstantArray(), parseConstraint(), parseList(), parseName(), parseSolveItem(), parseVariable(), parseVariableArray(), printLinearCons(), printRow(), SCIP_DECL_READERREAD(), and writeFzn().
◆ FZN_INIT_LINELEN
#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().
◆ FZN_MAX_PUSHEDTOKENS
#define FZN_MAX_PUSHEDTOKENS 1 |
Definition at line 84 of file reader_fzn.c.
Referenced by pushToken(), and SCIP_DECL_READERREAD().
◆ CREATE_CONSTRAINT
#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:
- scip : SCIP main data structure
- fzninput, : FZN reading data
- fname, : functions identifier name
- ftokens, : function identifier tokens
- nftokens, : number of function identifier tokes
output
- created : pointer to store whether a constraint was created or not
Definition at line 168 of file reader_fzn.c.
Referenced by CREATE_CONSTRAINT().
Typedef Documentation
◆ FZNNUMBERTYPE
typedef enum FznNumberType FZNNUMBERTYPE |
Definition at line 97 of file reader_fzn.c.
◆ FZNEXPTYPE
typedef enum FznExpType FZNEXPTYPE |
Definition at line 106 of file reader_fzn.c.
◆ DIMENSIONS
typedef struct Dimensions DIMENSIONS |
Definition at line 116 of file reader_fzn.c.
◆ FZNCONSTANT
typedef struct FznConstant FZNCONSTANT |
Definition at line 125 of file reader_fzn.c.
◆ CONSTARRAY
typedef struct ConstArray CONSTARRAY |
Definition at line 135 of file reader_fzn.c.
◆ VARARRAY
typedef struct VarArray VARARRAY |
Definition at line 146 of file reader_fzn.c.
◆ FZNINPUT
typedef struct FznInput FZNINPUT |
Definition at line 206 of file reader_fzn.c.
◆ FZNOUTPUT
typedef struct FznOutput FZNOUTPUT |
Definition at line 223 of file reader_fzn.c.
Enumeration Type Documentation
◆ FznNumberType
enum FznNumberType |
◆ FznExpType
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.
Function Documentation
◆ SCIP_DECL_HASHGETKEY() [1/2]
|
static |
gets the key (i.e. the name) of the given variable
Definition at line 235 of file reader_fzn.c.
References NULL, and SCIPvarGetName().
◆ SCIP_DECL_HASHGETKEY() [2/2]
|
static |
gets the key (i.e. the name) of the flatzinc constant
Definition at line 245 of file reader_fzn.c.
References NULL.
◆ SCIP_DECL_SORTPTRCOMP()
|
static |
comparison method for sorting variable arrays w.r.t. to their name
Definition at line 255 of file reader_fzn.c.
◆ freeStringBufferArray()
|
static |
frees a given buffer char* array
- Parameters
-
scip SCIP data structure array buffer array to free nelements number of elements
Definition at line 263 of file reader_fzn.c.
References SCIPfreeBufferArray.
Referenced by CREATE_CONSTRAINT(), parseAggregation(), parseConstantArray(), parseConstantArrayAssignment(), parseLinking(), parseQuadratic(), parseVariableArray(), and parseVariableArrayAssignment().
◆ isDelimChar()
|
static |
returns whether the given character is a token delimiter
- Parameters
-
c input character
Definition at line 279 of file reader_fzn.c.
References delimchars, and NULL.
Referenced by getNextToken().
◆ isTokenChar()
|
static |
returns whether the given character is a single token
- Parameters
-
c input character
Definition at line 288 of file reader_fzn.c.
References NULL, and tokenchars.
Referenced by getNextToken().
◆ isChar()
|
static |
check if the current token is equal to give char
- Parameters
-
token token to be checked c char to compare
Definition at line 297 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().
◆ isBoolExp()
check if the current token is Bool expression, this means false or true
- Parameters
-
name name to check value pointer to store the Bool value
Definition at line 310 of file reader_fzn.c.
Referenced by applyVariableAssignment(), and createConstantAssignment().
◆ isIdentifier()
|
static |
check if the current token is an identifier, this means [A-Za-z][A-Za-z0-9_]*
- Parameters
-
name name to check
Definition at line 345 of file reader_fzn.c.
Referenced by flattenAssignment(), parseArrayIndex(), parseConstraint(), parseName(), parseValue(), and SCIP_DECL_READERWRITE().
◆ isValueChar()
|
static |
returns whether the current character is member of a value string
- Parameters
-
c input character nextc next input character firstchar is the given character the first char of the token? hasdot pointer to update the dot flag exptype pointer to update the exponent type
Definition at line 368 of file reader_fzn.c.
References FALSE, FZN_EXP_NONE, FZN_EXP_SIGNED, FZN_EXP_UNSIGNED, NULL, and TRUE.
Referenced by getNextToken().
◆ equalTokens()
|
static |
compares two token if they are equal
- Parameters
-
token1 first token token2 second token
Definition at line 412 of file reader_fzn.c.
Referenced by computeLinearConsSides(), CREATE_CONSTRAINT(), findConstarray(), findVararray(), parseAggregation(), parseArrayType(), parseName(), parseRange(), parseSolveItem(), parseType(), and readFZNFile().
◆ getNextLine()
reads the next line from the input file into the line buffer; skips comments; returns whether a line could be read
- Parameters
-
scip SCIP data structure fzninput FZN reading data
Definition at line 430 of file reader_fzn.c.
References BMSclearMemoryArray, commentchars, FALSE, NULL, SCIP_CALL_ABORT, SCIPcalcMemGrowSize(), SCIPfgets(), SCIPreallocBlockMemoryArray, and TRUE.
Referenced by getNextToken().
◆ getNextToken()
reads the next token from the input file into the token buffer; returns whether a token was read
- Parameters
-
scip SCIP data structure fzninput FZN reading data
Definition at line 488 of file reader_fzn.c.
References FALSE, 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().
◆ pushToken()
|
static |
puts the current token on the token stack, such that it is read at the next call to getNextToken()
- Parameters
-
fzninput FZN reading data
Definition at line 609 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().
◆ isEndStatement()
checks whether the current token is a semicolon which closes a statement
- Parameters
-
fzninput FZN reading data
Definition at line 622 of file reader_fzn.c.
References isChar(), and NULL.
Referenced by flattenAssignment(), parseArrayIndex(), parseName(), parseType(), parseVariableArray(), and readFZNFile().
◆ isValue()
returns whether the current token is a value
- Parameters
-
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 FALSE, NULL, and TRUE.
Referenced by applyVariableAssignment(), createConstantAssignment(), createLinking(), parseArrayIndex(), parseRange(), parseValue(), and parseVariableArrayAssignment().
◆ syntaxError()
issues an error message and marks the FlatZinc data to have errors
- Parameters
-
scip SCIP data structure fzninput FZN reading data msg error message
Definition at line 659 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().
◆ hasError()
returns whether a syntax error was detected
- Parameters
-
fzninput FZN reading data
Definition at line 676 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().
◆ readerdataCreate()
|
static |
create reader data
- Parameters
-
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().
◆ ensureVararrySize()
|
static |
ensure the size if the variable array
- Parameters
-
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().
◆ ensureVararrySizeFznInput()
|
static |
ensure the size if the variable array
- Parameters
-
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().
◆ ensureConstarrySizeFznInput()
|
static |
ensure the size if the variable array
- Parameters
-
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().
◆ printValue()
|
static |
print given value in FlatZinc format to given stream
- Parameters
-
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, SCIP_Longint, SCIPconvertRealToLongint(), SCIPinfoMessage(), and SCIPisIntegral().
Referenced by SCIPincludeExprhdlrValue(), and SCIPprintSolReaderFzn().
◆ copyDimensions()
|
static |
free dimension structure
- Parameters
-
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().
◆ createVararray()
|
static |
create variable array data structure
- Parameters
-
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(), SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, and SCIPduplicateBlockMemoryArray.
Referenced by fzninputAddVararray(), and readerdataAddOutputvararray().
◆ freeDimensions()
|
static |
free dimension structure
- Parameters
-
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().
◆ freeVararray()
free variable array data structure
- Parameters
-
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().
◆ findVararray()
searches the variable array data base if a constant array exists with the given name; if it exists it is returned
- Parameters
-
fzninput FZN reading data name variable array name
Definition at line 925 of file reader_fzn.c.
References equalTokens(), and NULL.
Referenced by parseConstantArrayAssignment(), and parseVariableArrayAssignment().
◆ createConstarray()
|
static |
create constant array data structure
- Parameters
-
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().
◆ freeConstarray()
|
static |
free constant array data structure
- Parameters
-
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().
◆ findConstarray()
|
static |
searches the constant array data base if a constant array exists with the given name; if it exists it is returned
- Parameters
-
fzninput FZN reading data name constant array name
Definition at line 998 of file reader_fzn.c.
References equalTokens(), and NULL.
Referenced by parseConstantArrayAssignment().
◆ readerdataAddOutputvar()
|
static |
add variable to the reader data
- Parameters
-
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 ensureVararrySize(), NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPduplicateBlockMemoryArray, and SCIPvarGetName().
Referenced by parseVariable().
◆ readerdataAddOutputvararray()
|
static |
add variable to the reader data
- Parameters
-
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 createVararray(), ensureVararrySize(), SCIP_CALL, and SCIP_OKAY.
Referenced by parseVariableArray().
◆ fzninputAddVararray()
|
static |
add variable to the input data
- Parameters
-
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 createVararray(), ensureVararrySizeFznInput(), SCIP_CALL, and SCIP_OKAY.
Referenced by parseVariableArray().
◆ fzninputAddConstarray()
|
static |
add variable to the reader data
- Parameters
-
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 createConstarray(), ensureConstarrySizeFznInput(), SCIP_CALL, and SCIP_OKAY.
Referenced by parseConstantArray().
◆ createQuadraticCons()
|
static |
creates, adds, and releases a quadratic constraint
- Parameters
-
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_CALL, SCIP_OKAY, SCIPaddCons(), SCIPcreateConsQuadraticNonlinear(), SCIPdebugPrintCons, SCIPreleaseCons(), and TRUE.
Referenced by parseQuadratic().
◆ createLinearCons()
|
static |
creates, adds, and releases a linear constraint
- Parameters
-
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, SCIP_CALL, SCIP_OKAY, SCIPaddCons(), SCIPcreateConsLinear(), SCIPdebugPrintCons, SCIPreleaseCons(), and TRUE.
Referenced by applyVariableAssignment(), CREATE_CONSTRAINT(), createLinking(), parseAggregation(), parseConstraint(), and parseQuadratic().
◆ createLinking()
|
static |
create a linking between the two given identifiers
- Parameters
-
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 createLinearCons(), isValue(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPhashtableRetrieve(), and SCIPisInfinity().
Referenced by parseLinking().
◆ parseArrayIndex()
parse array index expression
- Parameters
-
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 FALSE, FZN_INT, getNextToken(), isChar(), isEndStatement(), isIdentifier(), isValue(), NULL, SCIP_Real, SCIPhashtableRetrieve(), and syntaxError().
Referenced by flattenAssignment().
◆ flattenAssignment()
unroll assignment if it is an array access one
- Parameters
-
scip SCIP data structure fzninput FZN reading data assignment assignment to unroll
Definition at line 1326 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().
◆ computeLinearConsSides()
|
static |
computes w.r.t. to the given side value and relation the left and right side for a SCIP linear constraint
- Parameters
-
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(), SCIPdebugMsg, and syntaxError().
Referenced by CREATE_CONSTRAINT(), and parseLinking().
◆ parseList()
|
static |
parse a list of elements which is separates by a comma
- Parameters
-
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 flattenAssignment(), FZN_BUFFERLEN, getNextToken(), hasError(), isChar(), pushToken(), SCIP_CALL, SCIP_OKAY, SCIPdebugMsg, SCIPduplicateBufferArray, and SCIPreallocBufferArray.
Referenced by CREATE_CONSTRAINT(), parseAggregation(), parseArrayAssignment(), parseLinking(), and parseQuadratic().
◆ parseRange()
|
static |
parse range expression
- Parameters
-
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(), SCIPisIntegral(), SCIPwarningMessage(), and syntaxError().
Referenced by parseArrayDimension(), parseOutputDimensioninfo(), parseType(), and readFZNFile().
◆ parseOutputDimensioninfo()
|
static |
parse dimension information
- Parameters
-
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 FZN_INT, getNextToken(), isChar(), parseRange(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, SCIPreallocBlockMemoryArray, and syntaxError().
Referenced by parseName().
◆ parseName()
|
static |
parse identifier name without annotations
- Parameters
-
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 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().
◆ parseType()
|
static |
parse variable/constant (array) type (integer, float, bool, or set)
- Parameters
-
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 equalTokens(), FALSE, FZN_BOOL, FZN_FLOAT, FZN_INT, getNextToken(), isChar(), isEndStatement(), parseRange(), pushToken(), SCIPdebugMsg, SCIPinfinity(), SCIPwarningMessage(), and syntaxError().
Referenced by parseArrayType(), and parseVariable().
◆ applyVariableAssignment()
|
static |
applies assignment
- Parameters
-
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(), and syntaxError().
Referenced by parseVariable(), and parseVariableArray().
◆ createConstantAssignment()
|
static |
applies constant assignment expression
- Parameters
-
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 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().
◆ parseArrayType()
|
static |
parse array type ( (i) variable or constant; (ii) integer, float, bool, or set)
- Parameters
-
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(), syntaxError(), and TRUE.
Referenced by parseArray().
◆ parseArrayAssignment()
|
static |
parse an array assignment
- Parameters
-
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 getNextToken(), hasError(), isChar(), NULL, parseList(), SCIP_CALL, SCIP_OKAY, and syntaxError().
Referenced by parseConstantArray(), parseConstantArrayAssignment(), parseVariableArray(), and parseVariableArrayAssignment().
◆ parseArrayDimension()
parse array dimension
- Parameters
-
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().
◆ createVariable()
|
static |
creates and adds a variable to SCIP and stores it for latter use in fzninput structure
- Parameters
-
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 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().
◆ parseVariableArray()
|
static |
parse variable array assignment and create the variables
- Parameters
-
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(), 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().
◆ parseConstantArray()
|
static |
parse constant array assignment and create the constants
- Parameters
-
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 createConstantAssignment(), freeStringBufferArray(), FZN_BUFFERLEN, fzninputAddConstarray(), getNextToken(), hasError(), isChar(), parseArrayAssignment(), SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPsnprintf(), and syntaxError().
Referenced by parseArray().
◆ parsePredicate()
|
static |
parse predicate expression
- Parameters
-
scip SCIP data structure fzninput FZN reading data
Definition at line 2123 of file reader_fzn.c.
References NULL, SCIP_OKAY, and TRUE.
Referenced by readFZNFile().
◆ parseArray()
|
static |
parse array expression
- Parameters
-
scip SCIP data structure readerdata reader data fzninput FZN reading data
Definition at line 2138 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().
◆ parseVariable()
|
static |
parse variable expression
- Parameters
-
scip SCIP data structure readerdata reader data fzninput FZN reading data
Definition at line 2198 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().
◆ parseConstant()
|
static |
parse constant expression
- Parameters
-
scip SCIP data structure fzninput FZN reading data type constant type
Definition at line 2262 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().
◆ parseValue()
|
static |
evaluates current token as constant
- Parameters
-
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, SCIPhashtableRetrieve(), SCIPisEQ(), SCIPvarGetLbOriginal(), SCIPvarGetUbOriginal(), and syntaxError().
Referenced by CREATE_CONSTRAINT(), parseAggregation(), parseConstantArrayAssignment(), and parseQuadratic().
◆ parseConstantArrayAssignment()
|
static |
parse array expression containing constants
- Parameters
-
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 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().
◆ parseVariableArrayAssignment()
|
static |
parse array expression containing variables
- Parameters
-
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 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().
◆ parseQuadratic()
|
static |
parse linking statement
- Parameters
-
scip SCIP data structure fzninput FZN reading data name name of constraint
Definition at line 2580 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().
◆ parseAggregation()
|
static |
parse aggregation statement (plus, minus, negate)
- Parameters
-
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 createLinearCons(), equalTokens(), freeStringBufferArray(), hasError(), NULL, parseList(), parseValue(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, and SCIPhashtableRetrieve().
Referenced by CREATE_CONSTRAINT().
◆ parseLinking()
|
static |
parse linking statement
- Parameters
-
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 computeLinearConsSides(), createLinking(), freeStringBufferArray(), hasError(), parseList(), SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, and SCIPallocBufferArray.
Referenced by CREATE_CONSTRAINT().
◆ CREATE_CONSTRAINT() [1/8]
|
static |
creates a linear constraint for an array operation
Definition at line 2856 of file reader_fzn.c.
References equalTokens(), NULL, parseLinking(), SCIP_CALL, SCIP_OKAY, and TRUE.
◆ CREATE_CONSTRAINT() [2/8]
|
static |
creates a linear constraint for an array operation
Definition at line 2874 of file reader_fzn.c.
References equalTokens(), FALSE, NULL, SCIP_OKAY, and SCIPwarningMessage().
◆ CREATE_CONSTRAINT() [3/8]
|
static |
creates linear constraint for an array operation
Definition at line 2891 of file reader_fzn.c.
References equalTokens(), FALSE, NULL, SCIP_OKAY, and SCIPwarningMessage().
◆ CREATE_CONSTRAINT() [4/8]
|
static |
creates a linear constraint for a logical operation
Definition at line 2908 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.
◆ CREATE_CONSTRAINT() [5/8]
|
static |
creates a linear constraint for a comparison operation
Definition at line 3101 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.
◆ CREATE_CONSTRAINT() [6/8]
|
static |
creates an alldifferent constraint
Definition at line 3256 of file reader_fzn.c.
References equalTokens(), FALSE, NULL, parseVariableArrayAssignment(), SCIP_CALL, SCIP_OKAY, SCIPaddCons(), SCIPallocBufferArray, SCIPdebugMsg, SCIPdebugPrintCons, SCIPfreeBufferArray, SCIPreleaseCons(), and TRUE.
◆ CREATE_CONSTRAINT() [7/8]
|
static |
creates an alldifferent constraint
Definition at line 3302 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.
◆ CREATE_CONSTRAINT() [8/8]
|
static |
◆ parseConstraint()
|
static |
parse constraint expression
- Parameters
-
scip SCIP data structure fzninput FZN reading data
Definition at line 3429 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().
◆ parseSolveItem()
|
static |
parse solve item expression
- Parameters
-
scip SCIP data structure fzninput FZN reading data
Definition at line 3533 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().
◆ readFZNFile()
|
static |
reads a FlatZinc model
- Parameters
-
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 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().
◆ getActiveVariables()
|
static |
transforms given variables, scalars, and constant to the corresponding active variables, scalars, and constant
- Parameters
-
scip SCIP data structure vars pointer to vars array to get active variables for scalars pointer to scalars a_1, ..., a_n in linear sum a_1*x_1 + ... + a_n*x_n + c nvars pointer to number of variables and values in vars and vals array constant pointer to constant c in linear sum a_1*x_1 + ... + a_n*x_n + c transformed transformed constraint?
Definition at line 3864 of file reader_fzn.c.
References NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_VARSTATUS_NEGATED, SCIPABORT, SCIPerrorMessage, SCIPgetProbvarLinearSum(), SCIPreallocBufferArray, SCIPvarGetNegatedVar(), SCIPvarGetOrigvarSum(), SCIPvarGetStatus(), and TRUE.
Referenced by printLinearCons().
◆ writeBuffer()
|
static |
ends the given line with '\0' and prints it to the given file stream
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) buffer line bufferpos number of characters in buffer
Definition at line 3926 of file reader_fzn.c.
References NULL, and SCIPinfoMessage().
Referenced by writeFzn().
◆ appendBuffer()
|
static |
appends extension to line and prints it to the give file stream if the line buffer get full
- Parameters
-
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 MAX, NULL, SCIP_CALL, SCIP_OKAY, SCIPreallocBufferArray, and SCIPstrncpy().
Referenced by printLinearCons(), printRow(), and writeFzn().
◆ flattenFloat()
- Parameters
-
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, SCIPisIntegral(), SCIPround(), and SCIPsnprintf().
Referenced by printRow(), and writeFzn().
◆ printRow()
|
static |
- Parameters
-
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(), flattenFloat(), FZN_BUFFERLEN, NULL, SCIP_CALL, SCIP_OKAY, SCIPisZero(), SCIPsnprintf(), SCIPvarGetName(), and SCIPvarGetProbindex().
Referenced by printLinearCons().
◆ printLinearCons()
|
static |
prints given linear constraint information in FZN format to file stream
- Parameters
-
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(), 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().
◆ writeFzn()
|
static |
- Parameters
-
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 4241 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().
◆ SCIP_DECL_READERCOPY()
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 4737 of file reader_fzn.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderFzn(), and SCIPreaderGetName().
◆ SCIP_DECL_READERFREE()
|
static |
destructor of reader to free user data (called when SCIP is exiting)
Definition at line 4752 of file reader_fzn.c.
References freeVararray(), NULL, SCIP_OKAY, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArrayNull, and SCIPreaderGetData().
◆ SCIP_DECL_READERREAD()
|
static |
problem reading method of reader
Definition at line 4777 of file reader_fzn.c.
References FALSE, freeConstarray(), freeVararray(), FZN_BUFFERLEN, FZN_INIT_LINELEN, FZN_MAX_PUSHEDTOKENS, NULL, readFZNFile(), 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.
◆ SCIP_DECL_READERWRITE()
|
static |
problem writing method of reader
Definition at line 4874 of file reader_fzn.c.
References isIdentifier(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_SUCCESS, SCIPprintOrigProblem(), SCIPprintTransProblem(), SCIPvarGetName(), SCIPwarningMessage(), TRUE, and writeFzn().
Variable Documentation
◆ delimchars
|
static |
Definition at line 225 of file reader_fzn.c.
Referenced by getMaxAndConsDim(), and isDelimChar().
◆ tokenchars
|
static |
Definition at line 226 of file reader_fzn.c.
Referenced by isTokenChar().
◆ commentchars
|
static |
Definition at line 227 of file reader_fzn.c.
Referenced by getNextLine().
◆ nconstypes
|
static |
size of the function pointer array
Definition at line 3424 of file reader_fzn.c.
Referenced by parseConstraint().