Scippy

SCIP

Solving Constraint Integer Programs

cons_orbitope.c File Reference

Detailed Description

constraint handler for (partitioning/packing) orbitope constraints w.r.t. the full symmetric group

Author
Timo Berthold
Marc Pfetsch

The type of constraints of this constraint handler is described in cons_orbitope.h.

The details of the method implemented here are described in the following papers.

Packing and Partitioning Orbitopes
Volker Kaibel and Marc E. Pfetsch,
Math. Program. 114, No. 1, 1-36 (2008)

Among other things, this paper describes so-called shifted column inequalities of the following form $x(S) \leq x(B)$, where $S$ is a so-called shifted column and $B$ is a so-called bar. These inequalities can be used to handle symmetry and they are separated in this constraint handler. We use the linear time separation algorithm of the paper.

Orbitopal Fixing
Volker Kaibel, Matthias Peinhardt, and Marc E. Pfetsch,
Discrete Optimization 8, No. 4, 595-610 (2011) (A preliminary version appears in Proc. IPCO 2007.)

In this paper a linear time propagation algorithm is described, a variant of which is implemented here. The implemented variant does not run in linear time, but is very fast in practice.

translation table
herepaper
nspcons p
nblocks q
vars x
vals A^\star
weights \omega
cases \tau
fixtriangle
resolveprop
firstnonzeros\mu
lastones \alpha
frontiersteps\Gamma

Definition in file cons_orbitope.c.

#include <assert.h>
#include <string.h>
#include <ctype.h>
#include "scip/cons_orbitope.h"

Go to the source code of this file.

Macros

#define CONSHDLR_NAME   "orbitope"
 
#define CONSHDLR_DESC   "symmetry breaking constraint handler relying on (partitioning/packing) orbitopes"
 
#define CONSHDLR_SEPAPRIORITY   +40100
 
#define CONSHDLR_ENFOPRIORITY   -1005200
 
#define CONSHDLR_CHECKPRIORITY   -1005200
 
#define CONSHDLR_SEPAFREQ   5
 
#define CONSHDLR_PROPFREQ   -1
 
#define CONSHDLR_EAGERFREQ   -1
 
#define CONSHDLR_MAXPREROUNDS   -1
 
#define CONSHDLR_DELAYSEPA   FALSE
 
#define CONSHDLR_DELAYPROP   FALSE
 
#define CONSHDLR_DELAYPRESOL   FALSE
 
#define CONSHDLR_NEEDSCONS   TRUE
 
#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP
 

Functions

static SCIP_RETCODE consdataFree (SCIP *scip, SCIP_CONSDATA **consdata)
 
static SCIP_RETCODE consdataCreate (SCIP *scip, SCIP_CONSDATA **consdata, SCIP_VAR ***vars, int nspcons, int nblocks, SCIP_Bool ispart, SCIP_Bool resolveprop)
 
static void copyValues (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_SOL *sol)
 
static void computeSCTable (SCIP *scip, int nspcons, int nblocks, SCIP_Real **weights, int **cases, SCIP_Real **vals)
 
static SCIP_RETCODE fixTriangle (SCIP *scip, SCIP_CONS *cons, SCIP_Bool *infeasible, int *nfixedvars)
 
static SCIP_RETCODE separateSCIs (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_CONSDATA *consdata, SCIP_Bool *infeasible, int *nfixedvars, int *ncuts)
 
static SCIP_RETCODE propagateCons (SCIP *scip, SCIP_CONS *cons, SCIP_Bool *infeasible, int *nfixedvars)
 
static SCIP_RETCODE resolvePropagation (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *infervar, int inferinfo, SCIP_BOUNDTYPE boundtype, SCIP_BDCHGIDX *bdchgidx, SCIP_RESULT *result)
 
static SCIP_DECL_CONSHDLRCOPY (conshdlrCopyOrbitope)
 
static SCIP_DECL_CONSDELETE (consDeleteOrbitope)
 
