Scippy

SCIP

Solving Constraint Integer Programs

cons_pseudoboolean.c File Reference

Detailed Description

constraint handler for pseudo Boolean constraints

Author
Stefan Heinz
Michael Winkler

The constraint handler deals with pseudo Boolean constraints. These are constraints of the form

\[ \mbox{lhs} \leq \sum_{k=0}^m c_k \cdot x_k + \sum_{i=0}^n c_i \cdot \prod_{j \in I_i} x_j \leq \mbox{rhs} \]

where all x are binary and all c are integer

Definition in file cons_pseudoboolean.c.

#include <assert.h>
#include <string.h>
#include "scip/cons_pseudoboolean.h"
#include "scip/cons_and.h"
#include "scip/cons_indicator.h"
#include "scip/cons_knapsack.h"
#include "scip/cons_linear.h"
#include "scip/cons_logicor.h"
#include "scip/cons_setppc.h"
#include "scip/cons_xor.h"
#include "scip/pub_var.h"
#include "scip/debug.h"

Go to the source code of this file.

Macros

#define CONSHDLR_NAME   "pseudoboolean"
 
#define CONSHDLR_DESC   "constraint handler template"
 
#define CONSHDLR_ENFOPRIORITY   -1000000
 
#define CONSHDLR_CHECKPRIORITY   -5000000
 
#define CONSHDLR_EAGERFREQ   100
 
#define CONSHDLR_MAXPREROUNDS   -1
 
#define CONSHDLR_DELAYPRESOL   FALSE
 
#define CONSHDLR_NEEDSCONS   TRUE
 
#define DEFAULT_DECOMPOSENORMALPBCONS   FALSE
 
#define DEFAULT_DECOMPOSEINDICATORPBCONS   TRUE
 
#define DEFAULT_SEPARATENONLINEAR   TRUE
 
#define DEFAULT_PROPAGATENONLINEAR   TRUE
 
#define DEFAULT_REMOVABLENONLINEAR   TRUE
 
#define USEINDICATOR   TRUE
 
#define HASHSIZE_PSEUDOBOOLEANNONLINEARTERMS   131101
 
#define MAXNVARS   10 /* note that this cannot be bigger than 31 */
 

Typedefs

typedef struct ConsAndData CONSANDDATA
 

Functions

static SCIP_DECL_SORTPTRCOMP (resvarCompWithInactive)
 
static SCIP_DECL_HASHGETKEY (hashGetKeyAndConsDatas)
 
static SCIP_DECL_HASHKEYEQ (hashKeyEqAndConsDatas)
 
static SCIP_DECL_HASHKEYVAL (hashKeyValAndConsDatas)
 
static SCIP_RETCODE inithashmapandtable (SCIP *const scip, SCIP_CONSHDLRDATA **conshdlrdata)
 
static SCIP_RETCODE conshdlrdataCreate (SCIP *const scip, SCIP_CONSHDLRDATA **conshdlrdata)
 
static SCIP_RETCODE conshdlrdataFree (SCIP *const scip, SCIP_CONSHDLRDATA **conshdlrdata)
 
static SCIP_RETCODE getLinearConsNVars (SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, int *const nvars)
 
static SCIP_RETCODE getLinearConsSides (SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, SCIP_Real *const lhs, SCIP_Real *const rhs)
 
static SCIP_RETCODE getLinearConsVarsData (SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, SCIP_VAR **const vars, SCIP_Real *const coefs, int *const nvars)
 
static SCIP_RETCODE getLinVarsAndAndRess (SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const vars, SCIP_Real *const coefs, int const nvars, SCIP_VAR **const linvars, SCIP_Real *const lincoefs, int *const nlinvars, SCIP_VAR **const andress, SCIP_Real *const andcoefs, int *const nandress)
 
static SCIP_RETCODE transformToOrig (SCIP *const scip, CONSANDDATA *consanddata, SCIP_CONSHDLRDATA *conshdlrdata)
 
static SCIP_RETCODE consdataCreate (SCIP *const scip, SCIP_CONSHDLR *const conshdlr, SCIP_CONSDATA **consdata, SCIP_CONS *const lincons, SCIP_LINEARCONSTYPE const linconstype, SCIP_CONS **const andconss, SCIP_Real *const andcoefs, int const nandconss, SCIP_VAR *const indvar, SCIP_Real const weight, SCIP_Bool const issoftcons, SCIP_VAR *const intvar, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool check, SCIP_Bool transforming)
 
static SCIP_RETCODE consdataFree (SCIP *const scip, SCIP_CONSDATA **consdata, SCIP_Bool isorig, SCIP_CONSHDLRDATA *conshdlrdata)
 
static SCIP_RETCODE lockRoundingAndCons (SCIP *const scip, SCIP_CONS *const cons, CONSANDDATA *const consanddata, SCIP_Real const coef, SCIP_Real const lhs, SCIP_Real const rhs)
 
static SCIP_RETCODE unlockRoundingAndCons (SCIP *const scip, SCIP_CONS *const cons, CONSANDDATA *const consanddata, SCIP_Real const coef, SCIP_Real const lhs, SCIP_Real const rhs)
 
static SCIP_RETCODE consdataPrint (SCIP *const scip, SCIP_CONS *const cons, FILE *const file)
 
static SCIP_RETCODE createAndAddAndCons (SCIP *const scip, SCIP_CONSHDLR *const conshdlr, SCIP_VAR **const vars, int const nvars, SCIP_Bool const initial, SCIP_Bool const enforce, SCIP_Bool const check, SCIP_Bool const local, SCIP_Bool const modifiable, SCIP_Bool const dynamic, SCIP_Bool const stickingatnode, SCIP_CONS **const andcons)
 
static SCIP_RETCODE addCoefTerm (SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const vars, int const nvars, SCIP_Real const val)
 
static SCIP_RETCODE chgLhsLinearCons (SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, SCIP_Real const lhs)
 
static SCIP_RETCODE chgRhsLinearCons (SCIP *const scip, SCIP_CONS *const cons, SCIP_LINEARCONSTYPE const constype, SCIP_Real const rhs)
 
static SCIP_RETCODE chgLhs (SCIP *const scip, SCIP_CONS *const cons, SCIP_Real lhs)
 
static SCIP_RETCODE chgRhs (SCIP *const scip, SCIP_CONS *const cons, SCIP_Real rhs)
 
static SCIP_RETCODE createAndAddAnds (SCIP *const scip, SCIP_CONSHDLR *const conshdlr, SCIP_VAR **const *const terms, SCIP_Real *const termcoefs, int const nterms, int const *const ntermvars, SCIP_Bool const initial, SCIP_Bool const enforce, SCIP_Bool const check, SCIP_Bool const local, SCIP_Bool const modifiable, SCIP_Bool const dynamic, SCIP_Bool const stickingatnode, SCIP_CONS **const andconss, SCIP_Real *const andvals, int *const nandconss)
 
static SCIP_RETCODE createAndAddLinearCons (SCIP *const scip, SCIP_CONSHDLR *const conshdlr, SCIP_VAR **const linvars, int const nlinvars, SCIP_Real *const linvals, SCIP_VAR **const andress, int const nandress, SCIP_Real const *const andvals, SCIP_Real *const lhs, SCIP_Real *const rhs, SCIP_Bool const initial, SCIP_Bool const separate, SCIP_Bool const enforce, SCIP_Bool const check, SCIP_Bool const propagate, SCIP_Bool const local, SCIP_Bool const modifiable, SCIP_Bool const dynamic, SCIP_Bool const removable, SCIP_Bool const stickingatnode, SCIP_CONS **const lincons, SCIP_LINEARCONSTYPE *const linconstype)
 
static SCIP_RETCODE checkOrigPbCons (SCIP *const scip, SCIP_CONS *const cons, SCIP_SOL *const sol, SCIP_Bool *const violated, SCIP_Bool const printreason)
 
static SCIP_RETCODE checkAndConss (SCIP *const scip, SCIP_CONSHDLR *const conshdlr, SCIP_SOL *const sol, SCIP_Bool *const violated)
 
static SCIP_RETCODE copyConsPseudoboolean (SCIP *const targetscip, SCIP_CONS **targetcons, SCIP *const sourcescip, SCIP_CONS *const sourcecons, const char *name, SCIP_HASHMAP *const varmap, SCIP_HASHMAP *const consmap, SCIP_Bool const initial, SCIP_Bool const separate, SCIP_Bool const enforce, SCIP_Bool const check, SCIP_Bool const propagate, SCIP_Bool const local, SCIP_Bool const modifiable, SCIP_Bool const dynamic, SCIP_Bool const removable, SCIP_Bool const stickingatnode, SCIP_Bool const global, SCIP_Bool *const valid)
 
static SCIP_RETCODE computeConsAndDataChanges (SCIP *const scip, SCIP_CONSHDLRDATA *const conshdlrdata)
 
static SCIP_RETCODE removeOldLocks (SCIP *const scip, SCIP_CONS *const cons, CONSANDDATA *const consanddata, SCIP_Real const coef, SCIP_Real const lhs, SCIP_Real const rhs)
 
static SCIP_RETCODE addNewLocks (SCIP *const scip, SCIP_CONS *const cons, CONSANDDATA *const consanddata, SCIP_Real const coef, SCIP_Real const lhs, SCIP_Real const rhs)
 
static SCIP_RETCODE correctLocksAndCaptures (SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, SCIP_Real const newlhs, SCIP_Real const newrhs, SCIP_VAR **const andress, SCIP_Real *const andcoefs, int const nandress)
 
static SCIP_RETCODE addCliques (SCIP *const scip, SCIP_CONS *const cons, SCIP_Bool *const cutoff, int *const naggrvars, int *const nchgbds)
 
static SCIP_RETCODE propagateCons (SCIP *const scip, SCIP_CONS *const cons, SCIP_Bool *const cutoff, int *const ndelconss)
 
static SCIP_RETCODE updateAndConss (SCIP *const scip, SCIP_CONS *const cons)
 
