diff --git a/CHANGELOG b/CHANGELOG index 8482beddac..81d5c3ee42 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -30,6 +30,7 @@ Interface changes - SCIPcreateRow*(), SCIPaddVarToRow(), SCIPaddVarsToRow(), SCIPaddVarsToRowSameCoef() can now only be called in the solving stage, because otherwise the LP is not yet available and the row data is invalid. +- intvar removed from arguments for SCIPcreateConsPseudobooleanWithConss(), SCIPcreateConsPseudoboolean(), and SCIPcreateConsBasicPseudoboolean() due to dysfunctionality of non-linear objective reformulation with pseudoboolean constraint ### New API functions diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e251b50ff..13b043c364 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ set(SCIP_VERSION_MAJOR 10) set(SCIP_VERSION_MINOR 0) set(SCIP_VERSION_PATCH 0) set(SCIP_VERSION_SUB 0) -set(SCIP_VERSION_API 121) +set(SCIP_VERSION_API 122) project(SCIP VERSION ${SCIP_VERSION_MAJOR}.${SCIP_VERSION_MINOR}.${SCIP_VERSION_PATCH}.${SCIP_VERSION_SUB} diff --git a/make/make.project b/make/make.project index bee0a95fea..d6a75829c0 100644 --- a/make/make.project +++ b/make/make.project @@ -97,7 +97,7 @@ SCIP_VERSION_MAJOR = 10 SCIP_VERSION_MINOR = 0 SCIP_VERSION_PATCH = 0 SCIP_VERSION_SUB = 0 -SCIP_VERSION_API = 121 +SCIP_VERSION_API = 122 SCIP_VERSION = $(SCIP_VERSION_MAJOR).$(SCIP_VERSION_MINOR).$(SCIP_VERSION_PATCH).$(SCIP_VERSION_SUB) # compiling and linking parameters diff --git a/src/scip/cons_pseudoboolean.c b/src/scip/cons_pseudoboolean.c index 0e4e817d7e..ea50fca527 100644 --- a/src/scip/cons_pseudoboolean.c +++ b/src/scip/cons_pseudoboolean.c @@ -192,10 +192,6 @@ struct SCIP_ConsData int nconsanddatas; /**< number of and-constraints-data-objects */ int sconsanddatas; /**< size of and-constraints-data-objects array */ - SCIP_VAR* intvar; /**< a artificial variable which was added only for the objective function, - * if this variable is not NULL this constraint (without this integer - * variable) describes the objective function */ - SCIP_VAR* indvar; /**< indicator variable if it's a soft constraint, or NULL */ SCIP_Real weight; /**< weight of the soft constraint, if it is one */ @@ -1173,9 +1169,6 @@ SCIP_RETCODE consdataCreate( SCIP_VAR*const indvar, /**< indicator variable if it's a soft constraint, or NULL */ SCIP_Real const weight, /**< weight of the soft constraint, if it is one */ SCIP_Bool const issoftcons, /**< is this a soft constraint */ - SCIP_VAR* const intvar, /**< a artificial variable which was added only for the objective function, - * if this variable is not NULL this constraint (without this integer - * variable) describes the objective function */ SCIP_Real lhs, /**< left hand side of row */ SCIP_Real rhs, /**< right hand side of row */ SCIP_Bool check, /**< is the new constraint a check constraint? */ @@ -1232,19 +1225,6 @@ SCIP_RETCODE consdataCreate( else (*consdata)->indvar = NULL; - /* copy artificial integer variable if it exist */ - if( intvar != NULL ) - { - if( transformed ) - { - SCIP_CALL( SCIPgetTransformedVar(scip, intvar, &((*consdata)->intvar)) ); - } - else - (*consdata)->intvar = intvar; - } - else - (*consdata)->intvar = NULL; - /* copy linear constraint */ (*consdata)->lincons = lincons; (*consdata)->linconstype = linconstype; @@ -3908,14 +3888,12 @@ SCIP_RETCODE copyConsPseudoboolean( SCIP_Real targetrhs; SCIP_Real targetlhs; - SCIP_VAR* intvar; SCIP_VAR* indvar; const char* consname; /* third the indicator and artificial integer variable part */ assert(sourceconsdata->issoftcons == (sourceconsdata->indvar != NULL)); indvar = sourceconsdata->indvar; - intvar = sourceconsdata->intvar; /* copy indicator variable */ if( indvar != NULL ) @@ -3924,12 +3902,6 @@ SCIP_RETCODE copyConsPseudoboolean( SCIP_CALL( SCIPgetVarCopy(sourcescip, targetscip, indvar, &indvar, varmap, consmap, global, valid) ); assert(!(*valid) || indvar != NULL); } - /* copy artificial integer variable */ - if( intvar != NULL && *valid ) - { - SCIP_CALL( SCIPgetVarCopy(sourcescip, targetscip, intvar, &intvar, varmap, consmap, global, valid) ); - assert(!(*valid) || intvar != NULL); - } if( *valid ) { @@ -3947,10 +3919,10 @@ SCIP_RETCODE copyConsPseudoboolean( /* coverity[var_deref_op] */ /* coverity[var_deref_model] */ /* Note that due to compression the and constraints might have disappeared in which case ntargetandconss == 0. */ - SCIP_CALL( SCIPcreateConsPseudobooleanWithConss(targetscip, targetcons, consname, - targetlincons, targetlinconstype, targetandconss, targetandcoefs, ntargetandconss, - indvar, sourceconsdata->weight, sourceconsdata->issoftcons, intvar, targetlhs, targetrhs, - initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode) ); + SCIP_CALL( SCIPcreateConsPseudobooleanWithConss(targetscip, targetcons, consname, targetlincons, + targetlinconstype, targetandconss, targetandcoefs, ntargetandconss, indvar, sourceconsdata->weight, + sourceconsdata->issoftcons, targetlhs, targetrhs, initial, separate, enforce, check, propagate, + local, modifiable, dynamic, removable, stickingatnode) ); } } @@ -7442,7 +7414,7 @@ SCIP_RETCODE addSymmetryInformation( rhs = SCIPgetRhsPseudoboolean(scip, cons); SCIP_CALL( SCIPaddSymgraphConsnode(scip, graph, cons, lhs, rhs, &rootnodeidx) ); - /* possibly add nodes and edges encoding whether constraint is soft or an objective constraint */ + /* possibly add node and edge encoding whether constraint is soft */ vars[0] = SCIPgetIndVarPseudoboolean(scip, cons); if( vars[0] != NULL ) { @@ -7457,20 +7429,6 @@ SCIP_RETCODE addSymmetryInformation( SCIP_CALL( SCIPaddSymgraphVarAggregation(scip, graph, nodeidx, vars, vals, tmpnvars, constant) ); } - if( consdata->intvar != NULL ) - { - vars[0] = consdata->intvar; - vals[0] = 1.0; - tmpnvars = 1; - constant = 0.0; - - SCIP_CALL( SCIPaddSymgraphOpnode(scip, graph, (int)SYM_CONSOPTYPE_PB_OBJ, &nodeidx) ); - SCIP_CALL( SCIPaddSymgraphEdge(scip, graph, rootnodeidx, nodeidx, FALSE, 0.0) ); - SCIP_CALL( SCIPgetSymActiveVariables(scip, symtype, &vars, &vals, &tmpnvars, &constant, - SCIPisTransformed(scip)) ); - SCIP_CALL( SCIPaddSymgraphVarAggregation(scip, graph, nodeidx, vars, vals, tmpnvars, constant) ); - } - /* add nodes and edges encoding linear part of the pseudoboolean cons */ lincons = SCIPgetLinearConsPseudoboolean(scip, cons); constype = SCIPgetLinearConsTypePseudoboolean(scip, cons); @@ -7640,7 +7598,7 @@ SCIP_DECL_NONLINCONSUPGD(nonlinconsUpgdPseudoboolean) lhs = SCIPgetLhsNonlinear(scip, cons); rhs = SCIPgetRhsNonlinear(scip, cons); - /* we need all linear variables to be binary, except for one that was added to reformulate an objective function */ + /* we need all linear variables to be binary */ for( i = 0; i < SCIPgetNLinearVarsNonlinear(scip, cons); ++i ) { var = SCIPgetLinearVarsNonlinear(scip, cons)[i]; @@ -7649,20 +7607,7 @@ SCIP_DECL_NONLINCONSUPGD(nonlinconsUpgdPseudoboolean) if( SCIPvarIsBinary(var) ) continue; -#ifdef SCIP_DISABLED_CODE /* not working in cons_pseudoboolean yet, see cons_pseudoboolean.c:7925 */ - /* check whether the variable may have been added to represent the objective function */ - if( objvar == NULL && SCIPgetLinearCoefsNonlinear(scip, cons)[i] == -1.0 && /*TODO we could divide by the coefficient*/ - SCIPvarGetNLocksDownType(var, SCIP_LOCKTYPE_MODEL) == (SCIPisInfinity(scip, rhs) ? 0 : 1) && /*TODO correct?*/ - SCIPvarGetNLocksUpType(var, SCIP_LOCKTYPE_MODEL) == (SCIPisInfinity(scip, -lhs) ? 0 : 1) && /*TODO correct?*/ - SCIPisInfinity(scip, -SCIPvarGetLbGlobal(var)) && SCIPisInfinity(scip, SCIPvarGetUbGlobal(var)) && - SCIPvarGetObj(var) == 1.0 ) /*TODO we need this or just positive?*/ - { - objvar = var; - continue; - } -#endif - - SCIPdebugMsg(scip, "not pseudoboolean because linear variable <%s> is not binary or objective\n", SCIPvarGetName(var)); + SCIPdebugMsg(scip, "not pseudoboolean because linear variable <%s> is not binary\n", SCIPvarGetName(var)); return SCIP_OKAY; } @@ -7930,9 +7875,6 @@ SCIP_DECL_CONSINITPRE(consInitprePseudoboolean) assert(consdata->weight != 0); assert(consdata->indvar != NULL); - /* if it is a soft constraint, there should be no integer variable */ - assert(consdata->intvar == NULL); - /* get negation of indicator variable */ SCIP_CALL( SCIPgetNegatedVar(scip, consdata->indvar, &negindvar) ); assert(negindvar != NULL); @@ -8129,13 +8071,6 @@ SCIP_DECL_CONSINITPRE(consInitprePseudoboolean) /* update and constraint flags */ SCIP_CALL( updateAndConss(scip, cons) ); -#if 0 /* not implemented correctly */ - if( consdata->intvar != NULL ) - { - /* add auxiliary integer variables to linear constraint */ - SCIP_CALL( SCIPaddCoefLinear(scip, lincons, consdata->intvar, -1.0) ); - } -#endif /* remove pseudo boolean constraint, old linear constraint is still active, and-constraints too */ SCIP_CALL( SCIPdelCons(scip, cons) ); } @@ -8226,10 +8161,9 @@ SCIP_DECL_CONSTRANS(consTransPseudoboolean) } /* create pseudoboolean constraint data for target constraint */ - SCIP_CALL( consdataCreate(scip, conshdlr, &targetdata, sourcedata->lincons, sourcedata->linconstype, - andconss, sourcedata->andcoefs, sourcedata->andnegs, sourcedata->nconsanddatas, sourcedata->indvar, sourcedata->weight, - sourcedata->issoftcons, sourcedata->intvar, sourcedata->lhs, sourcedata->rhs, SCIPconsIsChecked(sourcecons), - TRUE) ); + SCIP_CALL( consdataCreate(scip, conshdlr, &targetdata, sourcedata->lincons, sourcedata->linconstype, andconss, + sourcedata->andcoefs, sourcedata->andnegs, sourcedata->nconsanddatas, sourcedata->indvar, sourcedata->weight, + sourcedata->issoftcons, sourcedata->lhs, sourcedata->rhs, SCIPconsIsChecked(sourcecons), TRUE) ); /* free temporary memory */ SCIPfreeBufferArray(scip, &andconss); @@ -9116,10 +9050,7 @@ SCIP_RETCODE SCIPincludeConshdlrPseudoboolean( return SCIP_OKAY; } -/** creates and captures a pseudoboolean constraint, with given linear and and-constraints - * - * @note intvar must currently be NULL - */ +/** creates and captures a pseudoboolean constraint, with given linear and and-constraints */ SCIP_RETCODE SCIPcreateConsPseudobooleanWithConss( SCIP* scip, /**< SCIP data structure */ SCIP_CONS** cons, /**< pointer to hold the created constraint */ @@ -9132,9 +9063,6 @@ SCIP_RETCODE SCIPcreateConsPseudobooleanWithConss( SCIP_VAR* indvar, /**< indicator variable if it's a soft constraint, or NULL */ SCIP_Real weight, /**< weight of the soft constraint, if it is one */ SCIP_Bool issoftcons, /**< is this a soft constraint */ - SCIP_VAR* intvar, /**< an artificial variable which was added only for the objective function, - * if this variable is not NULL this constraint (without this integer - * variable) describes the objective function */ SCIP_Real lhs, /**< left hand side of constraint */ SCIP_Real rhs, /**< right hand side of constraint */ SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? @@ -9181,13 +9109,6 @@ SCIP_RETCODE SCIPcreateConsPseudobooleanWithConss( assert(nandconss == 0 || (andconss != NULL && andcoefs != NULL)); assert(issoftcons == (indvar != NULL)); - if( intvar != NULL ) - { - /* FIXME should work or really be removed */ - SCIPerrorMessage("intvar currently not supported by pseudo boolean constraint handler\n"); - return SCIP_INVALIDDATA; - } - /* find the pseudoboolean constraint handler */ conshdlr = SCIPfindConshdlr(scip, CONSHDLR_NAME); if( conshdlr == NULL ) @@ -9378,7 +9299,7 @@ SCIP_RETCODE SCIPcreateConsPseudobooleanWithConss( /* create constraint data */ /* checking for and-constraints will be FALSE, we check all information in this constraint handler */ SCIP_CALL( consdataCreate(scip, conshdlr, &consdata, lincons, linconstype, andconss, andcoefs, NULL, nandconss, - indvar, weight, issoftcons, intvar, lhs, rhs, check, FALSE) ); + indvar, weight, issoftcons, lhs, rhs, check, FALSE) ); assert(consdata != NULL); /* create constraint */ @@ -9394,8 +9315,6 @@ SCIP_RETCODE SCIPcreateConsPseudobooleanWithConss( * respectively * * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons() - * - * @note intvar must currently be NULL */ SCIP_RETCODE SCIPcreateConsPseudoboolean( SCIP* scip, /**< SCIP data structure */ @@ -9411,9 +9330,6 @@ SCIP_RETCODE SCIPcreateConsPseudoboolean( SCIP_VAR* indvar, /**< indicator variable if it's a soft constraint, or NULL */ SCIP_Real weight, /**< weight of the soft constraint, if it is one */ SCIP_Bool issoftcons, /**< is this a soft constraint */ - SCIP_VAR* intvar, /**< an artificial variable which was added only for the objective function, - * if this variable is not NULL this constraint (without this integer - * variable) describes the objective function */ SCIP_Real lhs, /**< left hand side of constraint */ SCIP_Real rhs, /**< right hand side of constraint */ SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? @@ -9459,13 +9375,6 @@ SCIP_RETCODE SCIPcreateConsPseudoboolean( assert(nterms == 0 || (terms != NULL && termvals != NULL && ntermvars != NULL)); assert(issoftcons == (indvar != NULL)); - if( intvar != NULL ) - { - /* FIXME should work or really be removed */ - SCIPerrorMessage("intvar currently not supported by pseudo boolean constraint handler\n"); - return SCIP_INVALIDDATA; - } - /* find the pseudoboolean constraint handler */ conshdlr = SCIPfindConshdlr(scip, CONSHDLR_NAME); if( conshdlr == NULL ) @@ -9530,7 +9439,7 @@ SCIP_RETCODE SCIPcreateConsPseudoboolean( /* create constraint data */ /* checking for and-constraints will be FALSE, we check all information in this constraint handler */ SCIP_CALL( consdataCreate(scip, conshdlr, &consdata, lincons, linconstype, andconss, andcoefs, andnegs, nandconss, - indvar, weight, issoftcons, intvar, lhs, rhs, check, FALSE) ); + indvar, weight, issoftcons, lhs, rhs, check, FALSE) ); assert(consdata != NULL); /* free temporary memory */ @@ -9550,8 +9459,6 @@ SCIP_RETCODE SCIPcreateConsPseudoboolean( * in its most basic variant, i. e., with all constraint flags set to their default values * * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons() - * - * @note intvar must currently be NULL */ SCIP_RETCODE SCIPcreateConsBasicPseudoboolean( SCIP* scip, /**< SCIP data structure */ @@ -9567,16 +9474,13 @@ SCIP_RETCODE SCIPcreateConsBasicPseudoboolean( SCIP_VAR* indvar, /**< indicator variable if it's a soft constraint, or NULL */ SCIP_Real weight, /**< weight of the soft constraint, if it is one */ SCIP_Bool issoftcons, /**< is this a soft constraint */ - SCIP_VAR* intvar, /**< a artificial variable which was added only for the objective function, - * if this variable is not NULL this constraint (without this integer - * variable) describes the objective function */ SCIP_Real lhs, /**< left hand side of constraint */ SCIP_Real rhs /**< right hand side of constraint */ ) { - SCIP_CALL( SCIPcreateConsPseudoboolean(scip, cons, name, linvars, nlinvars, linvals, - terms, nterms, ntermvars, termvals, indvar, weight, issoftcons, intvar, lhs, rhs, - TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE) ); + SCIP_CALL( SCIPcreateConsPseudoboolean(scip, cons, name, linvars, nlinvars, linvals, terms, nterms, ntermvars, + termvals, indvar, weight, issoftcons, lhs, rhs, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, + FALSE) ); return SCIP_OKAY; } diff --git a/src/scip/cons_pseudoboolean.h b/src/scip/cons_pseudoboolean.h index b04575c203..e8d59fa628 100644 --- a/src/scip/cons_pseudoboolean.h +++ b/src/scip/cons_pseudoboolean.h @@ -89,10 +89,7 @@ enum SCIP_LinearConsType }; typedef enum SCIP_LinearConsType SCIP_LINEARCONSTYPE; -/** creates and captures a pseudoboolean constraint, with given linear and and-constraints - * - * @note intvar must currently be NULL - */ +/** creates and captures a pseudoboolean constraint, with given linear and and-constraints */ SCIP_EXPORT SCIP_RETCODE SCIPcreateConsPseudobooleanWithConss( SCIP* scip, /**< SCIP data structure */ @@ -106,9 +103,6 @@ SCIP_RETCODE SCIPcreateConsPseudobooleanWithConss( SCIP_VAR* indvar, /**< indicator variable if it's a soft constraint, or NULL */ SCIP_Real weight, /**< weight of the soft constraint, if it is one */ SCIP_Bool issoftcons, /**< is this a soft constraint */ - SCIP_VAR* intvar, /**< an artificial variable which was added only for the objective function, - * if this variable is not NULL this constraint (without this integer - * variable) describes the objective function */ SCIP_Real lhs, /**< left hand side of constraint */ SCIP_Real rhs, /**< right hand side of constraint */ SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? @@ -147,8 +141,6 @@ SCIP_RETCODE SCIPcreateConsPseudobooleanWithConss( * respectively * * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons() - * - * @note intvar must currently be NULL */ SCIP_EXPORT SCIP_RETCODE SCIPcreateConsPseudoboolean( @@ -165,9 +157,6 @@ SCIP_RETCODE SCIPcreateConsPseudoboolean( SCIP_VAR* indvar, /**< indicator variable if it's a soft constraint, or NULL */ SCIP_Real weight, /**< weight of the soft constraint, if it is one */ SCIP_Bool issoftcons, /**< is this a soft constraint */ - SCIP_VAR* intvar, /**< an artificial variable which was added only for the objective function, - * if this variable is not NULL this constraint (without this integer - * variable) describes the objective function */ SCIP_Real lhs, /**< left hand side of constraint */ SCIP_Real rhs, /**< right hand side of constraint */ SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? @@ -202,8 +191,6 @@ SCIP_RETCODE SCIPcreateConsPseudoboolean( * @see SCIPcreateConsPseudoboolean() for the default constraint flag configuration * * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons() - * - * @note intvar must currently be NULL */ SCIP_EXPORT SCIP_RETCODE SCIPcreateConsBasicPseudoboolean( @@ -220,9 +207,6 @@ SCIP_RETCODE SCIPcreateConsBasicPseudoboolean( SCIP_VAR* indvar, /**< indicator variable if it's a soft constraint, or NULL */ SCIP_Real weight, /**< weight of the soft constraint, if it is one */ SCIP_Bool issoftcons, /**< is this a soft constraint */ - SCIP_VAR* intvar, /**< a artificial variable which was added only for the objective function, - * if this variable is not NULL this constraint (without this integer - * variable) describes the objective function */ SCIP_Real lhs, /**< left hand side of constraint */ SCIP_Real rhs /**< right hand side of constraint */ ); diff --git a/src/scip/reader_opb.c b/src/scip/reader_opb.c index 170383db4f..38834a5a4a 100644 --- a/src/scip/reader_opb.c +++ b/src/scip/reader_opb.c @@ -127,12 +127,7 @@ #define READER_DESC "file reader for pseudo-Boolean problem in opb format" #define READER_EXTENSION "opb" -#define GENCONSNAMES TRUE /* remove if no constraint names should be generated */ -#define LINEAROBJECTIVE TRUE /* will all non-linear parts inside the objective function be linearized or will - * an artificial integer variable be created which will represent the objective - * function - */ - +#define GENCONSNAMES TRUE /* remove if no constraint names should be generated */ #define INDICATORVARNAME "indicatorvar" /* standard part of name for all indicator variables */ #define INDICATORSLACKVARNAME "indslack" /* standard part of name for all indicator slack variables; should be the same in cons_indicator */ #define TOPCOSTCONSNAME "topcostcons" /* standard name for artificial topcost constraint in wbo problems */ @@ -1165,17 +1160,9 @@ SCIP_RETCODE setObjective( if( strcmp(sense, "max" ) == 0 ) opbinput->objsense = SCIP_OBJSENSE_MAXIMIZE; - /* @todo: what todo with non-linear objectives, maybe create the necessary and-constraints and add the arising linear - * objective (with and-resultants) or add a integer variable to this constraint and put only this variable in the - * objective, for this we need to expand the pseudo-boolean constraints to handle integer variables - * - * integer variant is not implemented - */ + /* handle non-linear terms by and-constraints */ if( ntermcoefs > 0 ) { -#if (LINEAROBJECTIVE == TRUE) - /* all non-linear parts are created as and-constraints, even if the same non-linear part was already part of the objective function */ - SCIP_VAR** vars; int nvars; int t; @@ -1192,6 +1179,7 @@ SCIP_RETCODE setObjective( assert(vars != NULL); assert(nvars > 1); + /* @todo: reuse equivalent terms */ /* create auxiliary variable */ (void)SCIPsnprintf(name, SCIP_MAXSTRLEN, ARTIFICIALVARNAMEPREFIX"obj_%d", t); SCIP_CALL( SCIPcreateVar(scip, &var, name, 0.0, 1.0, termcoefs[t], SCIP_VARTYPE_BINARY, @@ -1235,90 +1223,6 @@ SCIP_RETCODE setObjective( SCIP_CALL( SCIPreleaseVar(scip, &var) ); } -#else /* now the integer variant */ - SCIP_CONS* pseudocons; - SCIP_Real lb; - SCIP_Real ub; - - lb = 0.0; - ub = 0.0; - - /* add all non linear coefficients up */ - for( v = 0; v < ntermcoefs; ++v ) - { - if( termcoefs[v] < 0 ) - lb += termcoefs[v]; - else - ub += termcoefs[v]; - } - /* add all linear coefficients up */ - for( v = 0; v < ncoefs; ++v ) - { - if( coefs[v] < 0 ) - lb += coefs[v]; - else - ub += coefs[v]; - } - assert(lb < ub); - - /* create auxiliary variable */ - (void)SCIPsnprintf(name, SCIP_MAXSTRLEN, "artificial_int_obj"); - SCIP_CALL( SCIPcreateVar(scip, &var, name, lb, ub, 1.0, SCIP_VARTYPE_INTEGER, - TRUE, TRUE, NULL, NULL, NULL, NULL, NULL) ); - - /* @todo: check if it is better to change the branching priority for the artificial variables */ -#if 1 - /* change branching priority of artificial variable to -1 */ - SCIP_CALL( SCIPchgVarBranchPriority(scip, var, -1) ); -#endif - /* add auxiliary variable to the problem */ - SCIP_CALL( SCIPaddVar(scip, var) ); - -#ifdef WITH_DEBUG_SOLUTION - if( SCIPdebugIsMainscip(scip) ) - { - SCIP_Real artval = 0.0; - SCIP_Real val; - - for( t = 0; t < ntermcoefs; ++t ) - { - vars = terms[t]; - nvars = ntermvars[t]; - assert(vars != NULL); - assert(nvars > 1); - - for( v = nvars - 1; v >= 0; --v ) - { - SCIP_CALL( SCIPdebugGetSolVal(scip, vars[v], &val) ); - assert(SCIPisFeasZero(scip, val) || SCIPisFeasEQ(scip, val, 1.0)); - - if( val < 0.5 ) - break; - } - - artval += (((val < 0.5) ? 0.0 : 1.0) * termcoefs[t]); - } - assert(SCIPisFeasLE(scip, lb, artval) && SCIPisFeasGE(scip, ub, artval)); - - SCIP_CALL( SCIPdebugAddSolVal(scip, var, artval) ); - } -#endif - - /* create artificial objection function constraint containing the artificial integer variable */ - (void)SCIPsnprintf(name, SCIP_MAXSTRLEN, "artificial_obj_cons"); - SCIP_CALL( SCIPcreateConsPseudoboolean(scip, &pseudocons, name, linvars, ncoefs, coefs, terms, ntermcoefs, - ntermvars, termcoefs, NULL, 0.0, FALSE, var, 0.0, 0.0, - TRUE, TRUE, TRUE, TRUE, TRUE, - FALSE, FALSE, FALSE, FALSE, FALSE) ); - - SCIP_CALL( SCIPaddCons(scip, pseudocons) ); - SCIPdebugPrintCons(scip, pseudocons, NULL); - SCIP_CALL( SCIPreleaseCons(scip, &pseudocons) ); - - SCIP_CALL( SCIPreleaseVar(scip, &var) ); - - return SCIP_OKAY; -#endif } /* set the objective values */ for( v = 0; v < ncoefs; ++v ) @@ -1533,8 +1437,8 @@ SCIP_RETCODE readConstraints( (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "pseudoboolean"); #endif retcode = SCIPcreateConsPseudoboolean(scip, &cons, name, linvars, nlincoefs, lincoefs, terms, ntermcoefs, - ntermvars, termcoefs, indvar, weight, issoftcons, NULL, lhs, rhs, - initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, FALSE); + ntermvars, termcoefs, indvar, weight, issoftcons, lhs, rhs, initial, separate, enforce, check, propagate, + local, modifiable, dynamic, removable, FALSE); if( retcode != SCIP_OKAY ) goto TERMINATE; } diff --git a/tests/src/symmetry/compute.c b/tests/src/symmetry/compute.c index aeacfa1c31..708124e9cb 100644 --- a/tests/src/symmetry/compute.c +++ b/tests/src/symmetry/compute.c @@ -1398,8 +1398,8 @@ void examplePB( vals[1] = 1.0; vals[2] = -1.0; - SCIP_CALL( SCIPcreateConsPseudoboolean(scip, &cons, "c1", NULL, 0, NULL, terms, 3, nterms, vals, - NULL, 0.0, FALSE, NULL, -2.0, 2.0, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE) ); + SCIP_CALL( SCIPcreateConsPseudoboolean(scip, &cons, "c1", NULL, 0, NULL, terms, 3, nterms, vals, NULL, 0.0, FALSE, + -2.0, 2.0, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE) ); SCIP_CALL( SCIPaddCons(scip, cons) ); SCIP_CALL( SCIPreleaseCons(scip, &cons) );