static SCIP_DECL_CONSTRANS (consTransOrbitope)
 
static SCIP_DECL_CONSSEPALP (consSepalpOrbitope)
 
static SCIP_DECL_CONSSEPASOL (consSepasolOrbitope)
 
static SCIP_DECL_CONSENFOLP (consEnfolpOrbitope)
 
static SCIP_DECL_CONSENFOPS (consEnfopsOrbitope)
 
static SCIP_DECL_CONSCHECK (consCheckOrbitope)
 
static SCIP_DECL_CONSPROP (consPropOrbitope)
 
static SCIP_DECL_CONSPRESOL (consPresolOrbitope)
 
static SCIP_DECL_CONSRESPROP (consRespropOrbitope)
 
static SCIP_DECL_CONSLOCK (consLockOrbitope)
 
static SCIP_DECL_CONSPRINT (consPrintOrbitope)
 
static SCIP_DECL_CONSCOPY (consCopyOrbitope)
 
static SCIP_DECL_CONSPARSE (consParseOrbitope)
 
static SCIP_DECL_CONSGETVARS (consGetVarsOrbitope)
 
static SCIP_DECL_CONSGETNVARS (consGetNVarsOrbitope)
 
SCIP_RETCODE SCIPincludeConshdlrOrbitope (SCIP *scip)
 
SCIP_RETCODE SCIPcreateConsOrbitope (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR ***vars, SCIP_Bool ispart, int nspcons, int nblocks, SCIP_Bool resolveprop, 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 SCIPcreateConsBasicOrbitope (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR ***vars, SCIP_Bool ispart, int nspcons, int nblocks, SCIP_Bool resolveprop)
 

Macro Definition Documentation

#define CONSHDLR_DESC   "symmetry breaking constraint handler relying on (partitioning/packing) orbitopes"

Definition at line 70 of file cons_orbitope.c.

Referenced by SCIPincludeConshdlrOrbitope().

#define CONSHDLR_SEPAPRIORITY   +40100

priority of the constraint handler for separation

Definition at line 71 of file cons_orbitope.c.

Referenced by SCIPincludeConshdlrOrbitope().

#define CONSHDLR_ENFOPRIORITY   -1005200

priority of the constraint handler for constraint enforcing

Definition at line 72 of file cons_orbitope.c.

Referenced by SCIPincludeConshdlrOrbitope().

#define CONSHDLR_CHECKPRIORITY   -1005200

priority of the constraint handler for checking feasibility

Definition at line 73 of file cons_orbitope.c.

Referenced by SCIPincludeConshdlrOrbitope().

#define CONSHDLR_SEPAFREQ   5

frequency for separating cuts; zero means to separate only in the root node

Definition at line 74 of file cons_orbitope.c.

Referenced by SCIPincludeConshdlrOrbitope().

#define CONSHDLR_PROPFREQ   -1

frequency for propagating domains; zero means only preprocessing propagation

Definition at line 75 of file cons_orbitope.c.

Referenced by SCIPincludeConshdlrOrbitope().

#define CONSHDLR_EAGERFREQ   -1

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 76 of file cons_orbitope.c.

Referenced by SCIPincludeConshdlrOrbitope().

#define CONSHDLR_MAXPREROUNDS   -1

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

Definition at line 78 of file cons_orbitope.c.

Referenced by SCIPincludeConshdlrOrbitope().

#define CONSHDLR_DELAYSEPA   FALSE

should separation method be delayed, if other separators found cuts?

Definition at line 79 of file cons_orbitope.c.

Referenced by SCIPincludeConshdlrOrbitope().

#define CONSHDLR_DELAYPROP   FALSE

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

Definition at line 80 of file cons_orbitope.c.

Referenced by SCIPincludeConshdlrOrbitope().

#define CONSHDLR_DELAYPRESOL   FALSE

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

Definition at line 81 of file cons_orbitope.c.

Referenced by SCIPincludeConshdlrOrbitope().

#define CONSHDLR_NEEDSCONS   TRUE

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

Definition at line 82 of file cons_orbitope.c.

Referenced by SCIPincludeConshdlrOrbitope().

#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP

Definition at line 84 of file cons_orbitope.c.

Referenced by SCIPincludeConshdlrOrbitope().

Function Documentation

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

frees an orbitope constraint data

Parameters
scipSCIP data structure
consdatapointer to orbitope constraint data

Definition at line 114 of file cons_orbitope.c.

References NULL, SCIP_OKAY, SCIPfreeBlockMemory, and SCIPfreeBlockMemoryArrayNull.

Referenced by SCIP_DECL_CONSDELETE().

static SCIP_RETCODE consdataCreate ( SCIP scip,
SCIP_CONSDATA **  consdata,
SCIP_VAR ***  vars,
int  nspcons,
int  nblocks,
SCIP_Bool  ispart,
SCIP_Bool  resolveprop 
)
static

creates orbitope constraint data

Parameters
scipSCIP data structure
consdatapointer to store constraint data
varsvariables array, must have size nspcons x nblocks
nspconsnumber of set partitioning (packing) constraints <=> p
nblocksnumber of symmetric variable blocks <=> q
ispartdeal with the partitioning case (packing otherwise)
resolvepropshould propagation be resolved?

Definition at line 152 of file cons_orbitope.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, SCIPduplicateBlockMemoryArray, SCIPgetTransformedVars(), and SCIPisTransformed().

Referenced by SCIP_DECL_CONSTRANS(), and SCIPcreateConsOrbitope().

static void copyValues ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_SOL sol 
)
static

