Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

constraint handler for counting feasible solutions

Author
Stefan Heinz
Michael Winkler

If this constraint handler is activated than it counts or collects all feasible solutions. We refer to How to use SCIP to count/enumerate feasible solutions for more details about using SCIP for counting feasible solutions.

Definition in file cons_countsols.c.

#include "blockmemshell/memory.h"
#include "scip/cons_bounddisjunction.h"
#include "scip/cons_countsols.h"
#include "scip/cons_knapsack.h"
#include "scip/cons_logicor.h"
#include "scip/cons_setppc.h"
#include "scip/cons_varbound.h"
#include "scip/dialog_default.h"
#include "scip/pub_cons.h"
#include "scip/pub_dialog.h"
#include "scip/pub_disp.h"
#include "scip/pub_heur.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/pub_misc_sort.h"
#include "scip/pub_sol.h"
#include "scip/pub_var.h"
#include "scip/scip_branch.h"
#include "scip/scip_cons.h"
#include "scip/scip_dialog.h"
#include "scip/scip_disp.h"
#include "scip/scip_general.h"
#include "scip/scip_heur.h"
#include "scip/scip_mem.h"
#include "scip/scip_message.h"
#include "scip/scip_numerics.h"
#include "scip/scip_param.h"
#include "scip/scip_prob.h"
#include "scip/scip_sol.h"
#include "scip/scip_solve.h"
#include "scip/scip_var.h"
#include "symmetry/type_symmetry.h"
#include <string.h>

Go to the source code of this file.

Macros

#define CONSHDLR_NAME   "countsols"
 
#define CONSHDLR_DESC   "constraint to count feasible solutions"
 
#define CONSHDLR_ENFOPRIORITY   -9999999
 
#define CONSHDLR_CHECKPRIORITY   -9999999
 
#define CONSHDLR_EAGERFREQ   100
 
#define CONSHDLR_NEEDSCONS   FALSE
 
#define DEFAULT_SPARSETEST   TRUE
 
#define DEFAULT_DISCARDSOLS   TRUE
 
#define DEFAULT_ACTIVE   FALSE
 
#define DEFAULT_COLLECT   FALSE
 
#define DEFAULT_SOLLIMIT   -1LL
 
#define DISP_SOLS_NAME   "sols"
 
#define DISP_SOLS_DESC   "number of detected feasible solutions"
 
#define DISP_SOLS_HEADER   " sols "
 
#define DISP_SOLS_WIDTH   7
 
#define DISP_SOLS_PRIORITY   110000
 
#define DISP_SOLS_POSITION   100000
 
#define DISP_SOLS_STRIPLINE   TRUE
 
#define DISP_CUTS_NAME   "feasST"
 
#define DISP_CUTS_DESC   "number of detected non trivial feasible subtrees"
 
#define DISP_CUTS_HEADER   "feasST"
 
#define DISP_CUTS_WIDTH   6
 
#define DISP_CUTS_PRIORITY   110000
 
#define DISP_CUTS_POSITION   110000
 
#define DISP_CUTS_STRIPLINE   TRUE
 
#define CUTOFF_CONSTRAINT(x)   SCIP_RETCODE x (SCIP* scip, SCIP_SOL* sol, SCIP_CONSHDLRDATA* conshdlrdata)
 
#define consCopyCountsols   NULL
 

Typedefs

typedef SCIP_Longint Int
 

Functions

static void allocInt (Int *value)
 
static void setInt (Int *value, SCIP_Longint newvalue)
 
static void setPowerOfTwo (Int *value, SCIP_Longint exponent)
 
static void freeInt (Int *value)
 
static void addOne (Int *value)
 
static void addInt (Int *value, Int *summand)
 
static void multInt (Int *value, SCIP_Longint factor)
 
static void toString (Int value, char **buffer, int buffersize)
 
static SCIP_Longint getNCountedSols (Int value, SCIP_Bool *valid)
 
static SCIP_Bool varIsUnfixedLocal (SCIP_VAR *var)
 
static SCIP_RETCODE conshdlrdataCreate (SCIP *scip, SCIP_CONSHDLRDATA **conshdlrdata)
 
static void checkSolutionOrig (SCIP *scip, SCIP_SOL *sol, SCIP_CONSHDLRDATA *conshdlrdata)
 
