Scippy

SCIP

Solving Constraint Integer Programs

cons_samediff.c File Reference

Detailed Description

Constraint handler stores the local branching decision data.

Author
Timo Berthold
Stefan Heinz

This constraint handler is used to store the branching decision of the Ryan/Foster branching rule which is implemented in branch_ryanfoster.c.

Definition in file cons_samediff.c.

#include <assert.h>
#include <string.h>
#include "cons_samediff.h"
#include "probdata_binpacking.h"
#include "vardata_binpacking.h"

Go to the source code of this file.

Macros

Constraint handler properties
#define CONSHDLR_NAME   "samediff"
 
#define CONSHDLR_DESC   "stores the local branching decisions"
 
#define CONSHDLR_ENFOPRIORITY   0
 
#define CONSHDLR_CHECKPRIORITY   9999999
 
#define CONSHDLR_PROPFREQ   1
 
#define CONSHDLR_EAGERFREQ   1
 
#define CONSHDLR_DELAYPROP   FALSE
 
#define CONSHDLR_NEEDSCONS   TRUE
 
#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP
 

Functions

Local methods
static SCIP_RETCODE consdataCreate (SCIP *scip, SCIP_CONSDATA **consdata, int itemid1, int itemid2, CONSTYPE type, SCIP_NODE *node)
 
static void consdataPrint (SCIP *scip, SCIP_CONSDATA *consdata, FILE *file)
 
static SCIP_RETCODE checkVariable (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_VAR *var, int *nfixedvars, SCIP_Bool *cutoff)
 
static SCIP_RETCODE consdataFixVariables (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_VAR **vars, int nvars, SCIP_RESULT *result)
 
static SCIP_Bool consdataCheck (SCIP *scip, SCIP_PROBDATA *probdata, SCIP_CONSDATA *consdata, SCIP_Bool beforeprop)
 
static SCIP_RETCODE consdataFree (SCIP *scip, SCIP_CONSDATA **consdata)
 
Interface methods
SCIP_RETCODE SCIPincludeConshdlrSamediff (SCIP *scip)
 
SCIP_RETCODE SCIPcreateConsSamediff (SCIP *scip, SCIP_CONS **cons, const char *name, int itemid1, int itemid2, CONSTYPE type, SCIP_NODE *node, SCIP_Bool local)
 
int SCIPgetItemid1Samediff (SCIP *scip, SCIP_CONS *cons)
 
int SCIPgetItemid2Samediff (SCIP *scip, SCIP_CONS *cons)
 
CONSTYPE SCIPgetTypeSamediff (SCIP *scip, SCIP_CONS *cons)
 

Callback methods

#define consEnfolpSamediff   NULL
 
#define consEnfopsSamediff   NULL
 
#define consCheckSamediff   NULL
 
#define consLockSamediff   NULL
 
static SCIP_DECL_CONSDELETE (consDeleteSamediff)
 
static SCIP_DECL_CONSTRANS (consTransSamediff)
 
static SCIP_DECL_CONSPROP (consPropSamediff)
 
static SCIP_DECL_CONSACTIVE (consActiveSamediff)
 
static SCIP_DECL_CONSDEACTIVE (consDeactiveSamediff)
 
static SCIP_DECL_CONSPRINT (consPrintSamediff)
 

Macro Definition Documentation

#define consCheckSamediff   NULL

feasibility check method of constraint handler for integral solutions

Definition at line 364 of file cons_samediff.c.

Referenced by SCIPincludeConshdlrSamediff().

#define consEnfolpSamediff   NULL

constraint enforcing method of constraint handler for LP solutions

Definition at line 358 of file cons_samediff.c.

Referenced by SCIPincludeConshdlrSamediff().

#define consEnfopsSamediff   NULL

constraint enforcing method of constraint handler for pseudo solutions

Definition at line 361 of file cons_samediff.c.

Referenced by SCIPincludeConshdlrSamediff().

#define CONSHDLR_CHECKPRIORITY   9999999

priority of the constraint handler for checking feasibility

Definition at line 43 of file cons_samediff.c.

Referenced by SCIPincludeConshdlrSamediff().

#define CONSHDLR_DELAYPROP   FALSE

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

Definition at line 48 of file cons_samediff.c.

Referenced by SCIPincludeConshdlrSamediff().

#define CONSHDLR_DESC   "stores the local branching decisions"

Definition at line 41 of file cons_samediff.c.

Referenced by SCIPincludeConshdlrSamediff().

#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 45 of file cons_samediff.c.