copies the variables values from the solution to the constraint data structure

Parameters
scipthe SCIP data structure
consdatathe constraint data
sola primal solution or NULL for the current LP optimum

Definition at line 350 of file cons_orbitope.c.

References NULL, and SCIPgetSolVal().

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

static void computeSCTable ( SCIP scip,
int  nspcons,
int  nblocks,
SCIP_Real **  weights,
int **  cases,
SCIP_Real **  vals 
)
static

compute the dynamic programming table for SC

Build up dynamic programming table in order to find SCs with minimum weight.

The values of the minimal SCIs are stored in weights. The array cases[i][j] stores which of the cases were applied to get weights[i][j]. Here, 3 means that we have reached the upper limit.

We assume that the upper right triangle is fixed to 0. Hence we can perform the computation a bit more efficient.

Parameters
scipSCIP pointer
nspconsnumber of set partitioning (packing) constraints <=> p
nblocksnumber of symmetric variable blocks <=> q
weightsSC weight table
casesindicator of the SC cases
valscurrent solution

Definition at line 386 of file cons_orbitope.c.

References NULL, SCIP_Real, and SCIPisLT().

Referenced by resolvePropagation(), SCIP_DECL_CONSCHECK(), SCIP_DECL_CONSENFOPS(), and separateSCIs().

static SCIP_RETCODE fixTriangle ( SCIP scip,
SCIP_CONS cons,
SCIP_Bool infeasible,
int *  nfixedvars 
)
static

fix upper right triangle if necessary

Parameters
scipSCIP data structure
consconstraint to be processed
infeasiblepointer to store TRUE, if the node can be cut off
nfixedvarspointer to add up the number of found domain reductions

Definition at line 481 of file cons_orbitope.c.

References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMessage, SCIPfixVar(), SCIPvarGetUbGlobal(), and TRUE.

Referenced by propagateCons(), SCIP_DECL_CONSENFOPS(), and separateSCIs().

static SCIP_RETCODE separateSCIs ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
SCIP_CONSDATA consdata,
SCIP_Bool infeasible,
int *  nfixedvars,
int *  ncuts 
)
static

separates shifted column inequalities according to the solution stored in consdata->vals

Parameters
scipthe SCIP data structure
conshdlrconstraint handler
consconstraint
consdatathe constraint data
infeasiblewhether we detected infeasibility
nfixedvarsnumber of variables fixed
ncutspointer to store number of separated SCIs