static SCIP_RETCODE checkParameters (SCIP *scip)
 
static CUTOFF_CONSTRAINT (addBinaryCons)
 
static CUTOFF_CONSTRAINT (addIntegerCons)
 
static SCIP_RETCODE collectSolution (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_SOL *sol)
 
static SCIP_RETCODE countSparseSol (SCIP *scip, SCIP_SOL *sol, SCIP_Bool feasible, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_RESULT *result)
 
static SCIP_RETCODE checkLogicor (SCIP *scip, SCIP_CONSHDLR *conshdlr, int nconss, SCIP_Bool *satisfied)
 
static SCIP_RETCODE checkKnapsack (SCIP *scip, SCIP_CONSHDLR *conshdlr, int nconss, SCIP_Bool *satisfied)
 
static SCIP_RETCODE checkBounddisjunction (SCIP *scip, SCIP_CONSHDLR *conshdlr, int nconss, SCIP_Bool *satisfied)
 
static SCIP_RETCODE checkVarbound (SCIP *scip, SCIP_CONSHDLR *conshdlr, int nconss, SCIP_Bool *satisfied)
 
static SCIP_RETCODE checkFeasSubtree (SCIP *scip, SCIP_SOL *sol, SCIP_Bool *feasible)
 
static SCIP_RETCODE checkSolution (SCIP *scip, SCIP_SOL *sol, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_RESULT *result)
 
static SCIP_RETCODE includeConshdlrCountsols (SCIP *scip, SCIP_Bool dialogs)
 
static SCIP_DECL_CONSHDLRCOPY (conshdlrCopyCountsols)
 
static SCIP_DECL_CONSFREE (consFreeCountsols)
 
static SCIP_DECL_CONSINIT (consInitCountsols)
 
static SCIP_DECL_CONSEXIT (consExitCountsols)
 
static SCIP_DECL_CONSINITSOL (consInitsolCountsols)
 
static SCIP_DECL_CONSEXITSOL (consExitsolCountsols)
 
static SCIP_DECL_CONSENFOLP (consEnfolpCountsols)
 
static SCIP_DECL_CONSENFORELAX (consEnforelaxCountsols)
 
static SCIP_DECL_CONSENFOPS (consEnfopsCountsols)
 
static SCIP_DECL_CONSCHECK (consCheckCountsols)
 
static SCIP_DECL_CONSLOCK (consLockCountsols)
 
 SCIP_DECL_DIALOGEXEC (SCIPdialogExecCountPresolve)
 
 SCIP_DECL_DIALOGEXEC (SCIPdialogExecCount)
 
static SCIP_DECL_SORTPTRCOMP (varCompProbindex)
 
static SCIP_RETCODE writeExpandedSolutions (SCIP *scip, FILE *file, SCIP_VAR **allvars, int nallvars, SCIP_VAR **activevars, int nactivevars, SCIP_HASHMAP *hashmap, SCIP_SPARSESOL **sols, int nsols)
 
 SCIP_DECL_DIALOGEXEC (SCIPdialogExecWriteAllsolutions)
 
static SCIP_RETCODE createCountDialog (SCIP *scip)
 
static SCIP_DECL_DISPOUTPUT (dispOutputSols)
 
static SCIP_DECL_DISPOUTPUT (dispOutputFeasSubtrees)
 
SCIP_RETCODE SCIPincludeConshdlrCountsols (SCIP *scip)
 
SCIP_RETCODE SCIPcount (SCIP *scip)
 
SCIP_Longint SCIPgetNCountedSols (SCIP *scip, SCIP_Bool *valid)
 
void SCIPgetNCountedSolsstr (SCIP *scip, char **buffer, int buffersize, int *requiredsize)
 
SCIP_Longint SCIPgetNCountedFeasSubtrees (SCIP *scip)
 
void SCIPgetCountedSparseSols (SCIP *scip, SCIP_VAR ***vars, int *nvars, SCIP_SPARSESOL ***sols, int *nsols)
 
SCIP_RETCODE SCIPsetParamsCountsols (SCIP *scip)
 

Macro Definition Documentation

◆ CONSHDLR_NAME

#define CONSHDLR_NAME   "countsols"

Definition at line 85 of file cons_countsols.c.

◆ CONSHDLR_DESC

#define CONSHDLR_DESC   "constraint to count feasible solutions"

