Scippy

SCIP

Solving Constraint Integer Programs

cons_disjunction.c File Reference

Detailed Description

constraint handler for disjunction constraints

Author
Stefan Heinz
Michael Winkler

Definition in file cons_disjunction.c.

#include <assert.h>
#include <string.h>
#include <limits.h>
#include "scip/cons_disjunction.h"

Go to the source code of this file.

Macros

#define CONSHDLR_NAME   "disjunction"
 
#define CONSHDLR_DESC   "disjunction of constraints (or(cons1, cons2, ..., consn))"
 
#define CONSHDLR_ENFOPRIORITY   -950000
 
#define CONSHDLR_CHECKPRIORITY   -900000
 
#define CONSHDLR_PROPFREQ   -1
 
#define CONSHDLR_EAGERFREQ   100
 
#define CONSHDLR_MAXPREROUNDS   -1
 
#define CONSHDLR_DELAYPROP   FALSE
 
#define CONSHDLR_DELAYPRESOL   FALSE
 
#define CONSHDLR_NEEDSCONS   TRUE
 
#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP
 
#define DEFAULT_ALWAYSBRANCH   TRUE
 

Functions

static SCIP_RETCODE consdataCreate (SCIP *scip, SCIP_CONSDATA **consdata, SCIP_CONS **conss, int nconss, SCIP_CONS *relaxcons)
 
static SCIP_RETCODE consdataFree (SCIP *scip, SCIP_CONSDATA **consdata)
 
static SCIP_RETCODE consdataAddCons (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_CONS *cons)
 
static SCIP_RETCODE branchCons (SCIP *scip, SCIP_CONS *cons, SCIP_RESULT *result)
 
static SCIP_RETCODE checkCons (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_RESULT *result)
 
static SCIP_RETCODE propagateCons (SCIP *scip, SCIP_CONS *cons, int *ndelconss)
 
static SCIP_DECL_CONSHDLRCOPY (conshdlrCopyDisjunction)
 
static SCIP_DECL_CONSFREE (consFreeDisjunction)
 
static SCIP_DECL_CONSDELETE (consDeleteDisjunction)
 
static SCIP_DECL_CONSTRANS (consTransDisjunction)
 
static SCIP_DECL_CONSINITLP (consInitlpDisjunction)
 
static SCIP_DECL_CONSENFOLP (consEnfolpDisjunction)
 
static SCIP_DECL_CONSENFOPS (consEnfopsDisjunction)
 
static SCIP_DECL_CONSCHECK (consCheckDisjunction)
 
static SCIP_DECL_CONSPROP (consPropDisjunction)
 
static SCIP_DECL_CONSPRESOL (consPresolDisjunction)
 
static SCIP_DECL_CONSLOCK (consLockDisjunction)
 
static SCIP_DECL_CONSPRINT (consPrintDisjunction)
 
static SCIP_DECL_CONSPARSE (consParseDisjunction)
 
static SCIP_DECL_CONSCOPY (consCopyDisjunction)
 
SCIP_RETCODE SCIPincludeConshdlrDisjunction (SCIP *scip)
 
SCIP_RETCODE SCIPcreateConsDisjunction (SCIP *scip, SCIP_CONS **cons, const char *name, int nconss, SCIP_CONS **conss, SCIP_CONS *relaxcons, SCIP_Bool initial, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic)
 
SCIP_RETCODE SCIPcreateConsBasicDisjunction (SCIP *scip, SCIP_CONS **cons, const char *name, int nconss, SCIP_CONS **conss, SCIP_CONS *relaxcons)
 
SCIP_RETCODE SCIPaddConsElemDisjunction (SCIP *scip, SCIP_CONS *cons, SCIP_CONS *addcons)
 

Macro Definition Documentation

#define CONSHDLR_DESC   "disjunction of constraints (or(cons1, cons2, ..., consn))"

Definition at line 33 of file cons_disjunction.c.

Referenced by SCIPincludeConshdlrDisjunction().

#define CONSHDLR_ENFOPRIORITY   -950000

priority of the constraint handler for constraint enforcing

Definition at line 34 of file cons_disjunction.c.

Referenced by SCIPincludeConshdlrDisjunction().

#define CONSHDLR_CHECKPRIORITY   -900000

priority of the constraint handler for checking feasibility

Definition at line 35 of file cons_disjunction.c.

Referenced by SCIPincludeConshdlrDisjunction().

#define CONSHDLR_PROPFREQ   -1

frequency for propagating domains; zero means only preprocessing propagation

Definition at line 36 of file cons_disjunction.c.

Referenced by SCIPincludeConshdlrDisjunction().

#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 37 of file cons_disjunction.c.

Referenced by SCIPincludeConshdlrDisjunction().

#define CONSHDLR_MAXPREROUNDS   -1

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

Definition at line 39 of file cons_disjunction.c.

Referenced by SCIPincludeConshdlrDisjunction().