Definition at line 564 of file cons_orbitope.c.

References computeSCTable(), FALSE, fixTriangle(), NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddCut(), SCIPaddVarsToRow(), SCIPcreateEmptyRowCons(), SCIPinfinity(), SCIPisEfficacious(), SCIPisSumEQ(), SCIPreleaseRow(), SCIPsnprintf(), and TRUE.

Referenced by SCIP_DECL_CONSENFOLP(), SCIP_DECL_CONSSEPALP(), and SCIP_DECL_CONSSEPASOL().

static SCIP_RETCODE propagateCons ( SCIP scip,
SCIP_CONS cons,
SCIP_Bool infeasible,
int *  nfixedvars 
)
static

propagation method for a single orbitope constraint

Parameters
scipSCIP data structure
consconstraint to be processed
infeasiblepointer to store TRUE, if the node can be cut off
nfixedvarspointer to add up the number of found domain reductions

Definition at line 723 of file cons_orbitope.c.

References FALSE, fixTriangle(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_STAGE_SOLVING, SCIPaddConflictBinvar(), SCIPallocBufferArray, SCIPanalyzeConflictCons(), SCIPconsGetData(), SCIPdebugMessage, SCIPfreeBufferArray, SCIPgetStage(), SCIPinferBinvarCons(), SCIPinitConflictAnalysis(), SCIPinProbing(), SCIPisConflictAnalysisApplicable(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), and TRUE.

Referenced by SCIP_DECL_CONSPRESOL(), and SCIP_DECL_CONSPROP().

static SCIP_RETCODE resolvePropagation ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR infervar,
int  inferinfo,
SCIP_BOUNDTYPE  boundtype,
SCIP_BDCHGIDX bdchgidx,
SCIP_RESULT result 
)
static

Propagation conflict resolving method of propagator

In this function we use that the propagation method above implicitly propagates SCIs, i.e., every fixing can also be gotten via an SCI-fixing.

Since the storage of an integer is not enough to store the complete information about the fixing nor a complete shifted column, we have to use the linear time algorithm for SCIs.

The inferinfo integer is set as follows:

  • If a shifted column is fixed to 0 and the corresponding bar does not necessarily has value 1 then we fix these entries to 0 and inferinfo is i * nblocks + j, where (i,j) is the leader of the bar. The SCI depends on whether i is in Gamma or not (see Lemma 1 in the paper and the comments above).
  • If a bar has value 1 and the shifted column has one entry that is not fixed, it can be fixed to 1 and inferinfo is (nspcons*nblocks) + i * nblocks + j, where (i,j) is the leader of the bar; see Proposition 1 (2c).
Parameters
scipSCIP data structure
consconstraint that inferred the bound change
infervarvariable that was deduced
inferinfoinference information
boundtypethe type of the changed bound (lower or upper bound)
bdchgidxbound change index (time stamp of bound change), or NULL for current time
resultpointer to store the result of the propagation conflict resolving call

Definition at line 1092 of file cons_orbitope.c.

References computeSCTable(), FALSE, MIN, NULL, SCIP_Bool, SCIP_CALL, SCIP_DIDNOTFIND, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_SUCCESS, SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPconsGetData(), SCIPdebugMessage, SCIPsnprintf(), SCIPvarGetLbAtIndex(), and SCIPvarGetUbAtIndex().

Referenced by SCIP_DECL_CONSRESPROP().

static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopyOrbitope  )
static

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

Definition at line 1373 of file cons_orbitope.c.

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

static SCIP_DECL_CONSDELETE ( consDeleteOrbitope  )
static

frees specific constraint data

Definition at line 1389 of file cons_orbitope.c.

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

static SCIP_DECL_CONSSEPALP ( consSepalpOrbitope  )
static
static SCIP_DECL_CONSSEPASOL ( consSepasolOrbitope  )
static

separation method of constraint handler for arbitrary primal solutions