static SCIP_RETCODE correctConshdlrdata (SCIP *const scip, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss)
 
static SCIP_RETCODE updateConsanddataUses (SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss)
 
static SCIP_RETCODE checkSolution (SCIP *const scip, SCIP_VAR **const vars, int const nvars, SCIP_Bool *const values, SCIP_VAR **const linvars, SCIP_Real *const lincoefs, int const nlinvars, SCIP_Real const constant, SCIP_Real const side, CONSANDDATA **const consanddatas, SCIP_Real *const consanddatacoefs, int const nconsanddatas, int const cnt, int *const xortype)
 
static SCIP_RETCODE tryUpgradingXor (SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss, int *const naddconss, int *const nfixedvars, int *const nchgcoefs, int *const nchgsides, SCIP_Bool *const cutoff)
 
static SCIP_RETCODE tryUpgradingLogicor (SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss, int *const naddconss, int *const nfixedvars, int *const nchgcoefs, int *const nchgsides, SCIP_Bool *const cutoff)
 
static SCIP_RETCODE tryUpgradingSetppc (SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss, int *const naddconss, int *const nfixedvars, int *const nchgcoefs, int *const nchgsides, SCIP_Bool *const cutoff)
 
static SCIP_RETCODE tryUpgrading (SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss, int *const naddconss, int *const nfixedvars, int *const nchgcoefs, int *const nchgsides, SCIP_Bool *const cutoff)
 
static SCIP_RETCODE findAggregation (SCIP *const scip, SCIP_CONS *const cons, SCIP_CONSHDLRDATA *const conshdlrdata, int *const ndelconss, int *const naggrvars, SCIP_Bool *const cutoff)
 
static SCIP_DECL_CONSHDLRCOPY (conshdlrCopyPseudoboolean)
 
static SCIP_DECL_CONSFREE (consFreePseudoboolean)
 
static SCIP_DECL_CONSINIT (consInitPseudoboolean)
 
static SCIP_DECL_CONSINITPRE (consInitprePseudoboolean)
 
static SCIP_DECL_CONSDELETE (consDeletePseudoboolean)
 
static SCIP_DECL_CONSTRANS (consTransPseudoboolean)
 
static SCIP_DECL_CONSENFOLP (consEnfolpPseudoboolean)
 
static SCIP_DECL_CONSENFOPS (consEnfopsPseudoboolean)
 
static SCIP_DECL_CONSCHECK (consCheckPseudoboolean)
 
static SCIP_DECL_CONSPRESOL (consPresolPseudoboolean)
 
static SCIP_DECL_CONSLOCK (consLockPseudoboolean)
 
static SCIP_DECL_CONSPRINT (consPrintPseudoboolean)
 
static SCIP_DECL_CONSCOPY (consCopyPseudoboolean)
 
static SCIP_DECL_CONSGETVARS (consGetVarsPseudoboolean)
 
static SCIP_DECL_CONSGETNVARS (consGetNVarsPseudoboolean)
 
SCIP_RETCODE SCIPincludeConshdlrPseudoboolean (SCIP *scip)
 
SCIP_RETCODE SCIPcreateConsPseudobooleanWithConss (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_CONS *lincons, SCIP_LINEARCONSTYPE linconstype, SCIP_CONS **andconss, SCIP_Real *andcoefs, int nandconss, SCIP_VAR *indvar, SCIP_Real weight, SCIP_Bool issoftcons, SCIP_VAR *intvar, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
 
SCIP_RETCODE SCIPcreateConsPseudoboolean (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR **linvars, int nlinvars, SCIP_Real *linvals, SCIP_VAR ***terms, int nterms, int *ntermvars, SCIP_Real *termvals, SCIP_VAR *indvar, SCIP_Real weight, SCIP_Bool issoftcons, SCIP_VAR *intvar, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
 
SCIP_RETCODE SCIPcreateConsBasicPseudoboolean (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR **linvars, int nlinvars, SCIP_Real *linvals, SCIP_VAR ***terms, int nterms, int *ntermvars, SCIP_Real *termvals, SCIP_VAR *indvar, SCIP_Real weight, SCIP_Bool issoftcons, SCIP_VAR *intvar, SCIP_Real lhs, SCIP_Real rhs)
 
SCIP_RETCODE SCIPaddCoefPseudoboolean (SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR *const var, SCIP_Real const val)
 
SCIP_RETCODE SCIPaddTermPseudoboolean (SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const vars, int const nvars, SCIP_Real const val)
 
SCIP_VARSCIPgetIndVarPseudoboolean (SCIP *const scip, SCIP_CONS *const cons)
 
SCIP_CONSSCIPgetLinearConsPseudoboolean (SCIP *const scip, SCIP_CONS *const cons)
 
SCIP_LINEARCONSTYPE SCIPgetLinearConsTypePseudoboolean (SCIP *const scip, SCIP_CONS *const cons)
 
int SCIPgetNLinVarsWithoutAndPseudoboolean (SCIP *const scip, SCIP_CONS *const cons)
 
SCIP_RETCODE SCIPgetLinDatasWithoutAndPseudoboolean (SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const linvars, SCIP_Real *const lincoefs, int *const nlinvars)
 
SCIP_RETCODE SCIPgetAndDatasPseudoboolean (SCIP *const scip, SCIP_CONS *const cons, SCIP_CONS **const andconss, SCIP_Real *const andcoefs, int *const nandconss)
 
int SCIPgetNAndsPseudoboolean (SCIP *const scip, SCIP_CONS *const cons)
 
SCIP_RETCODE SCIPchgLhsPseudoboolean (SCIP *const scip, SCIP_CONS *const cons, SCIP_Real const lhs)
 
SCIP_RETCODE SCIPchgRhsPseudoboolean (SCIP *const scip, SCIP_CONS *const cons, SCIP_Real const rhs)
 
SCIP_Real SCIPgetLhsPseudoboolean (SCIP *const scip, SCIP_CONS *const cons)
 
SCIP_Real SCIPgetRhsPseudoboolean (SCIP *const scip, SCIP_CONS *const cons)
 

Macro Definition Documentation

#define CONSHDLR_DESC   "constraint handler template"

Definition at line 52 of file cons_pseudoboolean.c.

Referenced by SCIPincludeConshdlrPseudoboolean().

#define CONSHDLR_ENFOPRIORITY   -1000000

priority of the constraint handler for constraint enforcing

Definition at line 53 of file cons_pseudoboolean.c.

Referenced by SCIPincludeConshdlrPseudoboolean().

#define CONSHDLR_CHECKPRIORITY   -5000000

priority of the constraint handler for checking feasibility

Definition at line 54 of file cons_pseudoboolean.c.

Referenced by SCIPincludeConshdlrPseudoboolean().

#define CONSHDLR_EAGERFREQ   100

frequency for using all instead of only the useful constraints in separation, propagation and enforcement, -1 for no eager evaluations, 0 for first only

Definition at line 55 of file cons_pseudoboolean.c.

Referenced by SCIPincludeConshdlrPseudoboolean().

#define CONSHDLR_MAXPREROUNDS   -1

maximal number of presolving rounds the constraint handler participates in (-1: no limit)

Definition at line 57 of file cons_pseudoboolean.c.

Referenced by SCIPincludeConshdlrPseudoboolean().

#define CONSHDLR_DELAYPRESOL   FALSE

should presolving method be delayed, if other presolvers found reductions?

Definition at line 58 of file cons_pseudoboolean.c.

Referenced by SCIPincludeConshdlrPseudoboolean().

#define CONSHDLR_NEEDSCONS   TRUE

should the constraint handler be skipped, if no constraints are available?

Definition at line 59 of file cons_pseudoboolean.c.

Referenced by SCIPincludeConshdlrPseudoboolean().

#define DEFAULT_DECOMPOSENORMALPBCONS   FALSE

decompose all normal pseudo boolean constraint into a "linear" constraint "and" constrainst

Definition at line 61 of file cons_pseudoboolean.c.

Referenced by SCIPincludeConshdlrPseudoboolean().

#define DEFAULT_DECOMPOSEINDICATORPBCONS   TRUE

decompose all indicator pseudo boolean constraint into a "linear" constraint "and" constrainst

Definition at line 62 of file cons_pseudoboolean.c.

Referenced by SCIPincludeConshdlrPseudoboolean().

#define DEFAULT_SEPARATENONLINEAR   TRUE

if decomposed, should the nonlinear constraints be separated during LP processing

Definition at line 64 of file cons_pseudoboolean.c.

Referenced by SCIPincludeConshdlrPseudoboolean().

#define DEFAULT_PROPAGATENONLINEAR   TRUE

if decomposed, should the nonlinear constraints be propagated during node processing

Definition at line 65 of file cons_pseudoboolean.c.

Referenced by SCIPincludeConshdlrPseudoboolean().

#define DEFAULT_REMOVABLENONLINEAR   TRUE

if decomposed, should the nonlinear constraints be removable

Definition at line 66 of file cons_pseudoboolean.c.

Referenced by SCIPincludeConshdlrPseudoboolean().

#define USEINDICATOR   TRUE

Definition at line 67 of file cons_pseudoboolean.c.

#define HASHSIZE_PSEUDOBOOLEANNONLINEARTERMS   131101

minimal size of hash table in and constraint tables

Definition at line 72 of file cons_pseudoboolean.c.

Referenced by inithashmapandtable().

#define MAXNVARS   10 /* note that this cannot be bigger than 31 */

Definition at line 5144 of file cons_pseudoboolean.c.

Referenced by checkSolution(), and tryUpgradingXor().

Typedef Documentation

typedef struct ConsAndData CONSANDDATA

Definition at line 139 of file cons_pseudoboolean.c.

Function Documentation

static SCIP_DECL_SORTPTRCOMP ( resvarCompWithInactive  )
static

comparison method for sorting consanddatas according to the index of their corresponding resultant variables, if a consanddata object is delete it is handled like it has an inactive resultant, so this will be put in front while sorting

Definition at line 207 of file cons_pseudoboolean.c.

References ConsAndData::cons, ConsAndData::istransformed, NULL, SCIPconsIsDeleted(), SCIPgetResultantAnd(), and SCIPvarGetIndex().

static SCIP_DECL_HASHGETKEY ( hashGetKeyAndConsDatas  )
static

gets the key of the given element

Definition at line 269 of file cons_pseudoboolean.c.

static SCIP_DECL_HASHKEYEQ ( hashKeyEqAndConsDatas  )
static

returns TRUE iff both keys are equal; two non-linear terms are equal if they have the same variables

Definition at line 277 of file cons_pseudoboolean.c.

References ConsAndData::cons, FALSE, NULL, ConsAndData::nvars, SCIPvarCompare(), SCIPvarGetIndex(), TRUE, and ConsAndData::vars.

static SCIP_DECL_HASHKEYVAL ( hashKeyValAndConsDatas  )
static

returns the hash value of the key

Definition at line 338 of file cons_pseudoboolean.c.

References NULL, ConsAndData::nvars, SCIPvarGetIndex(), and ConsAndData::vars.

static SCIP_RETCODE inithashmapandtable ( SCIP *const  scip,
SCIP_CONSHDLRDATA **  conshdlrdata 
)
static

initializes the hashmap and -table used in this constraint handler data for artificial variables and specific and-constraint data objects

Parameters
scipSCIP data structure
conshdlrdatapointer to store the constraint handler data

Definition at line 371 of file cons_pseudoboolean.c.

References HASHSIZE_PSEUDOBOOLEANNONLINEARTERMS, NULL, SCIP_CALL, SCIP_OKAY, SCIPblkmem(), SCIPcalcHashtableSize(), SCIPhashmapCreate(), SCIPhashtableCreate(), and TRUE.

Referenced by SCIPcreateConsPseudoboolean(), and SCIPcreateConsPseudobooleanWithConss().

static SCIP_RETCODE conshdlrdataCreate ( SCIP *const  scip,
SCIP_CONSHDLRDATA **  conshdlrdata 
)
static

creates constraint handler data for pseudo boolean constraint handler

Parameters
scipSCIP data structure
conshdlrdatapointer to store the constraint handler data

Definition at line 403 of file cons_pseudoboolean.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemoryArray, and SCIPallocMemory.

Referenced by SCIPincludeConshdlrPseudoboolean().

static SCIP_RETCODE conshdlrdataFree ( SCIP *const  scip,
SCIP_CONSHDLRDATA **  conshdlrdata 
)
static

frees constraint handler data for pseudo boolean constraint handler

Parameters
scipSCIP data structure
conshdlrdatapointer to the constraint handler data

Definition at line 438 of file cons_pseudoboolean.c.

References FALSE, NULL, SCIP_OKAY, SCIPfreeBlockMemoryArray, SCIPfreeMemory, SCIPhashmapFree(), and SCIPhashtableFree().

Referenced by SCIP_DECL_CONSFREE().

static SCIP_RETCODE getLinearConsNVars ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_LINEARCONSTYPE const  constype,
int *const  nvars 
)
static
static SCIP_RETCODE getLinearConsSides ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_LINEARCONSTYPE const  constype,
SCIP_Real *const  lhs,
SCIP_Real *const  rhs 
)
static