#define CONSHDLR_DELAYPROP   FALSE

should propagation method be delayed, if other propagators found reductions?

Definition at line 41 of file cons_disjunction.c.

Referenced by SCIPincludeConshdlrDisjunction().

#define CONSHDLR_DELAYPRESOL   FALSE

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

Definition at line 42 of file cons_disjunction.c.

Referenced by SCIPincludeConshdlrDisjunction().

#define CONSHDLR_NEEDSCONS   TRUE

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

Definition at line 43 of file cons_disjunction.c.

Referenced by SCIPincludeConshdlrDisjunction().

#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP

Definition at line 45 of file cons_disjunction.c.

Referenced by SCIPincludeConshdlrDisjunction().

#define DEFAULT_ALWAYSBRANCH   TRUE

alawys perform branching if one of the constraints is violated, otherwise only if all integers are fixed

Definition at line 48 of file cons_disjunction.c.

Referenced by SCIPincludeConshdlrDisjunction().

Function Documentation

static SCIP_RETCODE consdataCreate ( SCIP scip,
SCIP_CONSDATA **  consdata,
SCIP_CONS **  conss,
int  nconss,
SCIP_CONS relaxcons 
)
static

creates disjunction constraint data, captures initial constraints of disjunction

Parameters
scipSCIP data structure
consdatapointer to constraint data
conssinitial constraint in disjunction
nconssnumber of initial constraints in disjunction
relaxconsa conjuction constraint containing the liner relaxation of the disjunction constraint, or NULL

Definition at line 77 of file cons_disjunction.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPcaptureCons(), SCIPduplicateBlockMemoryArray, SCIPisTransformed(), SCIPtransformCons(), and SCIPtransformConss().

Referenced by SCIP_DECL_CONSTRANS(), and SCIPcreateConsDisjunction().

static SCIP_RETCODE consdataFree ( SCIP scip,
SCIP_CONSDATA **  consdata 
)
static

frees constraint data and releases all constraints in disjunction

Parameters
scipSCIP data structure
consdatapointer to constraint data

Definition at line 140 of file cons_disjunction.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArrayNull, and SCIPreleaseCons().

Referenced by SCIP_DECL_CONSDELETE().

static SCIP_RETCODE consdataAddCons ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_CONS cons 
)
static

adds constraint to disjunction

Parameters
scipSCIP data structure
consdataconstraint data
consconstraint to add to the disjunction

Definition at line 172 of file cons_disjunction.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPcaptureCons(), SCIPensureBlockMemoryArray, SCIPisTransformed(), and SCIPtransformCons().

Referenced by SCIPaddConsElemDisjunction().

static SCIP_RETCODE branchCons ( SCIP scip,
SCIP_CONS cons,
SCIP_RESULT result 
)
static

branches on disjunctive constraint

Parameters
scipSCIP data structure
consactive disjunction constraint
resultpointer to store the result

Definition at line 206 of file cons_disjunction.c.

References NULL, SCIP_BRANCHED, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddConsNode(), SCIPconsGetData(), SCIPconsGetName(), SCIPconsIsChecked(), SCIPconsIsModifiable(), SCIPcreateChild(), SCIPdebugMessage, SCIPdelConsNode(), SCIPgetLocalTransEstimate(), SCIPresetConsAge(), SCIPsetConsChecked(), and TRUE.

Referenced by enforceIndicators(), enforceSOS1(), enforceSOS2(), SCIP_DECL_CONSENFOLP(), and SCIP_DECL_CONSENFOPS().

static SCIP_RETCODE checkCons ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol,
SCIP_Bool  checkintegrality,
SCIP_Bool  checklprows,
SCIP_Bool  printreason,
SCIP_RESULT result 
)
static

checks disjunction constraints if at least one is feasible

Parameters
scipSCIP data structure
consactive disjunction constraint
solsolution to check
checkintegralityhas integrality to be checked?
checklprowshave current LP rows to be checked?
printreasonshould the reason for the violation be printed?
resultpointer to store the result

Definition at line 267 of file cons_disjunction.c.

References FALSE, NULL, SCIP_CALL, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPcheckCons(), SCIPconsGetData(), SCIPconsGetName(), SCIPdebug, SCIPinfoMessage(), and SCIPprintCons().

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

static SCIP_RETCODE propagateCons ( SCIP scip,
SCIP_CONS cons,
int *  ndelconss 
)
static

propagation method for disjunction constraint

Parameters
scipSCIP data structure
consdisjunctive constraint
ndelconsspointer to count number of deleted constraints

Definition at line 313 of file cons_disjunction.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIP_STAGE_PRESOLVING, SCIPconsGetData(), SCIPconsIsActive(), SCIPconsIsChecked(), SCIPconsIsDeleted(), SCIPdelCons(), SCIPdelConsLocal(), SCIPgetNNodes(), SCIPgetStage(), SCIPsetConsChecked(), and TRUE.