Referenced by SCIPincludeConshdlrSamediff().

#define CONSHDLR_ENFOPRIORITY   0

priority of the constraint handler for constraint enforcing

Definition at line 42 of file cons_samediff.c.

Referenced by SCIPincludeConshdlrSamediff().

#define CONSHDLR_NEEDSCONS   TRUE

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

Definition at line 49 of file cons_samediff.c.

Referenced by SCIPincludeConshdlrSamediff().

#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP

Definition at line 51 of file cons_samediff.c.

Referenced by SCIPincludeConshdlrSamediff().

#define CONSHDLR_PROPFREQ   1

frequency for propagating domains; zero means only preprocessing propagation

Definition at line 44 of file cons_samediff.c.

Referenced by SCIPincludeConshdlrSamediff().

#define consLockSamediff   NULL

variable rounding lock method of constraint handler

Definition at line 439 of file cons_samediff.c.

Referenced by SCIPincludeConshdlrSamediff().

Function Documentation

static SCIP_RETCODE checkVariable ( SCIP *  scip,
SCIP_CONSDATA *  consdata,
SCIP_VAR *  var,
int *  nfixedvars,
SCIP_Bool *  cutoff 
)
static

fixes a variable to zero if the corresponding packings are not valid for this constraint/node (due to branching)

Parameters
scipSCIP data structure
consdataconstraint data
varvariables to check
nfixedvarspointer to store the number of fixed variables
cutoffpointer to store if a cutoff was detected

Definition at line 132 of file cons_samediff.c.

References consdataFixVariables(), DIFFER, SAME, SCIPvardataGetConsids(), SCIPvardataGetNConsids(), and SCIP_ConsData::type.

Referenced by consdataFixVariables(), and consdataPrint().

static SCIP_Bool consdataCheck ( SCIP *  scip,
SCIP_PROBDATA *  probdata,
SCIP_CONSDATA *  consdata,
SCIP_Bool  beforeprop 
)
static

check if all variables are valid for the given consdata

Parameters
scipSCIP data structure
probdataproblem data
consdataconstraint data
beforepropis this check performed before propagation?

Definition at line 231 of file cons_samediff.c.

References consdataFree(), consdataPrint(), DIFFER, SAME, SCIPprobdataGetNVars(), SCIPprobdataGetVars(), SCIPvardataGetConsids(), SCIPvardataGetNConsids(), SCIPvardataPrint(), and SCIP_ConsData::type.

Referenced by consdataFixVariables(), SCIP_DECL_CONSACTIVE(), and SCIP_DECL_CONSPROP().

static SCIP_RETCODE consdataCreate ( SCIP *  scip,
SCIP_CONSDATA **  consdata,
int  itemid1,
int  itemid2,
CONSTYPE  type,
SCIP_NODE *  node 
)
static

create constraint data

Parameters
scipSCIP data structure
consdatapointer to store the constraint data
itemid1item id one
itemid2item id two
typestores whether the items have to be in the SAME or DIFFER packing
nodethe node in the B&B-tree at which the cons is sticking

Definition at line 80 of file cons_samediff.c.

References consdataPrint(), DIFFER, SCIP_ConsData::itemid1, SCIP_ConsData::itemid2, SCIP_ConsData::node, SAME, and SCIP_ConsData::type.

Referenced by SCIP_DECL_CONSTRANS(), and SCIPcreateConsSamediff().

static SCIP_RETCODE consdataFixVariables ( SCIP *  scip,
SCIP_CONSDATA *  consdata,
SCIP_VAR **  vars,
int  nvars,
SCIP_RESULT *  result 
)
static

fixes variables to zero if the corresponding packings are not valid for this sonstraint/node (due to branching)

Parameters
scipSCIP data structure
consdataconstraint data
varsgenerated variables
nvarsnumber of generated variables
resultpointer to store the result of the fixing

Definition at line 195 of file cons_samediff.c.

References checkVariable(), and consdataCheck().

Referenced by checkVariable(), and SCIP_DECL_CONSPROP().

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

frees samediff constraint data

Parameters
scipSCIP data structure
consdatapointer to the constraint data

Definition at line 291 of file cons_samediff.c.

References SCIP_DECL_CONSDELETE().

Referenced by consdataCheck(), and SCIP_DECL_CONSDELETE().

static void consdataPrint ( SCIP *  scip,
SCIP_CONSDATA *  consdata,
FILE *  file 
)
static

display constraints

Parameters
scipSCIP data structure
consdataconstraint data
filefile stream