gets sides of linear constraint

Parameters
scipSCIP data structure
conslinear constraint
constypelinear constraint type
lhspointer to store left hand side of linear constraint
rhspointer to store right hand side of linear constraint

Definition at line 520 of file cons_pseudoboolean.c.

References SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_LINEARCONSTYPE_KNAPSACK, SCIP_LINEARCONSTYPE_LINEAR, SCIP_LINEARCONSTYPE_LOGICOR, SCIP_LINEARCONSTYPE_SETPPC, SCIP_OKAY, SCIP_SETPPCTYPE_COVERING, SCIP_SETPPCTYPE_PACKING, SCIP_SETPPCTYPE_PARTITIONING, SCIPerrorMessage, SCIPgetCapacityKnapsack(), SCIPgetLhsLinear(), SCIPgetRhsLinear(), SCIPgetTypeSetppc(), and SCIPinfinity().

Referenced by checkOrigPbCons(), chgLhs(), chgRhs(), consdataPrint(), SCIP_DECL_CONSINITPRE(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE getLinearConsVarsData ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_LINEARCONSTYPE const  constype,
SCIP_VAR **const  vars,
SCIP_Real *const  coefs,
int *const  nvars 
)
static
static SCIP_RETCODE getLinVarsAndAndRess ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_VAR **const  vars,
SCIP_Real *const  coefs,
int const  nvars,
SCIP_VAR **const  linvars,
SCIP_Real *const  lincoefs,
int *const  nlinvars,
SCIP_VAR **const  andress,
SCIP_Real *const  andcoefs,
int *const  nandress 
)
static

calculate all not artificial linear variables and all artificial and-resultants which will be ordered like the 'consanddatas' such that the and-resultant of the and-constraint is the and-resultant in the 'andress' array afterwards

Parameters
scipSCIP data structure
conspseudoboolean constraint
varsall variables of linear constraint
coefsall coefficients of linear constraint, or NULL
nvarsnumber of all variables of linear constraint
linvarsarray to store not and-resultant variables of linear constraint, or NULL
lincoefsarray to store coefficients of not and-resultant variables of linear constraint, or NULL
nlinvarspointer to store number of not and-resultant variables, or NULL
andressarray to store and-resultant variables of linear constraint, or NULL
andcoefsarray to store coefficients of and-resultant variables of linear constraint, or NULL
nandresspointer to store number of and-resultant variables, or NULL

Definition at line 742 of file cons_pseudoboolean.c.

References NULL, SCIP_Bool, SCIP_OKAY, SCIPconsGetHdlr(), SCIPconshdlrGetData(), SCIPconsIsDeleted(), SCIPconsIsOriginal(), SCIPhashmapExists(), SCIPhashmapGetImage(), and SCIPvarGetIndex().

Referenced by addCliques(), chgLhs(), chgRhs(), consdataPrint(), findAggregation(), SCIP_DECL_CONSGETNVARS(), SCIP_DECL_CONSGETVARS(), SCIP_DECL_CONSPRESOL(), SCIPgetLinDatasWithoutAndPseudoboolean(), tryUpgradingLogicor(), and tryUpgradingXor().

static SCIP_RETCODE transformToOrig ( SCIP *const  scip,
CONSANDDATA consanddata,
SCIP_CONSHDLRDATA conshdlrdata 
)
static

transforming transformed consanddata object back to original space, if an corresponding original constraint exists, also clearing all transformed data, i.e. releasing transformed variables

Parameters
scipSCIP data structure
consanddataconsanddata object
conshdlrdataconstraint handler data

Definition at line 851 of file cons_pseudoboolean.c.

References FALSE, ConsAndData::isoriginal, ConsAndData::istransformed, ConsAndData::newvars, ConsAndData::nnewvars, ConsAndData::noriguses, NULL, ConsAndData::nuses, ConsAndData::nvars, ConsAndData::origcons, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemoryArray, SCIPfreeBlockMemoryArrayNull, SCIPgetNVarsAnd(), SCIPgetResultantAnd(), SCIPgetVarsAnd(), SCIPhashmapExists(), SCIPhashmapGetImage(), SCIPhashtableExists(), SCIPhashtableRetrieve(), SCIPreleaseVar(), SCIPsortPtr(), SCIPvarIsTransformed(), ConsAndData::snewvars, ConsAndData::svars, TRUE, and ConsAndData::vars.

Referenced by consdataFree(), correctConshdlrdata(), and updateConsanddataUses().

static SCIP_RETCODE consdataCreate ( SCIP *const  scip,
SCIP_CONSHDLR *const  conshdlr,
SCIP_CONSDATA **  consdata,
SCIP_CONS *const  lincons,
SCIP_LINEARCONSTYPE const  linconstype,
SCIP_CONS **const  andconss,
SCIP_Real *const  andcoefs,
int const  nandconss,
SCIP_VAR *const  indvar,
SCIP_Real const  weight,
SCIP_Bool const  issoftcons,
SCIP_VAR *const  intvar,
SCIP_Real  lhs,
SCIP_Real  rhs,
SCIP_Bool  check,
SCIP_Bool  transforming 
)
static

creates a pseudo boolean constraint data

Parameters
scipSCIP data structure
conshdlrpseudoboolean constraint handler
consdatapointer to linear constraint data
linconslinear constraint with artificial and-resultants representing this pseudoboolean constraint
linconstypetype of linear constraint
andconssarray of and-constraints which occur in this pseudoboolean constraint
andcoefscoefficients of and-constraints
nandconssnumber of and-constraints
indvarindicator variable if it's a soft constraint, or NULL
weightweight of the soft constraint, if it is one
issoftconsis this a soft constraint
intvara 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
lhsleft hand side of row
rhsright hand side of row
checkis the new constraint a check constraint?
transformingare we called by CONSTRANS

Definition at line 976 of file cons_pseudoboolean.c.

References FALSE, getLinearConsNVars(), NULL, SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_OKAY, SCIP_STAGE_PROBLEM, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, SCIPallocBufferArray, SCIPcaptureVar(), SCIPconshdlrGetData(), SCIPconsIsTransformed(), SCIPduplicateBlockMemoryArray, SCIPerrorMessage, SCIPfreeBufferArray, SCIPgetResultantAnd(), SCIPgetStage(), SCIPgetTransformedVar(), SCIPgetTransformedVars(), SCIPhashmapGetImage(), SCIPinfinity(), SCIPisGT(), SCIPisInfinity(), SCIPisTransformed(), SCIPisZero(), SCIPsetConsChecked(), SCIPsortPtr(), SCIPsortPtrPtrReal(), SCIPtransformCons(), and TRUE.

Referenced by SCIP_DECL_CONSTRANS(), SCIPcreateConsPseudoboolean(), and SCIPcreateConsPseudobooleanWithConss().