Definition at line 1495 of file cons_orbitope.c.

References CONSHDLR_NAME, copyValues(), FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_REDUCEDDOM, SCIP_SEPARATED, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPdebugMessage, and separateSCIs().

static SCIP_DECL_CONSENFOLP ( consEnfolpOrbitope  )
static
static SCIP_DECL_CONSENFOPS ( consEnfopsOrbitope  )
static
static SCIP_DECL_CONSCHECK ( consCheckOrbitope  )
static
static SCIP_DECL_CONSPROP ( consPropOrbitope  )
static
static SCIP_DECL_CONSPRESOL ( consPresolOrbitope  )
static
static SCIP_DECL_CONSRESPROP ( consRespropOrbitope  )
static

propagation conflict resolving method of constraint handler

Definition at line 1972 of file cons_orbitope.c.

References NULL, resolvePropagation(), SCIP_CALL, and SCIP_OKAY.

static SCIP_DECL_CONSLOCK ( consLockOrbitope  )
static

variable rounding lock method of constraint handler

Definition at line 1988 of file cons_orbitope.c.

References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPaddVarLocks(), SCIPconsGetData(), SCIPconshdlrGetName(), and SCIPdebugMessage.

static SCIP_DECL_CONSPRINT ( consPrintOrbitope  )
static

constraint display method of constraint handler

Definition at line 2027 of file cons_orbitope.c.

References CONSHDLR_NAME, NULL, SCIP_OKAY, SCIPconsGetData(), SCIPconshdlrGetName(), SCIPdebugMessage, SCIPinfoMessage(), and SCIPvarGetName().

static SCIP_DECL_CONSCOPY ( consCopyOrbitope  )
static
static SCIP_DECL_CONSPARSE ( consParseOrbitope  )
static
static SCIP_DECL_CONSGETVARS ( consGetVarsOrbitope  )
static

constraint method of constraint handler which returns the variables (if possible)

Definition at line 2266 of file cons_orbitope.c.

References FALSE, NULL, SCIP_OKAY, SCIPconsGetData(), and TRUE.

static SCIP_DECL_CONSGETNVARS ( consGetNVarsOrbitope  )
static

constraint method of constraint handler which returns the number of variables (if possible)

Definition at line 2299 of file cons_orbitope.c.

References NULL, SCIP_OKAY, SCIPconsGetData(), and TRUE.

SCIP_RETCODE SCIPcreateConsOrbitope ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_VAR ***  vars,
SCIP_Bool  ispart,
int  nspcons,
int  nblocks,
SCIP_Bool  resolveprop,
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 orbitope 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
varsmatrix of variables on which the symmetry acts
ispartwhether we deal with the partitioning case (packing otherwise)
nspconsnumber of set partitioning/packing constraints <=> p
nblocksnumber of symmetric variable blocks <=> q
resolvepropshould propagation be resolved?
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 2361 of file cons_orbitope.c.

References consdataCreate(), CONSHDLR_NAME, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIP_Real, SCIP_VARTYPE_BINARY, SCIPcreateCons(), SCIPerrorMessage, SCIPfindConshdlr(), SCIPinfinity(), SCIPisEQ(), SCIPisInfinity(), SCIPisZero(), SCIPvarGetLbGlobal(), SCIPvarGetObj(), SCIPvarGetType(), and SCIPvarGetUbGlobal().

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

SCIP_RETCODE SCIPcreateConsBasicOrbitope ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_VAR ***  vars,
SCIP_Bool  ispart,
int  nspcons,
int  nblocks,
SCIP_Bool  resolveprop 
)

creates and captures an orbitope 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
varsmatrix of variables on which the symmetry acts
ispartwhether we deal with the partitioning case (packing otherwise)
nspconsnumber of set partitioning/packing constraints <=> p
nblocksnumber of symmetric variable blocks <=> q
resolvepropshould propagation be resolved?

Definition at line 2462 of file cons_orbitope.c.

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