Definition at line 110 of file cons_samediff.c.

References checkVariable(), SAME, and SCIPprobdataGetIds().

Referenced by consdataCheck(), consdataCreate(), SCIP_DECL_CONSACTIVE(), SCIP_DECL_CONSDEACTIVE(), SCIP_DECL_CONSPRINT(), SCIP_DECL_CONSPROP(), and SCIPcreateConsSamediff().

static SCIP_DECL_CONSACTIVE ( consActiveSamediff  )
static

constraint activation notification method of constraint handler

Definition at line 443 of file cons_samediff.c.

References consdataCheck(), consdataPrint(), CONSHDLR_NAME, SCIP_DECL_CONSDEACTIVE(), and SCIPprobdataGetNVars().

static SCIP_DECL_CONSDEACTIVE ( consDeactiveSamediff  )
static

constraint deactivation notification method of constraint handler

Definition at line 478 of file cons_samediff.c.

References consdataPrint(), CONSHDLR_NAME, SCIP_DECL_CONSPRINT(), and SCIPprobdataGetNVars().

Referenced by SCIP_DECL_CONSACTIVE().

static SCIP_DECL_CONSDELETE ( consDeleteSamediff  )
static

frees specific constraint data

Definition at line 314 of file cons_samediff.c.

References consdataFree(), CONSHDLR_NAME, and SCIP_DECL_CONSTRANS().

Referenced by consdataFree().

static SCIP_DECL_CONSPRINT ( consPrintSamediff  )
static

constraint display method of constraint handler

Definition at line 506 of file cons_samediff.c.

References consdataPrint(), and SCIPincludeConshdlrSamediff().

Referenced by SCIP_DECL_CONSDEACTIVE().

static SCIP_DECL_CONSPROP ( consPropSamediff  )
static

domain propagation method of constraint handler

Definition at line 368 of file cons_samediff.c.

References consdataCheck(), consdataFixVariables(), consdataPrint(), CONSHDLR_NAME, SCIPprobdataGetNVars(), and SCIPprobdataGetVars().

static SCIP_DECL_CONSTRANS ( consTransSamediff  )
static

transforms constraint data into data belonging to the transformed problem

Definition at line 329 of file cons_samediff.c.

References consdataCreate(), and CONSHDLR_NAME.

Referenced by SCIP_DECL_CONSDELETE().

SCIP_RETCODE SCIPcreateConsSamediff ( SCIP *  scip,
SCIP_CONS **  cons,
const char *  name,
int  itemid1,
int  itemid2,
CONSTYPE  type,
SCIP_NODE *  node,
SCIP_Bool  local 
)

creates and captures a samediff constraint

Parameters
scipSCIP data structure
conspointer to hold the created constraint
namename of constraint
itemid1item id one
itemid2item id two
typestores whether the items have to be in the SAME or DIFFER packing
nodethe node in the B&B-tree at which the cons is sticking
localis constraint only valid locally?

Definition at line 552 of file cons_samediff.c.

References consdataCreate(), consdataPrint(), CONSHDLR_NAME, SCIP_ConsData::itemid1, SCIP_ConsData::itemid2, SCIP_ConsData::node, SCIPgetItemid1Samediff(), and SCIP_ConsData::type.

Referenced by SCIP_DECL_BRANCHEXECLP(), and SCIPincludeConshdlrSamediff().

int SCIPgetItemid1Samediff ( SCIP *  scip,
SCIP_CONS *  cons 
)

returns item id one

Parameters
scipSCIP data structure
conssamediff constraint

Definition at line 588 of file cons_samediff.c.

References SCIPgetItemid2Samediff().

Referenced by addBranchingDecisionConss(), and SCIPcreateConsSamediff().

int SCIPgetItemid2Samediff ( SCIP *  scip,
SCIP_CONS *  cons 
)

returns item id two

Parameters
scipSCIP data structure
conssamediff constraint

Definition at line 604 of file cons_samediff.c.

References SCIPgetTypeSamediff().

Referenced by addBranchingDecisionConss(), and SCIPgetItemid1Samediff().

CONSTYPE SCIPgetTypeSamediff ( SCIP *  scip,
SCIP_CONS *  cons 
)

return constraint type SAME or DIFFER

Parameters
scipSCIP data structure
conssamediff constraint

Definition at line 620 of file cons_samediff.c.

Referenced by addBranchingDecisionConss(), and SCIPgetItemid2Samediff().

SCIP_RETCODE SCIPincludeConshdlrSamediff ( SCIP *  scip)