static SCIP_RETCODE consdataFree ( SCIP *const  scip,
SCIP_CONSDATA **  consdata,
SCIP_Bool  isorig,
SCIP_CONSHDLRDATA conshdlrdata 
)
static
static SCIP_RETCODE lockRoundingAndCons ( SCIP *const  scip,
SCIP_CONS *const  cons,
CONSANDDATA *const  consanddata,
SCIP_Real const  coef,
SCIP_Real const  lhs,
SCIP_Real const  rhs 
)
static

installs rounding locks for the given and-constraint associated with given coefficient

Parameters
scipSCIP data structure
conspseudoboolean constraint
consanddataCONSANDDATA object for which we want to delete the locks and the capture of the corresponding and-constraint
coefcoefficient which led to old locks
lhsleft hand side which led to old locks
rhsright hand side which led to old locks

Definition at line 1432 of file cons_pseudoboolean.c.

References ConsAndData::cons, ConsAndData::newvars, ConsAndData::nnewvars, NULL, ConsAndData::nvars, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconsIsLocked(), SCIPgetResultantAnd(), SCIPisInfinity(), SCIPisLE(), SCIPisPositive(), SCIPlockVarCons(), TRUE, and ConsAndData::vars.

Referenced by addCoefTerm(), and addNewLocks().

static SCIP_RETCODE unlockRoundingAndCons ( SCIP *const  scip,
SCIP_CONS *const  cons,
CONSANDDATA *const  consanddata,
SCIP_Real const  coef,
SCIP_Real const  lhs,
SCIP_Real const  rhs 
)
static

removes rounding locks for the given and-constraint associated with given coefficient

Parameters
scipSCIP data structure
conspseudoboolean constraint
consanddataCONSANDDATA object for which we want to delete the locks and the capture of the corresponding and-constraint
coefcoefficient which led to old locks
lhsleft hand side which led to old locks
rhsright hand side which led to old locks

Definition at line 1501 of file cons_pseudoboolean.c.

References ConsAndData::cons, NULL, ConsAndData::nvars, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconsIsLocked(), SCIPgetResultantAnd(), SCIPisInfinity(), SCIPisLE(), SCIPisPositive(), SCIPunlockVarCons(), TRUE, and ConsAndData::vars.

Referenced by correctLocksAndCaptures(), and removeOldLocks().

static SCIP_RETCODE createAndAddAndCons ( SCIP *const  scip,
SCIP_CONSHDLR *const  conshdlr,
SCIP_VAR **const  vars,
int const  nvars,
SCIP_Bool const  initial,
SCIP_Bool const  enforce,
SCIP_Bool const  check,
SCIP_Bool const  local,
SCIP_Bool const  modifiable,
SCIP_Bool const  dynamic,
SCIP_Bool const  stickingatnode,
SCIP_CONS **const  andcons 
)
static

creates and/or adds the resultant for a given term

Parameters
scipSCIP data structure
conshdlrpseudoboolean constraint handler
varsarray of variables to get and-constraints for
nvarsnumber of variables to get and-constraints for
initialshould the LP relaxation of constraint be in the initial LP? Usually set to TRUE. Set to FALSE for 'lazy constraints'.
enforceshould the constraint be enforced during node processing? TRUE for model constraints, FALSE for additional, redundant constraints.
checkshould the constraint be checked for feasibility? TRUE for model constraints, FALSE for additional, redundant constraints.
localis constraint only valid locally? Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints.
modifiableis constraint modifiable (subject to column generation)? Usually set to FALSE. In column generation applications, set to TRUE if pricing adds coefficients to this constraint.
dynamicis constraint subject to aging? Usually set to FALSE. Set to TRUE for own cuts which are seperated as constraints.
stickingatnodeshould the constraint always be kept at the node where it was added, even if it may be moved to a more global node? Usually set to FALSE. Set to TRUE to for constraints that represent node data.
andconspointer to store and-constraint

Definition at line 1750 of file cons_pseudoboolean.c.

References ARTIFICIALVARNAMEPREFIX, ConsAndData::cons, CONSHDLR_NAME, FALSE, ConsAndData::isoriginal, ConsAndData::istransformed, ConsAndData::newvars, ConsAndData::nnewvars, ConsAndData::noriguses, NULL, ConsAndData::nuses, ConsAndData::nvars, ConsAndData::origcons, SCIP_Bool, SCIP_CALL, SCIP_ERROR, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIPABORT, SCIPaddCons(), SCIPaddVar(), SCIPallocBlockMemory, SCIPcalcMemGrowSize(), SCIPcaptureCons(), SCIPcaptureVar(), SCIPchgAndConsCheckFlagWhenUpgr(), SCIPchgAndConsRemovableFlagWhenUpgr(), SCIPchgVarBranchPriority(), SCIPconshdlrGetData(), SCIPcreateConsAnd(), SCIPcreateVar(), SCIPdebugAddSolVal, SCIPdebugGetSolVal, SCIPdebugPrintCons, SCIPduplicateBlockMemoryArray, SCIPensureBlockMemoryArray, SCIPerrorMessage, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, SCIPgetBoolParam(), SCIPgetResultantAnd(), SCIPhashmapExists(), SCIPhashmapInsert(), SCIPhashtableInsert(), SCIPhashtableRetrieve(), SCIPisFeasEQ(), SCIPisFeasZero(), SCIPisTransformed(), SCIPreleaseCons(), SCIPreleaseVar(), SCIPsnprintf(), SCIPsortPtr(), SCIPvarGetName(), SCIPvarIsOriginal(), SCIPvarIsTransformedOrigvar(), ConsAndData::snewvars, ConsAndData::svars, TRUE, and ConsAndData::vars.

Referenced by addCoefTerm(), and createAndAddAnds().

static SCIP_RETCODE chgLhsLinearCons ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_LINEARCONSTYPE const  constype,
SCIP_Real const  lhs 
)
static

changes left hand side of linear constraint

Parameters
scipSCIP data structure
conslinear constraint
constypelinear constraint type
lhsnew left hand side of linear constraint

Definition at line 2090 of file cons_pseudoboolean.c.

References SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_LINEARCONSTYPE_KNAPSACK, SCIP_LINEARCONSTYPE_LINEAR, SCIP_LINEARCONSTYPE_LOGICOR, SCIP_LINEARCONSTYPE_SETPPC, SCIP_OKAY, SCIPchgLhsLinear(), and SCIPerrorMessage.

Referenced by chgLhs().

static SCIP_RETCODE chgRhsLinearCons ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_LINEARCONSTYPE const  constype,
SCIP_Real const  rhs 
)
static

changes right hand side of linear constraint

Parameters
scipSCIP data structure
conslinear constraint
constypelinear constraint type
rhsnew right hand side of linear constraint

Definition at line 2121 of file cons_pseudoboolean.c.

References SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_LINEARCONSTYPE_KNAPSACK, SCIP_LINEARCONSTYPE_LINEAR, SCIP_LINEARCONSTYPE_LOGICOR, SCIP_LINEARCONSTYPE_SETPPC, SCIP_OKAY, SCIPchgRhsLinear(), and SCIPerrorMessage.

Referenced by chgRhs().

static SCIP_RETCODE createAndAddAnds ( SCIP *const  scip,
SCIP_CONSHDLR *const  conshdlr,
SCIP_VAR **const *const  terms,
SCIP_Real *const  termcoefs,
int const  nterms,
int const *const  ntermvars,
SCIP_Bool const  initial,
SCIP_Bool const  enforce,
SCIP_Bool const  check,
SCIP_Bool const  local,
SCIP_Bool const  modifiable,
SCIP_Bool const  dynamic,
SCIP_Bool const  stickingatnode,
SCIP_CONS **const  andconss,
SCIP_Real *const  andvals,
int *const  nandconss 
)
static

create and-constraints and get all and-resultants

Parameters
scipSCIP data structure
conshdlrpseudoboolean constraint handler
termsarray of term variables to get and-constraints for
termcoefsarray of coefficients for and-constraints
ntermsnumber of terms to get and-constraints for
ntermvarsarray of number of variable in each term
initialshould the LP relaxation of constraint be in the initial LP? Usually set to TRUE. Set to FALSE for 'lazy constraints'.
enforceshould the constraint be enforced during node processing? TRUE for model constraints, FALSE for additional, redundant constraints.
checkshould the constraint be checked for feasibility? TRUE for model constraints, FALSE for additional, redundant constraints.
localis constraint only valid locally? Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints.
modifiableis constraint modifiable (subject to column generation)? Usually set to FALSE. In column generation applications, set to TRUE if pricing adds coefficients to this constraint.
dynamicis constraint subject to aging? Usually set to FALSE. Set to TRUE for own cuts which are seperated as constraints.
stickingatnodeshould the constraint always be kept at the node where it was added, even if it may be moved to a more global node? Usually set to FALSE. Set to TRUE to for constraints that represent node data.
andconssarray to store all created and-constraints for given terms
andvalsarray to store all coefficients of and-constraints
nandconssnumber of created and constraints

Definition at line 2492 of file cons_pseudoboolean.c.

References createAndAddAndCons(), NULL, SCIP_CALL, SCIP_OKAY, and SCIPisZero().

Referenced by SCIPcreateConsPseudoboolean().

static SCIP_RETCODE createAndAddLinearCons ( SCIP *const  scip,
SCIP_CONSHDLR *const  conshdlr,
SCIP_VAR **const  linvars,
int const  nlinvars,
SCIP_Real *const  linvals,
SCIP_VAR **const  andress,
int const  nandress,
SCIP_Real const *const  andvals,
SCIP_Real *const  lhs,
SCIP_Real *const  rhs,
SCIP_Bool const  initial,
SCIP_Bool const  separate,
SCIP_Bool const  enforce,
SCIP_Bool const  check,
SCIP_Bool const  propagate,
SCIP_Bool const  local,
SCIP_Bool const  modifiable,
SCIP_Bool const  dynamic,
SCIP_Bool const  removable,
SCIP_Bool const  stickingatnode,
SCIP_CONS **const  lincons,
SCIP_LINEARCONSTYPE *const  linconstype 
)
static