Definition at line 86 of file cons_countsols.c.

◆ CONSHDLR_ENFOPRIORITY

#define CONSHDLR_ENFOPRIORITY   -9999999

priority of the constraint handler for constraint enforcing

Definition at line 87 of file cons_countsols.c.

◆ CONSHDLR_CHECKPRIORITY

#define CONSHDLR_CHECKPRIORITY   -9999999

priority of the constraint handler for checking feasibility

Definition at line 88 of file cons_countsols.c.

◆ CONSHDLR_EAGERFREQ

#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 90 of file cons_countsols.c.

◆ CONSHDLR_NEEDSCONS

#define CONSHDLR_NEEDSCONS   FALSE

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

Definition at line 91 of file cons_countsols.c.

◆ DEFAULT_SPARSETEST

#define DEFAULT_SPARSETEST   TRUE

sparse test on or off

Definition at line 94 of file cons_countsols.c.

◆ DEFAULT_DISCARDSOLS

#define DEFAULT_DISCARDSOLS   TRUE

is it allowed to discard solutions

Definition at line 95 of file cons_countsols.c.

◆ DEFAULT_ACTIVE

#define DEFAULT_ACTIVE   FALSE

is the constraint handler active

Definition at line 96 of file cons_countsols.c.

◆ DEFAULT_COLLECT

#define DEFAULT_COLLECT   FALSE

should the solutions be collected

Definition at line 97 of file cons_countsols.c.

◆ DEFAULT_SOLLIMIT

#define DEFAULT_SOLLIMIT   -1LL

counting stops, if the given number of solutions were found (-1: no limit)

Definition at line 98 of file cons_countsols.c.

◆ DISP_SOLS_NAME

#define DISP_SOLS_NAME   "sols"

Definition at line 101 of file cons_countsols.c.

◆ DISP_SOLS_DESC

#define DISP_SOLS_DESC   "number of detected feasible solutions"

Definition at line 102 of file cons_countsols.c.

◆ DISP_SOLS_HEADER

#define DISP_SOLS_HEADER   " sols "

Definition at line 103 of file cons_countsols.c.

◆ DISP_SOLS_WIDTH

#define DISP_SOLS_WIDTH   7

Definition at line 104 of file cons_countsols.c.

◆ DISP_SOLS_PRIORITY

#define DISP_SOLS_PRIORITY   110000

Definition at line 105 of file cons_countsols.c.

◆ DISP_SOLS_POSITION

#define DISP_SOLS_POSITION   100000

Definition at line 106 of file cons_countsols.c.

◆ DISP_SOLS_STRIPLINE

#define DISP_SOLS_STRIPLINE   TRUE

Definition at line 107 of file cons_countsols.c.

◆ DISP_CUTS_NAME

#define DISP_CUTS_NAME   "feasST"

Definition at line 109 of file cons_countsols.c.

◆ DISP_CUTS_DESC

#define DISP_CUTS_DESC   "number of detected non trivial feasible subtrees"

Definition at line 110 of file cons_countsols.c.

◆ DISP_CUTS_HEADER

#define DISP_CUTS_HEADER   "feasST"

Definition at line 111 of file cons_countsols.c.

◆ DISP_CUTS_WIDTH

#define DISP_CUTS_WIDTH   6

Definition at line 112 of file cons_countsols.c.

◆ DISP_CUTS_PRIORITY

#define DISP_CUTS_PRIORITY   110000

Definition at line 113 of file cons_countsols.c.

◆ DISP_CUTS_POSITION

#define DISP_CUTS_POSITION   110000

Definition at line 114 of file cons_countsols.c.

◆ DISP_CUTS_STRIPLINE

#define DISP_CUTS_STRIPLINE   TRUE

Definition at line 115 of file cons_countsols.c.

◆ CUTOFF_CONSTRAINT

#define CUTOFF_CONSTRAINT (   x)    SCIP_RETCODE x (SCIP* scip, SCIP_SOL* sol, SCIP_CONSHDLRDATA* conshdlrdata)

creates and adds a constraint which cuts off the solution from the feasibility region

input:

  • scip : SCIP main data structure
  • sol : solution to cut off
  • conshdlrdata : constraint handler data

Definition at line 124 of file cons_countsols.c.

◆ consCopyCountsols

#define consCopyCountsols   NULL

Definition at line 1407 of file cons_countsols.c.