Referenced by SCIP_DECL_CONSPRESOL(), and SCIP_DECL_CONSPROP().

static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopyDisjunction  )
static

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

Definition at line 380 of file cons_disjunction.c.

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

static SCIP_DECL_CONSFREE ( consFreeDisjunction  )
static

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

Definition at line 396 of file cons_disjunction.c.

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

static SCIP_DECL_CONSDELETE ( consDeleteDisjunction  )
static

frees specific constraint data

Definition at line 417 of file cons_disjunction.c.

References consdataFree(), SCIP_CALL, and SCIP_OKAY.

static SCIP_DECL_CONSTRANS ( consTransDisjunction  )
static
static SCIP_DECL_CONSINITLP ( consInitlpDisjunction  )
static

LP initialization method of constraint handler

Definition at line 450 of file cons_disjunction.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPaddConsLocal(), SCIPconsGetData(), and SCIPconsIsActive().

static SCIP_DECL_CONSENFOLP ( consEnfolpDisjunction  )
static

constraint enforcing method of constraint handler for LP solutions

Definition at line 473 of file cons_disjunction.c.

References branch(), branchCons(), checkCons(), FALSE, NULL, SCIP_Bool, SCIP_BRANCHED, SCIP_CALL, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconshdlrGetData(), and SCIPgetNPseudoBranchCands().

static SCIP_DECL_CONSENFOPS ( consEnfopsDisjunction  )
static

constraint enforcing method of constraint handler for pseudo solutions

Definition at line 503 of file cons_disjunction.c.

References branch(), branchCons(), checkCons(), FALSE, NULL, SCIP_Bool, SCIP_BRANCHED, SCIP_CALL, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconshdlrGetData(), and SCIPgetNPseudoBranchCands().

static SCIP_DECL_CONSCHECK ( consCheckDisjunction  )
static

feasibility check method of constraint handler for integral solutions

Definition at line 533 of file cons_disjunction.c.

References checkCons(), SCIP_CALL, SCIP_FEASIBLE, SCIP_INFEASIBLE, and SCIP_OKAY.

static SCIP_DECL_CONSPROP ( consPropDisjunction  )
static

domain propagation method of constraint handler

Definition at line 552 of file cons_disjunction.c.

References propagateCons(), SCIP_CALL, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_REDUCEDDOM, and SCIPinProbing().

static SCIP_DECL_CONSPRESOL ( consPresolDisjunction  )
static
static SCIP_DECL_CONSLOCK ( consLockDisjunction  )
static

variable rounding lock method of constraint handler

Definition at line 635 of file cons_disjunction.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPaddConsLocks(), and SCIPconsGetData().

static SCIP_DECL_CONSPRINT ( consPrintDisjunction  )
static

constraint display method of constraint handler

Definition at line 655 of file cons_disjunction.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPinfoMessage(), and SCIPprintCons().

static SCIP_DECL_CONSPARSE ( consParseDisjunction  )
static
SCIP_RETCODE SCIPcreateConsDisjunction ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
int  nconss,
SCIP_CONS **  conss,
SCIP_CONS relaxcons,
SCIP_Bool  initial,
SCIP_Bool  enforce,
SCIP_Bool  check,
SCIP_Bool  local,
SCIP_Bool  modifiable,
SCIP_Bool  dynamic 
)

creates and captures a disjunction constraint

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
nconssnumber of initial constraints in disjunction
conssinitial constraint in disjunction
relaxconsa conjunction constraint containing the linear relaxation of the disjunction constraint, or NULL
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 separated as constraints.

Definition at line 1017 of file cons_disjunction.c.

References consdataCreate(), CONSHDLR_NAME, FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPcreateCons(), SCIPerrorMessage, and SCIPfindConshdlr().

Referenced by SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSPARSE(), and SCIPcreateConsBasicDisjunction().

SCIP_RETCODE SCIPcreateConsBasicDisjunction ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
int  nconss,
SCIP_CONS **  conss,
SCIP_CONS relaxcons 
)

creates and captures a cumulative constraint in its most basic version, i. e., all constraint flags are set to their basic value as explained for the method SCIPcreateConsDisjunction(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h

See Also
SCIPcreateConsDisjunction() for information about the basic constraint flag configuration
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
nconssnumber of initial constraints in disjunction
conssinitial constraint in disjunction
relaxconsa conjunction constraint containing the linear relaxation of the disjunction constraint, or NULL

Definition at line 1069 of file cons_disjunction.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPcreateConsDisjunction(), and TRUE.

SCIP_RETCODE SCIPaddConsElemDisjunction ( SCIP scip,
SCIP_CONS cons,
SCIP_CONS addcons 
)

adds constraint to the disjunction of constraints

Parameters
scipSCIP data structure
consdisjunction constraint
addconsadditional constraint in disjunction

Definition at line 1088 of file cons_disjunction.c.

References consdataAddCons(), CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.