created linear constraint of pseudo boolean constraint

Parameters
scipSCIP data structure
conshdlrpseudoboolean constraint handler
linvarslinear variables
nlinvarsnumber of linear variables
linvalslinear coefficients
andressand-resultant variables
nandressnumber of and-resultant variables
andvalsand-resultant coefficients
lhspointer to left hand side of linear constraint
rhspointer to right hand side of linear constraint
initialshould the LP relaxation of constraint be in the initial LP? Usually set to TRUE. Set to FALSE for 'lazy constraints'.
separateshould the constraint be separated during LP processing? Usually set to TRUE.
enforceshould the constraint be enforced during node processing? TRUE for model constraints, FALSE for additional, redundant constraints.
checkshould the constraint be checked for feasibility? TRUE for model constraints, FALSE for additional, redundant constraints.
propagateshould the constraint be propagated during node processing? Usually set to TRUE.
localis constraint only valid locally? Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints.
modifiableis constraint modifiable (subject to column generation)? Usually set to FALSE. In column generation applications, set to TRUE if pricing adds coefficients to this constraint.
dynamicis constraint subject to aging? Usually set to FALSE. Set to TRUE for own cuts which are seperated as constraints.
removableshould the relaxation be removed from the LP due to aging or cleanup? Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'.
stickingatnodeshould the constraint always be kept at the node where it was added, even if it may be moved to a more global node? Usually set to FALSE. Set to TRUE to for constraints that represent node data.
linconspointer to store created linear constraint
linconstypepointer to store the type of the linear constraint

Definition at line 2558 of file cons_pseudoboolean.c.

References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_LINEARCONSTYPE_KNAPSACK, SCIP_LINEARCONSTYPE_LINEAR, SCIP_LINEARCONSTYPE_LOGICOR, SCIP_LINEARCONSTYPE_SETPPC, SCIP_Longint, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddCoefLinear(), SCIPaddCons(), SCIPallocBufferArray, SCIPcaptureCons(), SCIPconsAddUpgradeLocks(), SCIPconshdlrGetData(), SCIPcreateConsKnapsack(), SCIPcreateConsLinear(), SCIPcreateConsLogicor(), SCIPcreateConsSetcover(), SCIPcreateConsSetpack(), SCIPcreateConsSetpart(), SCIPdebugMessage, SCIPdebugPrintCons, SCIPfeasFloor(), SCIPfindConshdlr(), SCIPfreeBufferArray, SCIPgetNegatedVar(), SCIPinfinity(), SCIPisEQ(), SCIPisFeasIntegral(), SCIPisInfinity(), SCIPisIntegral(), SCIPisPositive(), SCIPisZero(), SCIPreleaseCons(), SCIPsnprintf(), SCIPwarningMessage(), and TRUE.

Referenced by SCIPcreateConsPseudoboolean().

static SCIP_RETCODE checkOrigPbCons ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_SOL *const  sol,
SCIP_Bool *const  violated,
SCIP_Bool const  printreason 
)
static

checks one original pseudoboolean constraint for feasibility of given solution

Parameters
scipSCIP data structure
conspseudo boolean constraint
solsolution to be checked, or NULL for current solution
violatedpointer to store whether the constraint is violated
printreasonshould violation of constraint be printed

Definition at line 3177 of file cons_pseudoboolean.c.

References FALSE, getLinearConsNVars(), getLinearConsSides(), getLinearConsVarsData(), NULL, SCIP_CALL, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconsIsOriginal(), SCIPdebugMessage, SCIPdebugPrintCons, SCIPfreeBufferArray, SCIPgetNVarsAnd(), SCIPgetResultantAnd(), SCIPgetSolVal(), SCIPgetVarsAnd(), SCIPhashmapExists(), SCIPinfoMessage(), SCIPisFeasGT(), SCIPisFeasLT(), SCIPisFeasZero(), SCIPisInfinity(), SCIPisLE(), SCIPprintCons(), and TRUE.

Referenced by SCIP_DECL_CONSCHECK().

static SCIP_RETCODE checkAndConss ( SCIP *const  scip,
SCIP_CONSHDLR *const  conshdlr,
SCIP_SOL *const  sol,
SCIP_Bool *const  violated 
)
static

checks all and-constraints inside the pseudoboolean constraint handler for feasibility of given solution or current solution

Parameters
scipSCIP data structure
conshdlrpseudo boolean constraint handler
solsolution to be checked, or NULL for current solution
violatedpointer to store whether the constraint is violated

Definition at line 3375 of file cons_pseudoboolean.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPconshdlrGetData(), SCIPgetNVarsAnd(), SCIPgetResultantAnd(), SCIPgetSolVal(), SCIPgetVarsAnd(), SCIPincConsAge(), SCIPisFeasEQ(), SCIPisFeasZero(), SCIPresetConsAge(), and TRUE.

Referenced by SCIP_DECL_CONSCHECK(), SCIP_DECL_CONSENFOLP(), and SCIP_DECL_CONSENFOPS().

static SCIP_RETCODE copyConsPseudoboolean ( SCIP *const  targetscip,
SCIP_CONS **  targetcons,
SCIP *const  sourcescip,
SCIP_CONS *const  sourcecons,
const char *  name,
SCIP_HASHMAP *const  varmap,
SCIP_HASHMAP *const  consmap,
SCIP_Bool const  initial,
SCIP_Bool const  separate,
SCIP_Bool const  enforce,
SCIP_Bool const  check,
SCIP_Bool const  propagate,
SCIP_Bool const  local,
SCIP_Bool const  modifiable,
SCIP_Bool const  dynamic,
SCIP_Bool const  removable,
SCIP_Bool const  stickingatnode,
SCIP_Bool const  global,
SCIP_Bool *const  valid 
)
static

creates by copying and captures a linear constraint

Parameters
targetsciptarget SCIP data structure
targetconspointer to store the created target constraint
sourcescipsource SCIP data structure
sourceconssource constraint which will be copied
namename of constraint
varmapa SCIP_HASHMAP mapping variables of the source SCIP to corresponding variables of the target SCIP
consmapa hashmap to store the mapping of source constraints to the corresponding target constraints
initialshould the LP relaxation of constraint be in the initial LP?
separateshould the constraint be separated during LP processing?
enforceshould the constraint be enforced during node processing?
checkshould the constraint be checked for feasibility?
propagateshould the constraint be propagated during node processing?
localis constraint only valid locally?
modifiableis constraint modifiable (subject to column generation)?
dynamicis constraint subject to aging?
removableshould the relaxation be removed from the LP due to aging or cleanup?
stickingatnodeshould the constraint always be kept at the node where it was added, even if it may be moved to a more global node?
globalcreate a global or a local copy?
validpointer to store if the copying was valid

Definition at line 3448 of file cons_pseudoboolean.c.

References ConsAndData::cons, CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_LINEARCONSTYPE_KNAPSACK, SCIP_LINEARCONSTYPE_LINEAR, SCIP_LINEARCONSTYPE_LOGICOR, SCIP_LINEARCONSTYPE_SETPPC, SCIP_OKAY, SCIP_Real, SCIP_VERBLEVEL_MINIMAL, SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPconsIsChecked(), SCIPconsIsDeleted(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsPseudobooleanWithConss(), SCIPdebugMessage, SCIPerrorMessage, SCIPfindConshdlr(), SCIPfreeBufferArrayNull, SCIPgetConsCopy(), SCIPgetVarCopy(), SCIPreleaseCons(), SCIPverbMessage(), and TRUE.

Referenced by SCIP_DECL_CONSCOPY().

static SCIP_RETCODE computeConsAndDataChanges ( SCIP *const  scip,
SCIP_CONSHDLRDATA *const  conshdlrdata 
)
static
static SCIP_RETCODE removeOldLocks ( SCIP *const  scip,
SCIP_CONS *const  cons,
CONSANDDATA *const  consanddata,
SCIP_Real const  coef,
SCIP_Real const  lhs,
SCIP_Real const  rhs 
)
static

remove old locks

Parameters
scipSCIP data structure
conspseudoboolean constraint
consanddataCONSANDDATA object for which we want to delete the locks and the capture of the corresponding and-constraint
coefcoefficient which led to old locks
lhsleft hand side which led to old locks
rhsright hand side which led to old locks

Definition at line 3816 of file cons_pseudoboolean.c.

References ConsAndData::cons, NULL, SCIP_CALL, SCIP_OKAY, SCIPisInfinity(), SCIPisLE(), and unlockRoundingAndCons().

Referenced by correctLocksAndCaptures(), and updateConsanddataUses().

static SCIP_RETCODE addNewLocks ( SCIP *const  scip,
SCIP_CONS *const  cons,
CONSANDDATA *const  consanddata,
SCIP_Real const  coef,
SCIP_Real const  lhs,
SCIP_Real const  rhs 
)
static

add new locks

Parameters
scipSCIP data structure
conspseudoboolean constraint
consanddataCONSANDDATA object for which we want to delete the locks and the capture of the corresponding and-constraint
coefcoefficient which lead to new locks
lhsleft hand side which lead to new locks
rhsright hand side which lead to new locks

Definition at line 3844 of file cons_pseudoboolean.c.

References ConsAndData::cons, lockRoundingAndCons(), NULL, SCIP_CALL, SCIP_OKAY, SCIPisInfinity(), and SCIPisLE().

Referenced by correctLocksAndCaptures().

static SCIP_RETCODE correctLocksAndCaptures ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_CONSHDLRDATA *const  conshdlrdata,
SCIP_Real const  newlhs,
SCIP_Real const  newrhs,
SCIP_VAR **const  andress,
SCIP_Real *const  andcoefs,
int const  nandress 
)
static

update all locks inside this constraint and all captures on all and-constraints