Typedef Documentation

◆ Int

typedef SCIP_Longint Int

Definition at line 81 of file cons_countsols.c.

Function Documentation

◆ allocInt()

static void allocInt ( Int value)
static

allocates memory for the value pointer

Parameters
valuepointer to the value to allocate memory

Definition at line 165 of file cons_countsols.c.

Referenced by conshdlrdataCreate(), and countSparseSol().

◆ setInt()

static void setInt ( Int value,
SCIP_Longint  newvalue 
)
static

sets the value pointer to the new value

Parameters
valuepointer to the value to initialize
newvaluenew value

Definition at line 177 of file cons_countsols.c.

Referenced by countSparseSol(), and SCIP_DECL_CONSINIT().

◆ setPowerOfTwo()

static void setPowerOfTwo ( Int value,
SCIP_Longint  exponent 
)
static

sets a power of 2 to the given value

Parameters
valuepointer to the value to increase
exponentexponent for the base 2

Definition at line 194 of file cons_countsols.c.

References SCIP_Longint.

Referenced by countSparseSol().

◆ freeInt()

static void freeInt ( Int value)
static

free memory

Parameters
valuepointer to the value to free

Definition at line 212 of file cons_countsols.c.

Referenced by countSparseSol(), and SCIP_DECL_CONSFREE().

◆ addOne()

static void addOne ( Int value)
static

adds one to the given value

Parameters
valuepointer to the value to increase

Definition at line 224 of file cons_countsols.c.

Referenced by checkSolution(), and countSparseSol().

◆ addInt()

static void addInt ( Int value,
Int summand 
)
static

adds the summand to the given value

Parameters
valuepointer to the value to increase
summandsummand to add on

Definition at line 238 of file cons_countsols.c.

Referenced by countSparseSol().

◆ multInt()

static void multInt ( Int value,
SCIP_Longint  factor 
)
static

multiplies the factor by the given value

Parameters
valuepointer to the value to increase
factorfactor to multiply with

Definition at line 253 of file cons_countsols.c.

Referenced by countSparseSol().

◆ toString()

static void toString ( Int  value,
char **  buffer,
int  buffersize 
)
static

method for creating a string out of an Int which is a mpz_t or SCIP_Longint

Parameters
valuenumber
bufferpointer to buffer for storing the string
buffersizelength of the buffer

Definition at line 270 of file cons_countsols.c.

References SCIP_LONGINT_FORMAT, and SCIPsnprintf().

Referenced by SCIPgetNCountedSolsstr().

◆ getNCountedSols()

static SCIP_Longint getNCountedSols ( Int  value,
SCIP_Bool valid 
)
static

method for creating a SCIP_Longing out of an Int

Parameters
valuenumber to convert
validpointer to store if the return value is valid

Definition at line 286 of file cons_countsols.c.

References FALSE, and TRUE.

Referenced by checkSolution(), and SCIPgetNCountedSols().

◆ varIsUnfixedLocal()

static SCIP_Bool varIsUnfixedLocal ( SCIP_VAR var)
static

returns whether a given integer variable is unfixed in the local domain

Parameters
varinteger variable

Definition at line 311 of file cons_countsols.c.

References NULL, SCIP_VARTYPE_CONTINUOUS, SCIPvarGetLbLocal(), SCIPvarGetType(), and SCIPvarGetUbLocal().

Referenced by checkKnapsack(), and checkLogicor().

◆ conshdlrdataCreate()

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

creates the constraint handler data

Parameters
scipSCIP data structure
conshdlrdatapointer to store constraint handler data

Definition at line 325 of file cons_countsols.c.

References allocInt(), FALSE, NULL, SCIP_CALL, SCIP_OKAY, and SCIPallocBlockMemory.

Referenced by includeConshdlrCountsols().

◆ checkSolutionOrig()

static void checkSolutionOrig ( SCIP scip,
SCIP_SOL sol,
SCIP_CONSHDLRDATA conshdlrdata 
)
static

check solution in original space

Parameters
scipSCIP data structure
solsolution to add
conshdlrdataconstraint handler data

Definition at line 357 of file cons_countsols.c.

References FALSE, SCIP_Bool, SCIP_OKAY, SCIPABORT, SCIPcheckSolOrig(), SCIPdebugMsg, SCIPprintError(), and TRUE.

