Scippy

SCIP

Solving Constraint Integer Programs

cons_logicor.h File Reference

Detailed Description

Constraint handler for logicor constraints $1^T x \ge 1$ (equivalent to set covering, but algorithms are suited for depth first search).

Author
Tobias Achterberg
Michael Winkler

This constraint handler handles a special type of linear constraints, namely logic or constraints. These are equivalent to set covering constraints, but are handled by special algorithms which are better suited for depth first search. For a set of binary variables $x_i, i=1,\dots,n$, a logic or constraint has the form

\[ \sum_{i=1}^n x_i \ge 1. \]

Definition in file cons_logicor.h.

#include "scip/scip.h"

Go to the source code of this file.

Functions

SCIP_RETCODE SCIPincludeConshdlrLogicor (SCIP *scip)
 
SCIP_RETCODE SCIPcreateConsLogicor (SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, 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 SCIPcreateConsBasicLogicor (SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars)
 
SCIP_RETCODE SCIPaddCoefLogicor (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
 
int SCIPgetNVarsLogicor (SCIP *scip, SCIP_CONS *cons)
 
SCIP_VAR ** SCIPgetVarsLogicor (SCIP *scip, SCIP_CONS *cons)
 
SCIP_Real SCIPgetDualsolLogicor (SCIP *scip, SCIP_CONS *cons)
 
SCIP_Real SCIPgetDualfarkasLogicor (SCIP *scip, SCIP_CONS *cons)
 
SCIP_ROWSCIPgetRowLogicor (SCIP *scip, SCIP_CONS *cons)
 

Function Documentation

SCIP_RETCODE SCIPcreateConsLogicor ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
int  nvars,
SCIP_VAR **  vars,
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 logic or 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
nvarsnumber of variables in the constraint
varsarray with variables of constraint entries
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 5111 of file cons_logicor.c.

References consdataCreate(), CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_EVENTTYPE_VARFIXED, SCIP_INVALIDCALL, SCIP_OKAY, SCIP_STAGE_PRESOLVING, SCIPcatchVarEvent(), SCIPconshdlrGetData(), SCIPcreateCons(), SCIPcreateConsBasicLogicor(), SCIPerrorMessage, SCIPfindConshdlr(), SCIPgetStage(), and SCIPisTransformed().

Referenced by addLocalConss(), addSplitcons(), consdataLinearize(), createAndAddLinearCons(), createConflict(), createNormalizedLogicor(), extendToCover(), readCnf(), SCIP_DECL_CONFLICTEXEC(), SCIPcreateConsBasicLogicor(), SCIPincludeConshdlrLogicor(), SCIPreoptApplyGlbConss(), and upgradeCons().

SCIP_RETCODE SCIPcreateConsBasicLogicor ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
int  nvars,
SCIP_VAR **  vars 
)

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

See also
SCIPcreateConsLogicor() 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
nvarsnumber of variables in the constraint
varsarray with variables of constraint entries

Definition at line 5188 of file cons_logicor.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPaddCoefLogicor(), SCIPcreateConsLogicor(), and TRUE.

Referenced by SCIPcreateConsLogicor().

SCIP_RETCODE SCIPaddCoefLogicor ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var 
)

adds coefficient in logic or constraint

Parameters
scipSCIP data structure
conslogicor constraint
varvariable to add to the constraint

Definition at line 5205 of file cons_logicor.c.

References addCoef(), CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPerrorMessage, and SCIPgetNVarsLogicor().

Referenced by addCoefTerm(), SCIPaddCoefPseudoboolean(), and SCIPcreateConsBasicLogicor().

SCIP_Real SCIPgetDualsolLogicor ( SCIP scip,
SCIP_CONS cons 
)

gets the dual solution of the logic or constraint in the current LP

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5270 of file cons_logicor.c.

References CONSHDLR_NAME, NULL, SCIP_INVALID, SCIP_Real, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPerrorMessage, SCIPgetDualfarkasLogicor(), and SCIProwGetDualsol().

Referenced by SCIPgetVarsLogicor().

SCIP_Real SCIPgetDualfarkasLogicor ( SCIP scip,
SCIP_CONS cons 
)

gets the dual Farkas value of the logic or constraint in the current infeasible LP

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5294 of file cons_logicor.c.

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

Referenced by SCIPgetDualsolLogicor().

SCIP_ROW* SCIPgetRowLogicor ( SCIP scip,
SCIP_CONS cons 
)

returns the linear relaxation of the given logic or constraint; may return NULL if no LP row was yet created; the user must not modify the row!

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5320 of file cons_logicor.c.

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

Referenced by SCIPgetDualfarkasLogicor().