Parameters
scipSCIP data structure
conspseudoboolean constraint
conshdlrdatapseudoboolean constraint handler data
newlhsnew left hand side of pseudoboolean constraint
newrhsnew right hand side of pseudoboolean constraint
andresscurrent and-resultants in pseudoboolean constraint
andcoefscurrent and-resultants-coeffcients in pseudoboolean constraint
nandressnumber of current and-resultants in pseudoboolean constraint

Definition at line 3872 of file cons_pseudoboolean.c.

References addNewLocks(), ConsAndData::cons, FALSE, getLinearConsNVars(), NULL, ConsAndData::nuses, removeOldLocks(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBlockMemoryArray, SCIPconsGetData(), SCIPconsIsDeleted(), SCIPfreeBlockMemoryArray, SCIPgetResultantAnd(), SCIPhashmapGetImage(), SCIPisEQ(), SCIPisInfinity(), SCIPisLE(), SCIPisZero(), SCIPsortPtrReal(), SCIPvarGetIndex(), TRUE, and unlockRoundingAndCons().

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE addCliques ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_Bool *const  cutoff,
int *const  naggrvars,
int *const  nchgbds 
)
static
static SCIP_RETCODE propagateCons ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_Bool *const  cutoff,
int *const  ndelconss 
)
static

propagation method for pseudoboolean constraints

Parameters
scipSCIP data structure
consknapsack constraint
cutoffpointer to store whether the node can be cut off
ndelconsspointer to count number of deleted constraints

Definition at line 4637 of file cons_pseudoboolean.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconsIsDeleted(), SCIPdelConsLocal(), and TRUE.

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE updateAndConss ( SCIP *const  scip,
SCIP_CONS *const  cons 
)
static

update and-constraint flags due to pseudoboolean constraint flags

Parameters
scipSCIP data structure
conspseudoboolean constraint

Definition at line 4676 of file cons_pseudoboolean.c.

References ConsAndData::cons, NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconsIsActive(), SCIPconsIsChecked(), and SCIPsetConsChecked().

Referenced by SCIP_DECL_CONSINITPRE(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE updateConsanddataUses ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_CONSHDLRDATA *const  conshdlrdata,
int *const  ndelconss 
)
static
static SCIP_RETCODE checkSolution ( SCIP *const  scip,
SCIP_VAR **const  vars,
int const  nvars,
SCIP_Bool *const  values,
SCIP_VAR **const  linvars,
SCIP_Real *const  lincoefs,
int const  nlinvars,
SCIP_Real const  constant,
SCIP_Real const  side,
CONSANDDATA **const  consanddatas,
SCIP_Real *const  consanddatacoefs,
int const  nconsanddatas,
int const  cnt,
int *const  xortype 
)
static

calculate result for a given pseudoboolean constraint with given values, this is used to decide whether a pseudoboolean constraint can be upgrade to an XOR constraint

Parameters
scipSCIP data structure
varsall variables which occur
nvarsnumber of all variables which appear in the pseudoboolean constraint
valuesvalues of all variables which appear in the pseudoboolean constraint
linvarslinear variables
lincoefslinear coefficients
nlinvarsnumber of linear variables
constantoffset to the linear part
sideside of pseudoboolean constraint
consanddatasall consanddata objects in a constraint
consanddatacoefsnonlinear coefficients
nconsanddatasnumber of all consanddata objects
cntnumber of variables set to 1
xortypepointer to save the possible xor type if a solution was valid and does not violate the old xortype

Definition at line 5150 of file cons_pseudoboolean.c.

References BMSclearMemoryArray, FALSE, ConsAndData::istransformed, MAXNVARS, ConsAndData::newvars, ConsAndData::nnewvars, NULL, ConsAndData::nvars, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPABORT, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPgetBinvarRepresentatives(), SCIPisEQ(), SCIPisZero(), SCIPsortedvecFindPtr(), SCIPsortPtr(), SCIPsortPtrBool(), SCIPvarGetNegatedVar(), SCIPvarGetNegationVar(), SCIPvarIsNegated(), TRUE, and ConsAndData::vars.

Referenced by tryUpgradingXor().

static SCIP_RETCODE tryUpgradingXor ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_CONSHDLRDATA *const  conshdlrdata,
int *const  ndelconss,
int *const  naddconss,
int *const  nfixedvars,
int *const  nchgcoefs,
int *const  nchgsides,
SCIP_Bool *const  cutoff 
)
static

try upgrading pseudoboolean linear constraint to an XOR constraint and/or remove possible and-constraints

Note
An XOR(x_1,..,x_n) = 1 <=> XOR(x1,..,~x_j,..,x_n) = 0, for j in {1,..,n}, which is not yet checked while trying to upgrade
Parameters
scipSCIP data structure
conspseudoboolean constraint
conshdlrdatapseudoboolean constraint handler data
ndelconsspointer to store number of deleted constraints
naddconsspointer to count number of added constraints
nfixedvarspointer to store number of fixed variables
nchgcoefspointer to store number of changed coefficients constraints
nchgsidespointer to store number of changed sides constraints
cutoffpointer to store if a cutoff happened

Definition at line 5323 of file cons_pseudoboolean.c.

References BMSclearMemoryArray, checkSolution(), FALSE, getLinearConsNVars(), getLinearConsVarsData(), getLinVarsAndAndRess(), ConsAndData::istransformed, MAXNVARS, ConsAndData::newvars, ConsAndData::nnewvars, NULL, ConsAndData::nvars, SCIP_Bool, SCIP_CALL, SCIP_LINEARCONSTYPE_LINEAR, SCIP_LINEARCONSTYPE_SETPPC, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetName(), SCIPconsIsActive(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsXor(), SCIPdebugMessage, SCIPdebugPrintCons, SCIPdelCons(), SCIPduplicateBufferArray, SCIPfreeBufferArray, SCIPgetBinvarRepresentatives(), SCIPgetProbvarLinearSum(), SCIPisEQ(), SCIPisZero(), SCIPreleaseCons(), SCIPsnprintf(), SCIPsortPtr(), SCIPvarGetIndex(), SCIPvarGetLbGlobal(), SCIPvarGetNegationVar(), SCIPvarGetUbGlobal(), SCIPvarIsActive(), SCIPvarIsNegated(), TRUE, and ConsAndData::vars.

Referenced by tryUpgrading().

static SCIP_RETCODE tryUpgradingLogicor ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_CONSHDLRDATA *const  conshdlrdata,
int *const  ndelconss,
int *const  naddconss,
int *const  nfixedvars,
int *const  nchgcoefs,
int *const  nchgsides,
SCIP_Bool *const  cutoff 
)
static

try upgrading pseudoboolean logicor constraint to a linear constraint and/or remove possible and-constraints

Parameters
scipSCIP data structure
conspseudoboolean constraint
conshdlrdatapseudoboolean constraint handler data
ndelconsspointer to store number of deleted constraints
naddconsspointer to count number of added constraints
nfixedvarspointer to store number of fixed variables
nchgcoefspointer to store number of changed coefficients constraints
nchgsidespointer to store number of changed sides constraints
cutoffpointer to store if a cutoff happened

Definition at line 5613 of file cons_pseudoboolean.c.

References getLinearConsNVars(), getLinearConsVarsData(), getLinVarsAndAndRess(), ConsAndData::istransformed, ConsAndData::newvars, ConsAndData::nnewvars, NULL, ConsAndData::nvars, SCIP_Bool, SCIP_CALL, SCIP_LINEARCONSTYPE_LOGICOR, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddCoefLinear(), SCIPaddCons(), SCIPallocBufferArray, SCIPchgLhsLinear(), SCIPconsGetData(), SCIPconsGetName(), SCIPconsIsActive(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsLinear(), SCIPdebugMessage, SCIPdebugPrintCons, SCIPdelCons(), SCIPduplicateBufferArray, SCIPfixVar(), SCIPfreeBufferArray, SCIPinfinity(), SCIPisEQ(), SCIPreleaseCons(), SCIPsnprintf(), SCIPvarGetIndex(), TRUE, and ConsAndData::vars.

Referenced by tryUpgrading().

static SCIP_RETCODE tryUpgradingSetppc ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_CONSHDLRDATA *const  conshdlrdata,
int *const  ndelconss,
int *const  naddconss,
int *const  nfixedvars,
int *const  nchgcoefs,
int *const  nchgsides,
SCIP_Bool *const  cutoff 
)
static

try upgrading pseudoboolean setppc constraint to a linear constraint and/or remove possible and-constraints

Parameters
scipSCIP data structure
conspseudoboolean constraint
conshdlrdatapseudoboolean constraint handler data
ndelconsspointer to store number of deleted constraints
naddconsspointer to count number of added constraints
nfixedvarspointer to store number of fixed variables
nchgcoefspointer to store number of changed coefficients constraints
nchgsidespointer to store number of changed sides constraints
cutoffpointer to store if a cutoff happened

Definition at line 6129 of file cons_pseudoboolean.c.

References ConsAndData::cons, ConsAndData::newvars, ConsAndData::nnewvars, NULL, ConsAndData::nvars, SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_SETPPC, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_SETPPCTYPE_COVERING, SCIP_SETPPCTYPE_PACKING, SCIP_SETPPCTYPE_PARTITIONING, SCIPaddCoefLinear(), SCIPaddCons(), SCIPchgRhsLinear(), SCIPconsGetData(), SCIPconsGetName(), SCIPconsIsActive(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsLinear(), SCIPdebugMessage, SCIPdebugPrintCons, SCIPdelCons(), SCIPduplicateBufferArray, SCIPerrorMessage, SCIPfixVar(), SCIPfreeBufferArray, SCIPgetResultantAnd(), SCIPgetTypeSetppc(), SCIPinfinity(), SCIPisLE(), SCIPreleaseCons(), SCIPsnprintf(), SCIPvarGetIndex(), TRUE, and ConsAndData::vars.

Referenced by tryUpgrading().

static SCIP_RETCODE tryUpgrading ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_CONSHDLRDATA *const  conshdlrdata,
int *const  ndelconss,
int *const  naddconss,
int *const  nfixedvars,
int *const  nchgcoefs,
int *const  nchgsides,
SCIP_Bool *const  cutoff 
)
static

