64#define READER_NAME "gmsreader"
65#define READER_DESC "file writer for (MI)(N)LPs in GAMS file format"
66#define READER_EXTENSION "gms"
69#define GMS_MAX_LINELEN 256
70#define GMS_MAX_PRINTLEN 256
71#define GMS_MAX_NAMELEN 64
72#define GMS_PRINTLEN 100
73#define GMS_DEFAULT_BIGM 1e+6
74#define GMS_DEFAULT_INDICATORREFORM 's'
75#define GMS_DEFAULT_SIGNPOWER FALSE
124 for( v = 0; v < *
nvars; ++v )
199 const char* extension
216 (*linecnt) += (int)
strlen(extension);
285 SCIP_Bool transformed
481 for( v = 0; v <
nvars; ++v )
527 SCIP_Bool transformed
620 SCIP_Bool transformed
664 SCIPwarningMessage(
scip,
"do not have upper bound on slack variable <%s> in indicator constraint <%s>, will use M = %g.\n",
706 SCIP_CALL(
printActiveVariables(
scip, file,
linebuffer, &
linecnt,
NULL,
"$sameas(sosset,'slack')", 1, &s, &coef, transformed) );
710 SCIP_CALL(
printActiveVariables(
scip, file,
linebuffer, &
linecnt,
" + (1-(",
"))$sameas(sosset,'bin');", 1, &z, &coef, transformed) );
714 SCIP_CALL(
printActiveVariables(
scip, file,
linebuffer, &
linecnt,
" + ",
"$sameas(sosset,'bin');", 1, &z, &coef, transformed) );
748 SCIP_Bool transformed
785 for( v = 0; v <
nvars; ++v )
805 SCIP_Bool transformed,
943 if( exponent == 2.0 )
961 else if( exponent == 0.5 )
1023 SCIP_Bool transformed,
1067 SCIP_Bool transformed,
1088 SCIP_CALL(
printNonlinearRow(
scip, file,
rowname,
SCIPisInfinity(
scip, rhs) ?
"" :
"_lhs",
"=g=", expr, lhs, transformed,
nsmooth,
nqcons) );
1093 SCIP_CALL(
printNonlinearRow(
scip, file,
rowname,
SCIPisInfinity(
scip, -lhs) ?
"" :
"_rhs",
"=l=", expr, rhs, transformed,
nsmooth,
nqcons) );
1129 for( v = 0; v <
nvars; ++v )
1138 SCIPinfoMessage(
scip,
NULL,
"there is a variable name with symbol '%c', not allowed in GAMS format; all '%c' replaced by '_' (consider using 'write genproblem'/'write gentransproblem').\n", *
badchar, *
badchar);
1142 SCIPwarningMessage(
scip,
"there is a variable name with symbol '%c', not allowed in GAMS format; use 'write genproblem'/'write gentransproblem', or set 'reading/gmsreader/replaceforbiddenchars' to TRUE and risk duplicate variable names.\n", *
badchar);
1151 for( v = 0; v <
nvars; ++v )
1158 SCIPwarningMessage(
scip,
"there is a variable name which has to be cut down to %d characters; GAMS model might be corrupted.\n",
1173 SCIP_Bool transformed
1191 for(
c = 0;
c < nconss; ++
c )
1200 SCIPinfoMessage(
scip,
NULL,
"there is a constraint name with symbol '%c', not allowed in GAMS format; all '%c' replaced by '_' (consider using 'write genproblem'/'write gentransproblem').\n", *
badchar, *
badchar);
1204 SCIPwarningMessage(
scip,
"there is a constraint name with symbol '%c', not allowed in GAMS format; use 'write genproblem'/'write gentransproblem', or set 'reading/gmsreader/replaceforbiddenchars' to TRUE and risk duplicate variable names.\n", *
badchar);
1213 for(
c = 0;
c < nconss; ++
c )
1305 "reading/gmsreader/freeints",
"have integer variables no upper bound by default (depending on GAMS version)?",
1309 "reading/gmsreader/replaceforbiddenchars",
"shall characters '#', '*', '+', '/', and '-' in variable and constraint names be replaced by '_'?",
1313 "reading/gmsreader/bigmdefault",
"default M value for big-M reformulation of indicator constraints in case no bound on slack variable is given",
1317 "reading/gmsreader/indicatorreform",
"which reformulation to use for indicator constraints: 'b'ig-M, 's'os1",
1321 "reading/gmsreader/signpower",
"is it allowed to use the gams function signpower(x,a)?",
1333 SCIP_Bool transformed,
1337 SCIP_Real objoffset,
1398 if(
objscale == 1.0 && objoffset == 0.0 )
1400 for( v = 0; v <
nvars; ++v )
1405 if( objvar ==
NULL )
1429 SCIPinfoMessage(
scip, file,
"* Variables : %d (%d binary, %d integer, %d implicit integer, %d continuous)\n",
1441 if( objvar ==
NULL )
1448 for( v = 0; v <
nvars; ++v )
1511 for( v = 0; v <
nvars; ++v )
1602 SCIPinfoMessage(
scip, file,
"* (All other bounds at default value: binary [0,1], integer [%s], continuous [-inf,+inf].)\n",
freeints ?
"0,+inf" :
"0,100");
1606 if( nconss > 0 || objvar ==
NULL )
1613 if( objvar ==
NULL )
1620 for(
c = 0;
c < nconss; ++
c )
1670 if( nconss > 0 || objvar ==
NULL )
1679 if( objvar ==
NULL )
1683 if( objoffset != 0.0 )
1691 for( v = 0; v <
nvars; ++v )
1712 for(
c = 0;
c < nconss; ++
c )
1729 SCIP_Longint* weights;
1737 for( v = 0; v < nconsvars; ++v )
1738 consvals[v] = (SCIP_Real)weights[v];
1772 nconsvars, consvars,
NULL, 1.0, 1.0, transformed) );
1846 if( objvar !=
NULL )
constraint handler for indicator constraints
Constraint handler for knapsack constraints of the form , x binary and .
Constraint handler for linear constraints in their most general form, .
Constraint handler for logicor constraints (equivalent to set covering, but algorithms are suited fo...
constraint handler for nonlinear constraints specified by algebraic expressions
Constraint handler for the set partitioning / packing / covering constraints .
constraint handler for SOS type 1 constraints
constraint handler for SOS type 2 constraints
Constraint handler for variable bound constraints .
absolute expression handler
int SCIPgetNVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetVbdcoefVarbound(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetRhsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsSOS2(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetLhsLinear(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Real * SCIPgetValsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetVbdvarVarbound(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsSetppc(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsSOS2(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_EXPR * SCIPgetExprNonlinear(SCIP_CONS *cons)
SCIP_Real SCIPgetRhsNonlinear(SCIP_CONS *cons)
SCIP_VAR * SCIPgetBinaryVarIndicator(SCIP_CONS *cons)
SCIP_VAR * SCIPgetVarVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_Longint * SCIPgetWeightsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetSlackVarIndicator(SCIP_CONS *cons)
SCIP_Longint SCIPgetCapacityKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetLhsVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_SETPPCTYPE SCIPgetTypeSetppc(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsSOS1(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetRhsVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsSOS1(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetLhsNonlinear(SCIP_CONS *cons)
@ SCIP_SETPPCTYPE_PARTITIONING
@ SCIP_SETPPCTYPE_COVERING
@ SCIP_SETPPCTYPE_PACKING
SCIP_Bool SCIPisExprAbs(SCIP *scip, SCIP_EXPR *expr)
SCIP_RETCODE SCIPwriteGms(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)
SCIP_RETCODE SCIPincludeReaderGms(SCIP *scip)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
SCIP_RETCODE SCIPaddCharParam(SCIP *scip, const char *name, const char *desc, char *valueptr, SCIP_Bool isadvanced, char defaultvalue, const char *allowedvalues, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPgetRealParam(SCIP *scip, const char *name, SCIP_Real *value)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPgetCharParam(SCIP *scip, const char *name, char *value)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
SCIP_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsEnabled(SCIP_CONS *cons)
const char * SCIPconsGetName(SCIP_CONS *cons)
unsigned int SCIPexprhdlrGetPrecedence(SCIP_EXPRHDLR *exprhdlr)
SCIP_EXPRHDLR * SCIPgetExprhdlrSum(SCIP *scip)
SCIP_Real SCIPgetExponentExprPow(SCIP_EXPR *expr)
SCIP_Bool SCIPisExprProduct(SCIP *scip, SCIP_EXPR *expr)
SCIP_Bool SCIPexpriterIsEnd(SCIP_EXPRITER *iterator)
SCIP_Bool SCIPisExprSum(SCIP *scip, SCIP_EXPR *expr)
SCIP_Bool SCIPexprAreQuadraticExprsVariables(SCIP_EXPR *expr)
SCIP_Bool SCIPisExprValue(SCIP *scip, SCIP_EXPR *expr)
void SCIPexpriterSetStagesDFS(SCIP_EXPRITER *iterator, SCIP_EXPRITER_STAGE stopstages)
SCIP_Bool SCIPisExprVar(SCIP *scip, SCIP_EXPR *expr)
SCIP_RETCODE SCIPcreateExpriter(SCIP *scip, SCIP_EXPRITER **iterator)
SCIP_EXPR * SCIPexpriterGetParentDFS(SCIP_EXPRITER *iterator)
SCIP_Bool SCIPisExprPower(SCIP *scip, SCIP_EXPR *expr)
SCIP_EXPR * SCIPexpriterGetNext(SCIP_EXPRITER *iterator)
SCIP_RETCODE SCIPcheckExprQuadratic(SCIP *scip, SCIP_EXPR *expr, SCIP_Bool *isquadratic)
SCIP_VAR * SCIPgetVarExprVar(SCIP_EXPR *expr)
int SCIPexpriterGetChildIdxDFS(SCIP_EXPRITER *iterator)
void SCIPfreeExpriter(SCIP_EXPRITER **iterator)
SCIP_EXPRITER_STAGE SCIPexpriterGetStageDFS(SCIP_EXPRITER *iterator)
SCIP_RETCODE SCIPexpriterInit(SCIP_EXPRITER *iterator, SCIP_EXPR *expr, SCIP_EXPRITER_TYPE type, SCIP_Bool allowrevisit)
SCIP_EXPRHDLR * SCIPexprGetHdlr(SCIP_EXPR *expr)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPreallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPduplicateBufferArray(scip, ptr, source, num)
SCIP_RETCODE SCIPsetReaderCopy(SCIP *scip, SCIP_READER *reader,)
SCIP_RETCODE SCIPincludeReaderBasic(SCIP *scip, SCIP_READER **readerptr, const char *name, const char *desc, const char *extension, SCIP_READERDATA *readerdata)
SCIP_RETCODE SCIPsetReaderWrite(SCIP *scip, SCIP_READER *reader,)
const char * SCIPreaderGetName(SCIP_READER *reader)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPfeasFloor(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize, SCIP_Bool mergemultiples)
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbOriginal(SCIP_VAR *var)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbOriginal(SCIP_VAR *var)
SCIP_RETCODE SCIPgetNegatedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **negvar)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_Bool SCIPvarIsNegated(SCIP_VAR *var)
int SCIPsnprintf(char *t, int len, const char *s,...)
assert(minobj< SCIPgetCutoffbound(scip))
static const SCIP_Real scalars[]
memory allocation routines
public methods for managing constraints
public methods for message output
public data structures and miscellaneous methods
public methods for input file readers
public methods for problem variables
static void clearLine(char *linebuffer, int *linecnt)
static SCIP_RETCODE printNonlinearCons(SCIP *scip, FILE *file, const char *rowname, SCIP_EXPR *expr, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool transformed, SCIP_Bool *nsmooth, SCIP_Bool *nqcons)
static SCIP_RETCODE printSOSCons(SCIP *scip, FILE *file, const char *rowname, int nvars, SCIP_VAR **vars, int sostype, SCIP_Bool transformed)
static void endLineNoNewline(SCIP *scip, FILE *file, char *linebuffer, int *linecnt)
#define GMS_DEFAULT_INDICATORREFORM
#define GMS_DEFAULT_SIGNPOWER
static SCIP_RETCODE checkVarnames(SCIP *scip, SCIP_VAR **vars, int nvars)
static SCIP_RETCODE printLinearRow(SCIP *scip, FILE *file, const char *rowname, const char *rownameextension, const char *type, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real rhs)
static SCIP_RETCODE checkConsnames(SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool transformed)
static SCIP_RETCODE printNonlinearRow(SCIP *scip, FILE *file, const char *rowname, const char *rownameextension, const char *type, SCIP_EXPR *expr, SCIP_Real rhs, SCIP_Bool transformed, SCIP_Bool *nsmooth, SCIP_Bool *nqcons)
static SCIP_RETCODE printLinearCons(SCIP *scip, FILE *file, const char *rowname, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool transformed)
static SCIP_RETCODE printConformName(SCIP *scip, char *t, int len, const char *name)
static SCIP_RETCODE printActiveVariables(SCIP *scip, FILE *file, char *linebuffer, int *linecnt, const char *prefix, const char *suffix, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Bool transformed)
static void conformName(char *name)
static void endLine(SCIP *scip, FILE *file, char *linebuffer, int *linecnt)
static SCIP_RETCODE printIndicatorCons(SCIP *scip, FILE *file, const char *rowname, SCIP_VAR *z, SCIP_VAR *s, SCIP_Bool *sossetdeclr, SCIP_Bool transformed)
static SCIP_RETCODE printExpr(SCIP *scip, FILE *file, char *linebuffer, int *linecnt, SCIP_Bool *nsmooth, SCIP_Bool *nqcons, SCIP_Bool transformed, SCIP_EXPR *expr)
static const char badchars[]
static void appendLine(SCIP *scip, FILE *file, char *linebuffer, int *linecnt, const char *extension)
static SCIP_RETCODE getActiveVariables(SCIP *scip, SCIP_VAR ***vars, SCIP_Real **scalars, int *nvars, int *varssize, SCIP_Real *constant, SCIP_Bool transformed)
GAMS file reader and writer.
public methods for constraint handler plugins and constraints
public methods for memory management
public methods for message handling
public methods for numerical tolerances
public methods for SCIP parameter handling
public methods for reader plugins
public methods for SCIP variables
#define SCIP_EXPRITER_VISITINGCHILD
#define SCIP_EXPRITER_VISITEDCHILD
#define SCIP_EXPRITER_LEAVEEXPR
#define SCIP_EXPRITER_ALLSTAGES
#define SCIP_EXPRITER_ENTEREXPR
unsigned int SCIP_EXPRITER_STAGE
enum SCIP_Objsense SCIP_OBJSENSE
#define SCIP_DECL_READERWRITE(x)
#define SCIP_DECL_READERCOPY(x)
enum SCIP_Result SCIP_RESULT
enum SCIP_Retcode SCIP_RETCODE
@ SCIP_VARSTATUS_ORIGINAL