Referenced by checkSolution().

◆ checkParameters()

static SCIP_RETCODE checkParameters ( SCIP scip)
static

check if the current parameter setting is correct for a safe counting process

Parameters
scipSCIP data structure

Definition at line 393 of file cons_countsols.c.

References FALSE, h, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_VERBLEVEL_FULL, SCIPgetHeurs(), SCIPgetIntParam(), SCIPgetNHeurs(), SCIPheurGetFreq(), SCIPisParamFixed(), SCIPsetIntParam(), SCIPunfixParam(), SCIPverbMessage(), SCIPwarningMessage(), and TRUE.

Referenced by SCIPcount().

◆ CUTOFF_CONSTRAINT() [1/2]

static CUTOFF_CONSTRAINT ( addBinaryCons  )
static

creates and adds a constraints which cuts off the current solution from the feasibility region in the case there are only binary variables

Definition at line 460 of file cons_countsols.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPallocBufferArray, SCIPcreateConsSetcover(), SCIPfreeBufferArray, SCIPgetNegatedVar(), SCIPgetSolVal(), SCIPisFeasIntegral(), SCIPreleaseCons(), SCIPvarIsBinary(), and TRUE.

◆ CUTOFF_CONSTRAINT() [2/2]

static CUTOFF_CONSTRAINT ( addIntegerCons  )
static

creates and adds a bound disjunction constraints which cuts off the current solution from the feasibility region; if only binary variables are involved, then a set covering constraint is created which is a special case of a bound disjunction constraint

Definition at line 518 of file cons_countsols.c.

References FALSE, NULL, SCIP_BOUNDTYPE_LOWER, SCIP_BOUNDTYPE_UPPER, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPaddCons(), SCIPallocBufferArray, SCIPcreateConsBounddisjunction(), SCIPcreateConsSetcover(), SCIPfreeBufferArray, SCIPgetNegatedVar(), SCIPgetSolVal(), SCIPisFeasEQ(), SCIPisFeasIntegral(), SCIPreleaseCons(), SCIPvarGetLbLocal(), SCIPvarGetType(), SCIPvarGetUbLocal(), SCIPvarIsBinary(), and TRUE.

◆ collectSolution()

static SCIP_RETCODE collectSolution ( SCIP scip,
SCIP_CONSHDLRDATA conshdlrdata,
SCIP_SOL sol 
)
static

collect given solution or local domains as sparse solution

Parameters
scipSCIP data structure
conshdlrdataconstraint handler data
solsolution, or NULL if local domains

Definition at line 649 of file cons_countsols.c.

References FALSE, NULL, SCIP_CALL, SCIP_CALL_FINALLY, SCIP_Longint, SCIP_LONGINT_FORMAT, SCIP_OKAY, SCIPallocMemoryArray, SCIPconvertRealToLongint(), SCIPdebugMsg, SCIPgetSolVal(), SCIPreallocMemoryArray, SCIPsparseSolCreate(), SCIPsparseSolFree(), SCIPsparseSolGetLbs(), SCIPsparseSolGetUbs(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), and SCIP_SparseSol::vars.

Referenced by checkSolution(), and countSparseSol().

◆ countSparseSol()

static SCIP_RETCODE countSparseSol ( SCIP scip,
SCIP_SOL sol,
SCIP_Bool  feasible,
SCIP_CONSHDLRDATA conshdlrdata,
SCIP_RESULT result 
)
static

counts the number of solutions represented by sol

Note
aggregations and multi aggregations: we do not have to care about these things since we count solutions from the transformed problem and therefore, SCIP does it for us
Parameters
scipSCIP data structure
solsolution
feasibleis solution feasible?
conshdlrdataconstraint handler data
resultpointer to store the result of the checking process

Definition at line 727 of file cons_countsols.c.