try upgrading pseudoboolean constraint to a linear constraint and/or remove possible and-constraints

Parameters
scipSCIP data structure
conspseudoboolean constraint
conshdlrdatapseudoboolean constraint handler data
ndelconsspointer to store number of upgraded constraints
naddconsspointer to count number of added constraints
nfixedvarspointer to store number of fixed variables
nchgcoefspointer to store number of changed coefficients constraints
nchgsidespointer to store number of changed sides constraints
cutoffpointer to store if a cutoff happened

Definition at line 6605 of file cons_pseudoboolean.c.

References getLinearConsNVars(), NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_LINEARCONSTYPE_KNAPSACK, SCIP_LINEARCONSTYPE_LINEAR, SCIP_LINEARCONSTYPE_LOGICOR, SCIP_LINEARCONSTYPE_SETPPC, SCIP_OKAY, SCIPconsAddUpgradeLocks(), SCIPconsGetData(), SCIPconsGetNUpgradeLocks(), SCIPconsIsActive(), SCIPconsIsDeleted(), SCIPdelCons(), SCIPerrorMessage, TRUE, tryUpgradingLogicor(), tryUpgradingSetppc(), tryUpgradingXor(), and updateConsanddataUses().

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE findAggregation ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_CONSHDLRDATA *const  conshdlrdata,
int *const  ndelconss,
int *const  naggrvars,
SCIP_Bool *const  cutoff 
)
static
static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopyPseudoboolean  )
static

copy method for constraint handler plugins (called when SCIP copies plugins)

Definition at line 7268 of file cons_pseudoboolean.c.

References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetName(), SCIPincludeConshdlrPseudoboolean(), and TRUE.

static SCIP_DECL_CONSFREE ( consFreePseudoboolean  )
static

destructor of constraint handler to free constraint handler data (called when SCIP is exiting)

Definition at line 7284 of file cons_pseudoboolean.c.

References CONSHDLR_NAME, conshdlrdataFree(), NULL, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrGetName(), and SCIPconshdlrSetData().

static SCIP_DECL_CONSINIT ( consInitPseudoboolean  )
static

initialization method of constraint handler (called after problem was transformed)

Definition at line 7306 of file cons_pseudoboolean.c.

References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPconsIsTransformed(), SCIPgetResultantAnd(), SCIPhashmapExists(), SCIPhashmapInsert(), SCIPvarGetIndex(), and SCIPvarIsTransformed().

static SCIP_DECL_CONSDELETE ( consDeletePseudoboolean  )
static
static SCIP_DECL_CONSENFOLP ( consEnfolpPseudoboolean  )
static

constraint enforcing method of constraint handler for LP solutions

Definition at line 7742 of file cons_pseudoboolean.c.

References checkAndConss(), CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, and SCIPconshdlrGetName().

static SCIP_DECL_CONSENFOPS ( consEnfopsPseudoboolean  )
static

constraint enforcing method of constraint handler for pseudo solutions

Definition at line 7767 of file cons_pseudoboolean.c.

References checkAndConss(), CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, and SCIPconshdlrGetName().

static SCIP_DECL_CONSCHECK ( consCheckPseudoboolean  )
static

feasibility check method of constraint handler for integral solutions

Definition at line 7792 of file cons_pseudoboolean.c.

References checkAndConss(), checkOrigPbCons(), CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconsGetData(), SCIPconshdlrGetName(), SCIPconsIsOriginal(), SCIPgetSolVal(), and SCIPisEQ().

static SCIP_DECL_CONSPRINT ( consPrintPseudoboolean  )
static

constraint display method of constraint handler

Definition at line 8178 of file cons_pseudoboolean.c.

References consdataPrint(), CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, and SCIPconshdlrGetName().

static SCIP_DECL_CONSCOPY ( consCopyPseudoboolean  )
static

constraint copying method of constraint handler

Definition at line 8192 of file cons_pseudoboolean.c.

References copyConsPseudoboolean(), FALSE, NULL, SCIP_CALL, SCIP_OKAY, and SCIPconsGetName().

static SCIP_DECL_CONSGETNVARS ( consGetNVarsPseudoboolean  )
static
SCIP_RETCODE SCIPcreateConsPseudobooleanWithConss ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_CONS lincons,
SCIP_LINEARCONSTYPE  linconstype,
SCIP_CONS **  andconss,
SCIP_Real andcoefs,
int  nandconss,
SCIP_VAR indvar,
SCIP_Real  weight,
SCIP_Bool  issoftcons,
SCIP_VAR intvar,
SCIP_Real  lhs,
SCIP_Real  rhs,
SCIP_Bool  initial,
SCIP_Bool  separate,
SCIP_Bool  enforce,
SCIP_Bool  check,
SCIP_Bool  propagate,
SCIP_Bool  local,
SCIP_Bool  modifiable,
SCIP_Bool  dynamic,
SCIP_Bool  removable,
SCIP_Bool  stickingatnode 
)

creates and captures a pseudoboolean constraint, with given linear and and-constraints

Parameters
scipSCIP data structure
conspointer to hold the created constraint
namename of constraint
linconsassociated linear constraint
linconstypelinear constraint type of associated linear constraint
andconssassociated and-constraints
andcoefsassociated coefficients of and-constraints
nandconssnumber of associated and-constraints
indvarindicator variable if it's a soft constraint, or NULL
weightweight of the soft constraint, if it is one
issoftconsis this a soft constraint
intvara 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 funktion
lhsleft hand side of constraint
rhsright hand side of constraint
initialshould the LP relaxation of constraint be in the initial LP? Usually set to TRUE. Set to FALSE for 'lazy constraints'.
separateshould the constraint be separated during LP processing? Usually set to TRUE.
enforceshould the constraint be enforced during node processing? TRUE for model constraints, FALSE for additional, redundant constraints.
checkshould the constraint be checked for feasibility? TRUE for model constraints, FALSE for additional, redundant constraints.
propagateshould the constraint be propagated during node processing? Usually set to TRUE.
localis constraint only valid locally? Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints.
modifiableis constraint modifiable (subject to column generation)? Usually set to FALSE. In column generation applications, set to TRUE if pricing adds coefficients to this constraint.
dynamicis constraint subject to aging? Usually set to FALSE. Set to TRUE for own cuts which are seperated as constraints.
removableshould the relaxation be removed from the LP due to aging or cleanup? Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'.
stickingatnodeshould the constraint always be kept at the node where it was added, even if it may be moved to a more global node? Usually set to FALSE. Set to TRUE to for constraints that represent node data.

Definition at line 8562 of file cons_pseudoboolean.c.

References BMScopyMemoryArray, ConsAndData::cons, consdataCreate(), CONSHDLR_NAME, FALSE, inithashmapandtable(), ConsAndData::isoriginal, ConsAndData::istransformed, ConsAndData::newvars, ConsAndData::nnewvars, ConsAndData::noriguses, NULL, ConsAndData::nuses, ConsAndData::nvars, ConsAndData::origcons, SCIP_Bool, SCIP_CALL, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPallocBlockMemory, SCIPcalcMemGrowSize(), SCIPcaptureCons(), SCIPcaptureVar(), SCIPconsAddUpgradeLocks(), SCIPconshdlrGetData(), SCIPconsIsTransformed(), SCIPcreateCons(), SCIPduplicateBlockMemoryArray, SCIPensureBlockMemoryArray, SCIPerrorMessage, SCIPfindConshdlr(), SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, SCIPgetNVarsAnd(), SCIPgetResultantAnd(), SCIPgetVarsAnd(), SCIPhashmapExists(), SCIPhashmapInsert(), SCIPhashtableInsert(), SCIPhashtableRetrieve(), SCIPinfinity(), SCIPisInfinity(), SCIPsortPtr(), SCIPwarningMessage(), ConsAndData::snewvars, ConsAndData::svars, TRUE, and ConsAndData::vars.

Referenced by copyConsPseudoboolean().

SCIP_RETCODE SCIPcreateConsPseudoboolean ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_VAR **  linvars,
int  nlinvars,
SCIP_Real linvals,
SCIP_VAR ***  terms,
int  nterms,
int *  ntermvars,
SCIP_Real termvals,
SCIP_VAR indvar,
SCIP_Real  weight,
SCIP_Bool  issoftcons,
SCIP_VAR intvar,
SCIP_Real  lhs,
SCIP_Real  rhs,
SCIP_Bool  initial,
SCIP_Bool  separate,
SCIP_Bool  enforce,
SCIP_Bool  check,
SCIP_Bool  propagate,
SCIP_Bool  local,
SCIP_Bool  modifiable,
SCIP_Bool  dynamic,
SCIP_Bool  removable,
SCIP_Bool  stickingatnode 
)

creates and captures a pseudoboolean constraint

Note
linear and nonlinear terms can be added using SCIPaddCoefPseudoboolean() and SCIPaddTermPseudoboolean(), respectively
the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
Parameters
scipSCIP data structure
conspointer to hold the created constraint
namename of constraint
linvarsvariables of the linear part, or NULL
nlinvarsnumber of variables of the linear part
linvalscoefficients of linear part, or NULL
termsnonlinear terms of variables, or NULL
ntermsnumber of terms of variables of nonlinear term
ntermvarsnumber of variables in nonlinear terms, or NULL
termvalscoefficients of nonlinear parts, or NULL
indvarindicator variable if it's a soft constraint, or NULL
weightweight of the soft constraint, if it is one
issoftconsis this a soft constraint
intvara 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
lhsleft hand side of constraint
rhsright hand side of constraint
initialshould the LP relaxation of constraint be in the initial LP? Usually set to TRUE. Set to FALSE for 'lazy constraints'.
separateshould the constraint be separated during LP processing? Usually set to TRUE.
enforceshould the constraint be enforced during node processing? TRUE for model constraints, FALSE for additional, redundant constraints.
checkshould the constraint be checked for feasibility? TRUE for model constraints, FALSE for additional, redundant constraints.
propagateshould the constraint be propagated during node processing? Usually set to TRUE.
localis constraint only valid locally? Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints.
modifiableis constraint modifiable (subject to column generation)? Usually set to FALSE. In column generation applications, set to TRUE if pricing adds coefficients to this constraint.
dynamicis constraint subject to aging? Usually set to FALSE. Set to TRUE for own cuts which are separated as constraints.
removableshould the relaxation be removed from the LP due to aging or cleanup? Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'.
stickingatnodeshould the constraint always be kept at the node where it was added, even if it may be moved to a more global node? Usually set to FALSE. Set to TRUE to for constraints that represent node data.

Definition at line 8827 of file cons_pseudoboolean.c.

References consdataCreate(), CONSHDLR_NAME, createAndAddAnds(), createAndAddLinearCons(), FALSE, inithashmapandtable(), NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIP_Real, SCIPallocBufferArray, SCIPconshdlrGetData(), SCIPcreateCons(), SCIPerrorMessage, SCIPfindConshdlr(), SCIPfreeBufferArray, SCIPgetResultantAnd(), SCIPinfinity(), and SCIPisInfinity().

Referenced by readConstraints(), SCIPcreateConsBasicPseudoboolean(), and setObjective().

SCIP_RETCODE SCIPcreateConsBasicPseudoboolean ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_VAR **  linvars,
int  nlinvars,
SCIP_Real linvals,
SCIP_VAR ***  terms,
int  nterms,
int *  ntermvars,
SCIP_Real termvals,
SCIP_VAR indvar,
SCIP_Real  weight,
SCIP_Bool  issoftcons,
SCIP_VAR intvar,
SCIP_Real  lhs,
SCIP_Real  rhs 
)

creates and captures a pseudoboolean constraint 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()
Parameters
scipSCIP data structure
conspointer to hold the created constraint
namename of constraint
linvarsvariables of the linear part, or NULL
nlinvarsnumber of variables of the linear part
linvalscoefficients of linear part, or NULL
termsnonlinear terms of variables, or NULL
ntermsnumber of terms of variables of nonlinear term
ntermvarsnumber of variables in nonlinear terms, or NULL
termvalscoefficients of nonlinear parts, or NULL
indvarindicator variable if it's a soft constraint, or NULL
weightweight of the soft constraint, if it is one
issoftconsis this a soft constraint
intvara 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
lhsleft hand side of constraint
rhsright hand side of constraint

Definition at line 8971 of file cons_pseudoboolean.c.

References FALSE, SCIP_CALL, SCIP_OKAY, SCIPcreateConsPseudoboolean(), and TRUE.

SCIP_RETCODE SCIPaddCoefPseudoboolean ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_VAR *const  var,
SCIP_Real const  val 
)

adds a variable to the pseudo boolean constraint (if it is not zero)

Note
you can only add a coefficient if the special type of linear constraint won't changed
Parameters
scipSCIP data structure
consconstraint data
varvariable of constraint entry
valcoefficient of constraint entry

Definition at line 9006 of file cons_pseudoboolean.c.

References CONSHDLR_NAME, FALSE, NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_LINEARCONSTYPE_KNAPSACK, SCIP_LINEARCONSTYPE_LINEAR, SCIP_LINEARCONSTYPE_LOGICOR, SCIP_LINEARCONSTYPE_SETPPC, SCIP_Longint, SCIP_OKAY, SCIPABORT, SCIPaddCoefKnapsack(), SCIPaddCoefLinear(), SCIPaddCoefLogicor(), SCIPaddCoefSetppc(), SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPerrorMessage, SCIPisEQ(), SCIPisIntegral(), SCIPisPositive(), and SCIPisZero().

SCIP_RETCODE SCIPaddTermPseudoboolean ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_VAR **const  vars,
int const  nvars,
SCIP_Real const  val 
)

adds nonlinear term to pseudo boolean constraint (if it is not zero)

Note
you can only add a coefficient if the special type of linear constraint won't changed
Parameters
scipSCIP data structure
conspseudoboolean constraint
varsvariables of the nonlinear term
nvarsnumber of variables of the nonlinear term
valcoefficient of constraint entry

Definition at line 9083 of file cons_pseudoboolean.c.

References addCoefTerm(), CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPABORT, SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

SCIP_VAR* SCIPgetIndVarPseudoboolean ( SCIP *const  scip,
SCIP_CONS *const  cons 
)

gets indicator variable of pseudoboolean constraint, or NULL if there is no

Parameters
scipSCIP data structure
consconstraint data

Definition at line 9108 of file cons_pseudoboolean.c.

References CONSHDLR_NAME, NULL, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

Referenced by writeOpbConstraints().

SCIP_CONS* SCIPgetLinearConsPseudoboolean ( SCIP *const  scip,
SCIP_CONS *const  cons 
)

gets linear constraint of pseudoboolean constraint

Parameters
scipSCIP data structure
consconstraint data

Definition at line 9132 of file cons_pseudoboolean.c.

References CONSHDLR_NAME, NULL, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

Referenced by writeOpbConstraints().

SCIP_LINEARCONSTYPE SCIPgetLinearConsTypePseudoboolean ( SCIP *const  scip,
SCIP_CONS *const  cons 
)

gets type of linear constraint of pseudoboolean constraint

Parameters
scipSCIP data structure
consconstraint data

Definition at line 9156 of file cons_pseudoboolean.c.

References CONSHDLR_NAME, NULL, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

int SCIPgetNLinVarsWithoutAndPseudoboolean ( SCIP *const  scip,
SCIP_CONS *const  cons 
)

gets number of linear variables without artificial terms variables of pseudoboolean constraint

Parameters
scipSCIP data structure
conspseudoboolean constraint

Definition at line 9180 of file cons_pseudoboolean.c.

References CONSHDLR_NAME, NULL, SCIP_OKAY, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

Referenced by writeOpbConstraints().

SCIP_RETCODE SCIPgetLinDatasWithoutAndPseudoboolean ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_VAR **const  linvars,
SCIP_Real *const  lincoefs,
int *const  nlinvars 
)

gets linear constraint of pseudoboolean constraint

Parameters
scipSCIP data structure
conspseudoboolean constraint
linvarsarray to store and-constraints
lincoefsarray to store and-coefficients
nlinvarspointer to store the required array size for and-constraints, have to be initialized with size of given array

Definition at line 9213 of file cons_pseudoboolean.c.

References CONSHDLR_NAME, getLinearConsNVars(), getLinearConsVarsData(), getLinVarsAndAndRess(), NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPABORT, SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPerrorMessage, and SCIPfreeBufferArray.

Referenced by writeOpbConstraints().

SCIP_RETCODE SCIPgetAndDatasPseudoboolean ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_CONS **const  andconss,
SCIP_Real *const  andcoefs,
int *const  nandconss 
)

gets and-constraints of pseudoboolean constraint

Parameters
scipSCIP data structure
conspseudoboolean constraint
andconssarray to store and-constraints
andcoefsarray to store and-coefficients
nandconsspointer to store the required array size for and-constraints, have to be initialized with size of given array

Definition at line 9275 of file cons_pseudoboolean.c.

References CONSHDLR_NAME, NULL, SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPconsIsOriginal(), SCIPerrorMessage, and TRUE.

Referenced by writeOpbConstraints().

int SCIPgetNAndsPseudoboolean ( SCIP *const  scip,
SCIP_CONS *const  cons 
)

gets number of and constraints of pseudoboolean constraint

Parameters
scipSCIP data structure
consconstraint data

Definition at line 9337 of file cons_pseudoboolean.c.

References CONSHDLR_NAME, NULL, SCIP_OKAY, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

Referenced by writeOpbConstraints().

SCIP_RETCODE SCIPchgLhsPseudoboolean ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_Real const  lhs 
)

changes left hand side of pseudoboolean constraint

Note
you can only change the left hand side if the special type of linear constraint won't changed
Parameters
scipSCIP data structure
consconstraint data
lhsnew left hand side

Definition at line 9376 of file cons_pseudoboolean.c.

References chgLhs(), CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_LINEARCONSTYPE_KNAPSACK, SCIP_LINEARCONSTYPE_LINEAR, SCIP_LINEARCONSTYPE_LOGICOR, SCIP_LINEARCONSTYPE_SETPPC, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

SCIP_RETCODE SCIPchgRhsPseudoboolean ( SCIP *const  scip,
SCIP_CONS *const  cons,
SCIP_Real const  rhs 
)

changes right hand side of pseudoboolean constraint

Note
you can only change the right hand side if the special type of linear constraint won't changed
Parameters
scipSCIP data structure
consconstraint data
rhsnew right hand side

Definition at line 9429 of file cons_pseudoboolean.c.

References chgRhs(), CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_LINEARCONSTYPE_KNAPSACK, SCIP_LINEARCONSTYPE_LINEAR, SCIP_LINEARCONSTYPE_LOGICOR, SCIP_LINEARCONSTYPE_SETPPC, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

SCIP_Real SCIPgetLhsPseudoboolean ( SCIP *const  scip,
SCIP_CONS *const  cons 
)

get left hand side of pseudoboolean constraint

Parameters
scipSCIP data structure
conspseudoboolean constraint

Definition at line 9473 of file cons_pseudoboolean.c.

References CONSHDLR_NAME, NULL, SCIP_INVALID, SCIP_OKAY, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

Referenced by writeOpbConstraints().

SCIP_Real SCIPgetRhsPseudoboolean ( SCIP *const  scip,
SCIP_CONS *const  cons 
)

get right hand side of pseudoboolean constraint

Parameters
scipSCIP data structure
conspseudoboolean constraint

Definition at line 9503 of file cons_pseudoboolean.c.

References CONSHDLR_NAME, NULL, SCIP_INVALID, SCIP_OKAY, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

Referenced by writeOpbConstraints().