References addInt(), addOne(), allocInt(), collectSolution(), freeInt(), multInt(), NULL, SCIP_CALL, SCIP_CUTOFF, SCIP_INFEASIBLE, SCIP_Longint, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPdebugMsg, SCIPgetNBinVars(), SCIPgetNPseudoBranchCands(), SCIPgetNVars(), SCIPgetPseudoBranchCands(), SCIPisFeasIntegral(), SCIPisFeasLT(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetOrigvarSum(), SCIPvarGetType(), SCIPvarGetUbLocal(), setInt(), and setPowerOfTwo().

Referenced by checkSolution().

◆ checkLogicor()

static SCIP_RETCODE checkLogicor ( SCIP scip,
SCIP_CONSHDLR conshdlr,
int  nconss,
SCIP_Bool satisfied 
)
static

checks if the new solution is feasible for the logicor constraints

Note
the logicor constraints are not fully propagated; therefore, we have to check them by hand if they are satisfied or not; if a constraint is satisfied we delete it locally from the branch and bound tree.
Parameters
scipSCIP data structure
conshdlrconstraint handler
nconssnumber of enabled constraints
satisfiedpointer to store if the logicor constraints a satisfied

Definition at line 844 of file cons_countsols.c.

References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconsGetName(), SCIPconshdlrGetConss(), SCIPconshdlrGetNActiveConss(), SCIPconshdlrGetName(), SCIPconshdlrGetNEnabledConss(), SCIPconsIsEnabled(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPdelConsLocal(), SCIPgetNVarsLogicor(), SCIPgetVarsLogicor(), SCIPvarGetLbLocal(), SCIPvarIsBinary(), TRUE, and varIsUnfixedLocal().

Referenced by checkFeasSubtree().

◆ checkKnapsack()

static SCIP_RETCODE checkKnapsack ( SCIP scip,
SCIP_CONSHDLR conshdlr,
int  nconss,
SCIP_Bool satisfied 
)
static

checks if the new solution is feasible for the knapsack constraints

Note
the knapsack constraints are not fully propagated; therefore, we have to check them by hand if they are satisfied or not; if a constraint is satisfied we delete it locally from the branch and bound tree.
Parameters
scipSCIP data structure
conshdlrconstraint handler
nconssnumber of enabled constraints
satisfiedpointer to store if the logicor constraints a satisfied

Definition at line 917 of file cons_countsols.c.

References FALSE, NULL, SCIP_CALL, SCIP_Longint, SCIP_LONGINT_FORMAT, SCIP_OKAY, SCIP_Real, SCIPconsGetName(), SCIPconshdlrGetConss(), SCIPconshdlrGetNActiveConss(), SCIPconshdlrGetName(), SCIPconshdlrGetNEnabledConss(), SCIPconsIsEnabled(), SCIPdebug, SCIPdebugMsg, SCIPdebugPrintCons, SCIPdelConsLocal(), SCIPgetCapacityKnapsack(), SCIPgetNVarsKnapsack(), SCIPgetVarsKnapsack(), SCIPgetWeightsKnapsack(), SCIPisFeasLT(), SCIPprintVar(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), SCIPvarIsIntegral(), TRUE, and varIsUnfixedLocal().

Referenced by checkFeasSubtree().

◆ checkBounddisjunction()

static SCIP_RETCODE checkBounddisjunction ( SCIP scip,
SCIP_CONSHDLR conshdlr,
int  nconss,
SCIP_Bool satisfied 
)
static

checks if the new solution is feasible for the bounddisjunction constraints

Note
the bounddisjunction constraints are not fully propagated; therefore, we have to check them by hand if they are satisfied or not; if a constraint is satisfied we delete it locally from the branch and bound tree
Parameters
scipSCIP data structure
conshdlrconstraint handler
nconssnumber of enabled constraints
satisfiedpointer to store if the logicor constraints a satisfied

Definition at line 1012 of file cons_countsols.c.

References FALSE, NULL, SCIP_Bool, SCIP_BOUNDTYPE_LOWER, SCIP_BOUNDTYPE_UPPER, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPconsGetName(), SCIPconshdlrGetConss(), SCIPconshdlrGetNActiveConss(), SCIPconshdlrGetName(), SCIPconshdlrGetNEnabledConss(), SCIPconsIsEnabled(), SCIPdebug, SCIPdebugMsg, SCIPdebugPrintCons, SCIPdelConsLocal(), SCIPgetBoundsBounddisjunction(), SCIPgetBoundtypesBounddisjunction(), SCIPgetNVarsBounddisjunction(), SCIPgetVarsBounddisjunction(), SCIPisFeasGE(), SCIPisFeasLE(), SCIPprintVar(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), and TRUE.

Referenced by checkFeasSubtree().

◆ checkVarbound()

static SCIP_RETCODE checkVarbound ( SCIP scip,
SCIP_CONSHDLR conshdlr,
int  nconss,
SCIP_Bool satisfied 
)
static

checks if the new solution is feasible for the varbound constraints

Note
the varbound constraints are not fully propagated; therefore, we have to check them by hand if they are satisfied or not; if a constraint is satisfied we delete it locally from the branch and bound tree.
Parameters
scipSCIP data structure
conshdlrconstraint handler
nconssnumber of enabled constraints
satisfiedpointer to store if the logicor constraints a satisfied

Definition at line 1090 of file cons_countsols.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPconsGetName(), SCIPconshdlrGetConss(), SCIPconshdlrGetNActiveConss(), SCIPconshdlrGetName(), SCIPconshdlrGetNEnabledConss(), SCIPconsIsEnabled(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPdelConsLocal(), SCIPgetLhsVarbound(), SCIPgetRhsVarbound(), SCIPgetVarVarbound(), SCIPgetVbdcoefVarbound(), SCIPgetVbdvarVarbound(), SCIPisGE(), SCIPisGT(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetType(), SCIPvarGetUbLocal(), and TRUE.

Referenced by checkFeasSubtree().

◆ checkFeasSubtree()

static SCIP_RETCODE checkFeasSubtree ( SCIP scip,
SCIP_SOL sol,
SCIP_Bool feasible 
)
static

check if the current node initializes a non trivial unrestricted subtree

Parameters
scipSCIP main data structure
solsolution to check
feasiblepointer to store the result of the check

Definition at line 1166 of file cons_countsols.c.

References checkBounddisjunction(), checkKnapsack(), checkLogicor(), checkVarbound(), CONSHDLR_NAME, FALSE, h, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetConss(), SCIPconshdlrGetName(), SCIPconshdlrGetNEnabledConss(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPgetConshdlrs(), SCIPgetNConshdlrs(), SCIPgetNPseudoBranchCands(), and TRUE.

Referenced by checkSolution().

◆ checkSolution()

static SCIP_RETCODE checkSolution ( SCIP scip,
SCIP_SOL sol,
SCIP_CONSHDLRDATA conshdlrdata,
SCIP_RESULT result 
)
static

◆ includeConshdlrCountsols()

◆ SCIP_DECL_CONSHDLRCOPY()

static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopyCountsols  )
static

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

Definition at line 1382 of file cons_countsols.c.

References CONSHDLR_NAME, FALSE, includeConshdlrCountsols(), NULL, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrGetName(), and TRUE.

◆ SCIP_DECL_CONSFREE()

static SCIP_DECL_CONSFREE ( consFreeCountsols  )
static

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

Definition at line 1411 of file cons_countsols.c.

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

◆ SCIP_DECL_CONSINIT()

static SCIP_DECL_CONSINIT ( consInitCountsols  )
static

◆ SCIP_DECL_CONSEXIT()

static SCIP_DECL_CONSEXIT ( consExitCountsols  )
static

◆ SCIP_DECL_CONSINITSOL()

static SCIP_DECL_CONSINITSOL ( consInitsolCountsols  )
static

solving process initialization method of constraint handler (called when branch and bound process is about to begin)

This method is called when the presolving was finished and the branch and bound process is about to begin. The constraint handler may use this call to initialize its branch and bound specific data.

Definition at line 1582 of file cons_countsols.c.

References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPblkmem(), SCIPcaptureVar(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPduplicateBlockMemoryArray, SCIPgetNBinVars(), SCIPgetNContVars(), SCIPgetNVars(), SCIPgetVars(), SCIPhashmapCreate(), SCIPhashmapInsertInt(), SCIPvarGetOrigvarSum(), SCIPvarGetProbindex(), and SCIPvarGetType().

◆ SCIP_DECL_CONSEXITSOL()

static SCIP_DECL_CONSEXITSOL ( consExitsolCountsols  )
static

solving process deinitialization method of constraint handler (called before branch and bound process data is freed)

Definition at line 1667 of file cons_countsols.c.

References CONSHDLR_NAME, NULL, SCIP_INVALIDCALL, SCIP_OKAY, SCIPABORT, SCIPconshdlrGetData(), SCIPconshdlrGetName(), and SCIPerrorMessage.

◆ SCIP_DECL_CONSENFOLP()

static SCIP_DECL_CONSENFOLP ( consEnfolpCountsols  )
static

constraint enforcing method of constraint handler for LP solutions

Definition at line 1691 of file cons_countsols.c.

References checkSolution(), NULL, SCIP_CALL, SCIP_CUTOFF, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconshdlrGetData(), SCIPcreateLPSol(), SCIPdebugMsg, and SCIPfreeSol().

◆ SCIP_DECL_CONSENFORELAX()

static SCIP_DECL_CONSENFORELAX ( consEnforelaxCountsols  )
static

constraint enforcing method of constraint handler for relaxation solutions

Definition at line 1728 of file cons_countsols.c.

References checkSolution(), NULL, SCIP_CALL, SCIP_CUTOFF, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconshdlrGetData(), and SCIPdebugMsg.

◆ SCIP_DECL_CONSENFOPS()

static SCIP_DECL_CONSENFOPS ( consEnfopsCountsols  )
static

constraint enforcing method of constraint handler for pseudo solutions

Definition at line 1760 of file cons_countsols.c.

References checkSolution(), NULL, SCIP_CALL, SCIP_CUTOFF, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconshdlrGetData(), SCIPcreatePseudoSol(), SCIPdebugMsg, and SCIPfreeSol().

◆ SCIP_DECL_CONSCHECK()

static SCIP_DECL_CONSCHECK ( consCheckCountsols  )
static

feasibility check method of constraint handler for integral solutions

Definition at line 1798 of file cons_countsols.c.

References checkSolution(), NULL, SCIP_CALL, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconshdlrGetData(), SCIPdebugMsg, SCIPgetNVars(), SCIPwarningMessage(), and TRUE.

◆ SCIP_DECL_CONSLOCK()

static SCIP_DECL_CONSLOCK ( consLockCountsols  )
static

variable rounding lock method of constraint handler

Definition at line 1831 of file cons_countsols.c.

References SCIP_OKAY.

◆ SCIP_DECL_SORTPTRCOMP()

static SCIP_DECL_SORTPTRCOMP ( varCompProbindex  )
static

comparison method for sorting variables by non-decreasing w.r.t. problem index

Definition at line 2144 of file cons_countsols.c.

References NULL, and SCIPvarGetProbindex().

◆ writeExpandedSolutions()

static SCIP_RETCODE writeExpandedSolutions ( SCIP scip,
FILE *  file,
SCIP_VAR **  allvars,
int  nallvars,
SCIP_VAR **  activevars,
int  nactivevars,
SCIP_HASHMAP hashmap,
SCIP_SPARSESOL **  sols,
int  nsols 
)
static

expands the sparse solutions and writes them to the file

Parameters
scipSCIP data structure
filefile handler
allvarsSCIP variables
nallvarsnumber of all variables
activevarsSCIP variables
nactivevarsnumber of active variables
hashmaphashmap from active solution variable to the position in the active variables array
solssparse solutions to expands and write
nsolsnumber of sparse solutions

Definition at line 2168 of file cons_countsols.c.

References NULL, scalars, SCIP_CALL, SCIP_Longint, SCIP_LONGINT_FORMAT, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPgetProbvarLinearSum(), SCIPhashmapExists(), SCIPhashmapGetImageInt(), SCIPinfoMessage(), SCIPisIntegral(), SCIPretransformObj(), SCIPsparseSolGetFirstSol(), SCIPsparseSolGetNextSol(), SCIPsparseSolGetNVars(), SCIPvarGetObj(), and TRUE.

Referenced by SCIP_DECL_DIALOGEXEC().

◆ createCountDialog()

static SCIP_RETCODE createCountDialog ( SCIP scip)
static

create the interactive shell dialogs for the counting process

Parameters
scipSCIP data structure

Definition at line 2483 of file cons_countsols.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPaddDialogEntry(), SCIPdialogFindEntry(), SCIPdialogHasEntry(), SCIPerrorMessage, SCIPgetRootDialog(), SCIPincludeDialog(), and SCIPreleaseDialog().

Referenced by includeConshdlrCountsols().

◆ SCIP_DECL_DISPOUTPUT() [1/2]

static SCIP_DECL_DISPOUTPUT ( dispOutputSols  )
static

◆ SCIP_DECL_DISPOUTPUT() [2/2]

static SCIP_DECL_DISPOUTPUT ( dispOutputFeasSubtrees  )
static