constraint handler for counting feasible solutions
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 <string.h>
#include "scip/cons_and.h"
#include "scip/cons_knapsack.h"
#include "scip/cons_bounddisjunction.h"
#include "scip/cons_logicor.h"
#include "scip/cons_setppc.h"
#include "scip/cons_varbound.h"
#include "scip/cons_countsols.h"
#include "scip/dialog_default.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) |
#define CONSHDLR_NAME "countsols" |
Definition at line 52 of file cons_countsols.c.
Referenced by checkFeasSubtree(), includeConshdlrCountsols(), SCIP_DECL_CONSEXIT(), SCIP_DECL_CONSEXITSOL(), SCIP_DECL_CONSFREE(), SCIP_DECL_CONSHDLRCOPY(), SCIP_DECL_CONSINIT(), SCIP_DECL_CONSINITSOL(), SCIP_DECL_DIALOGEXEC(), SCIP_DECL_DISPOUTPUT(), SCIPcount(), SCIPgetCountedSparseSols(), SCIPgetNCountedFeasSubtrees(), SCIPgetNCountedSols(), and SCIPgetNCountedSolsstr().
#define CONSHDLR_DESC "constraint to count feasible solutions" |
Definition at line 53 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define CONSHDLR_ENFOPRIORITY -9999999 |
priority of the constraint handler for constraint enforcing
Definition at line 54 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define CONSHDLR_CHECKPRIORITY -9999999 |
priority of the constraint handler for checking feasibility
Definition at line 55 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#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 56 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define CONSHDLR_NEEDSCONS FALSE |
should the constraint handler be skipped, if no constraints are available?
Definition at line 59 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DEFAULT_SPARSETEST TRUE |
sparse test on or off
Definition at line 62 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DEFAULT_DISCARDSOLS TRUE |
is it allowed to discard solutions
Definition at line 63 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DEFAULT_ACTIVE FALSE |
is the constraint handler active
Definition at line 64 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DEFAULT_COLLECT FALSE |
should the solutions be collected
Definition at line 65 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DEFAULT_SOLLIMIT -1LL |
counting stops, if the given number of solutions were found (-1: no limit)
Definition at line 66 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DISP_SOLS_NAME "sols" |
Definition at line 69 of file cons_countsols.c.
Referenced by includeConshdlrCountsols(), and SCIP_DECL_DISPOUTPUT().
#define DISP_SOLS_DESC "number of detected feasible solutions" |
Definition at line 70 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DISP_SOLS_HEADER " sols " |
Definition at line 71 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DISP_SOLS_WIDTH 7 |
Definition at line 72 of file cons_countsols.c.
Referenced by includeConshdlrCountsols(), and SCIP_DECL_DISPOUTPUT().
#define DISP_SOLS_PRIORITY 110000 |
Definition at line 73 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DISP_SOLS_POSITION 100000 |
Definition at line 74 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DISP_SOLS_STRIPLINE TRUE |
Definition at line 75 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DISP_CUTS_NAME "feasST" |
Definition at line 77 of file cons_countsols.c.
Referenced by includeConshdlrCountsols(), and SCIP_DECL_DISPOUTPUT().
#define DISP_CUTS_DESC "number of detected non trivial feasible subtrees" |
Definition at line 78 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DISP_CUTS_HEADER "feasST" |
Definition at line 79 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DISP_CUTS_WIDTH 6 |
Definition at line 80 of file cons_countsols.c.
Referenced by includeConshdlrCountsols(), and SCIP_DECL_DISPOUTPUT().
#define DISP_CUTS_PRIORITY 110000 |
Definition at line 81 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DISP_CUTS_POSITION 110000 |
Definition at line 82 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#define DISP_CUTS_STRIPLINE TRUE |
Definition at line 83 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
#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:
Definition at line 93 of file cons_countsols.c.
Referenced by checkParameters(), and CUTOFF_CONSTRAINT().
#define consCopyCountsols NULL |
Definition at line 1371 of file cons_countsols.c.
Referenced by includeConshdlrCountsols().
typedef SCIP_Longint Int |
Definition at line 48 of file cons_countsols.c.
|
static |
allocates memory for the value pointer
value | pointer to the value to allocate memory |
Definition at line 134 of file cons_countsols.c.
References setInt().
Referenced by conshdlrdataCreate(), and countSparseSol().
|
static |
sets the value pointer to the new value
value | pointer to the value to initialize |
newvalue | new value |
Definition at line 146 of file cons_countsols.c.
References setPowerOfTwo().
Referenced by allocInt(), countSparseSol(), and SCIP_DECL_CONSINIT().
|
static |
sets a power of 2 to the given value
value | pointer to the value to increase |
exponent | exponent for the base 2 |
Definition at line 163 of file cons_countsols.c.
References freeInt(), and SCIP_Longint.
Referenced by countSparseSol(), and setInt().
|
static |
free memory
value | pointer to the value to free |
Definition at line 181 of file cons_countsols.c.
References addOne().
Referenced by countSparseSol(), SCIP_DECL_CONSFREE(), and setPowerOfTwo().
|
static |
adds one to the given value
value | pointer to the value to increase |
Definition at line 193 of file cons_countsols.c.
References addInt().
Referenced by checkSolution(), countSparseSol(), and freeInt().
adds the summand to the given value
value | pointer to the value to increase |
summand | summand to add on |
Definition at line 207 of file cons_countsols.c.
References multInt().
Referenced by addOne(), and countSparseSol().
|
static |
multiplies the factor by the given value
value | pointer to the value to increase |
factor | factor to multiply with |
Definition at line 222 of file cons_countsols.c.
References toString().
Referenced by addInt(), and countSparseSol().
|
static |
method for creating a string out of an Int which is a mpz_t or SCIP_Longint
value | number |
buffer | pointer to buffer for storing the string |
buffersize | length of the buffer |
Definition at line 239 of file cons_countsols.c.
References getNCountedSols(), SCIP_Longint, and SCIPsnprintf().
Referenced by multInt(), and SCIPgetNCountedSolsstr().
|
static |
method for creating a SCIP_Longing out of an Int
value | number to convert |
valid | pointer to store if the return value is valid |
Definition at line 255 of file cons_countsols.c.
References FALSE, SCIP_Bool, TRUE, and varIsUnfixedLocal().
Referenced by checkSolution(), SCIPgetNCountedSols(), and toString().
returns whether a given integer variable is unfixed in the local domain
var | integer variable |
Definition at line 280 of file cons_countsols.c.
References conshdlrdataCreate(), SCIP_VARTYPE_CONTINUOUS, SCIPvarGetLbLocal(), SCIPvarGetType(), and SCIPvarGetUbLocal().
Referenced by checkKnapsack(), checkLogicor(), and getNCountedSols().
|
static |
creates the constraint handler data
scip | SCIP data structure |
conshdlrdata | pointer to store constraint handler data |
Definition at line 294 of file cons_countsols.c.
References allocInt(), checkSolutionOrig(), FALSE, SCIP_CALL, SCIP_OKAY, and SCIPallocBlockMemory.
Referenced by includeConshdlrCountsols(), and varIsUnfixedLocal().
|
static |
check solution in original space
scip | SCIP data structure |
sol | solution to add |
conshdlrdata | constraint handler data |
Definition at line 326 of file cons_countsols.c.
References checkParameters(), FALSE, SCIP_Bool, SCIP_OKAY, SCIPABORT, SCIPcheckSolOrig(), SCIPdebugMsg, SCIPprintError(), and TRUE.
Referenced by checkSolution(), and conshdlrdataCreate().
|
static |
check if the current parameter setting is correct for a save counting process
scip | SCIP data structure |
Definition at line 362 of file cons_countsols.c.
References CUTOFF_CONSTRAINT, FALSE, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_VERBLEVEL_FULL, SCIPgetHeurs(), SCIPgetIntParam(), SCIPgetNHeurs(), SCIPheurGetFreq(), SCIPisParamFixed(), SCIPsetIntParam(), SCIPunfixParam(), SCIPverbMessage(), SCIPwarningMessage(), and TRUE.
Referenced by checkSolutionOrig(), and SCIPcount().
|
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 417 of file cons_countsols.c.
References CUTOFF_CONSTRAINT, FALSE, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPallocBufferArray, SCIPcreateConsSetcover(), SCIPfreeBufferArray, SCIPgetNegatedVar(), SCIPgetSolVal(), SCIPisFeasIntegral(), SCIPreleaseCons(), SCIPvarIsBinary(), and TRUE.
|
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 477 of file cons_countsols.c.
References collectSolution(), FALSE, 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.
|
static |
collect given solution or local domains as sparse solution
scip | SCIP data structure |
conshdlrdata | constraint handler data |
sol | solution, or NULL if local domains |
Definition at line 610 of file cons_countsols.c.
References countSparseSol(), FALSE, SCIP_CALL, SCIP_CALL_FINALLY, SCIP_Longint, SCIP_OKAY, SCIPallocMemoryArray, SCIPconvertRealToLongint(), SCIPdebugMsg, SCIPgetSolVal(), SCIPreallocMemoryArray, SCIPsparseSolCreate(), SCIPsparseSolFree(), SCIPsparseSolGetLbs(), SCIPsparseSolGetUbs(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), and SCIP_SparseSol::vars.
Referenced by checkSolution(), countSparseSol(), and CUTOFF_CONSTRAINT().
|
static |
counts the number of solutions represented by sol
scip | SCIP data structure |
sol | solution |
feasible | is solution feasible? |
conshdlrdata | constraint handler data |
result | pointer to store the result of the checking process |
Definition at line 688 of file cons_countsols.c.
References addInt(), addOne(), allocInt(), checkLogicor(), collectSolution(), freeInt(), multInt(), 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(), and collectSolution().
|
static |
checks if the new solution is feasible for the logicor constraints
scip | SCIP data structure |
conshdlr | constraint handler |
nconss | number of enabled constraints |
satisfied | pointer to store if the logicor constraints a satisfied |
Definition at line 807 of file cons_countsols.c.
References checkKnapsack(), FALSE, 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(), and countSparseSol().
|
static |
checks if the new solution is feasible for the knapsack constraints
scip | SCIP data structure |
conshdlr | constraint handler |
nconss | number of enabled constraints |
satisfied | pointer to store if the logicor constraints a satisfied |
Definition at line 880 of file cons_countsols.c.
References checkBounddisjunction(), FALSE, SCIP_CALL, SCIP_Longint, 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(), and checkLogicor().
|
static |
checks if the new solution is feasible for the bounddisjunction constraints
scip | SCIP data structure |
conshdlr | constraint handler |
nconss | number of enabled constraints |
satisfied | pointer to store if the logicor constraints a satisfied |
Definition at line 975 of file cons_countsols.c.
References checkVarbound(), FALSE, 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(), and checkKnapsack().
|
static |
checks if the new solution is feasible for the varbound constraints
scip | SCIP data structure |
conshdlr | constraint handler |
nconss | number of enabled constraints |
satisfied | pointer to store if the logicor constraints a satisfied |
Definition at line 1053 of file cons_countsols.c.
References checkFeasSubtree(), FALSE, 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 checkBounddisjunction(), and checkFeasSubtree().
|
static |
check if the current node initializes a non trivial unrestricted subtree
scip | SCIP main data structure |
sol | solution to check |
feasible | pointer to store the result of the check |
Definition at line 1129 of file cons_countsols.c.
References checkBounddisjunction(), checkKnapsack(), checkLogicor(), checkSolution(), checkVarbound(), CONSHDLR_NAME, FALSE, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetConss(), SCIPconshdlrGetName(), SCIPconshdlrGetNEnabledConss(), SCIPdebugMsg, SCIPdebugPrintCons, SCIPgetConshdlrs(), SCIPgetNConshdlrs(), SCIPgetNPseudoBranchCands(), and TRUE.
Referenced by checkSolution(), and checkVarbound().
|
static |
check the given solution
scip | SCIP data structure |
sol | solution to add |
conshdlrdata | constraint handler data |
result | pointer to store the result of the checking process |
Definition at line 1230 of file cons_countsols.c.
References addOne(), checkFeasSubtree(), checkSolutionOrig(), collectSolution(), countSparseSol(), getNCountedSols(), includeConshdlrCountsols(), SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DECL_CONSHDLRCOPY(), SCIP_INFEASIBLE, SCIP_Longint, SCIP_OKAY, SCIPdebugMsg, SCIPgetNOrigVars(), SCIPgetNPseudoBranchCands(), SCIPgetNVars(), SCIPgetVars(), SCIPinterruptSolve(), SCIPsolGetHeur(), SCIPvarGetLbGlobal(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), and SCIPvarGetUbLocal().
Referenced by checkFeasSubtree(), SCIP_DECL_CONSENFOLP(), SCIP_DECL_CONSENFOPS(), and SCIP_DECL_CONSENFORELAX().
|
static |
creates the handler for countsols constraints and includes it in SCIP
scip | SCIP data structure |
dialogs | sould count dialogs be added |
Definition at line 2511 of file cons_countsols.c.
References consCopyCountsols, CONSHDLR_CHECKPRIORITY, CONSHDLR_DESC, CONSHDLR_EAGERFREQ, CONSHDLR_ENFOPRIORITY, CONSHDLR_NAME, CONSHDLR_NEEDSCONS, conshdlrdataCreate(), createCountDialog(), DEFAULT_ACTIVE, DEFAULT_COLLECT, DEFAULT_DISCARDSOLS, DEFAULT_SOLLIMIT, DEFAULT_SPARSETEST, DISP_CUTS_DESC, DISP_CUTS_HEADER, DISP_CUTS_NAME, DISP_CUTS_POSITION, DISP_CUTS_PRIORITY, DISP_CUTS_STRIPLINE, DISP_CUTS_WIDTH, DISP_SOLS_DESC, DISP_SOLS_HEADER, DISP_SOLS_NAME, DISP_SOLS_POSITION, DISP_SOLS_PRIORITY, DISP_SOLS_STRIPLINE, DISP_SOLS_WIDTH, FALSE, SCIP_CALL, SCIP_DISPSTATUS_OFF, SCIP_LONGINT_MAX, SCIP_OKAY, SCIPaddBoolParam(), SCIPaddLongintParam(), SCIPincludeConshdlrBasic(), SCIPincludeConshdlrCountsols(), SCIPincludeDisp(), SCIPincludeExternalCodeInformation(), SCIPsetConshdlrCopy(), SCIPsetConshdlrEnforelax(), SCIPsetConshdlrExit(), SCIPsetConshdlrExitsol(), SCIPsetConshdlrFree(), SCIPsetConshdlrInit(), SCIPsetConshdlrInitsol(), and SCIPsnprintf().
Referenced by checkSolution(), SCIP_DECL_CONSHDLRCOPY(), SCIP_DECL_DISPOUTPUT(), and SCIPincludeConshdlrCountsols().
|
static |
copy method for constraint handler plugins (called when SCIP copies plugins)
Definition at line 1346 of file cons_countsols.c.
References CONSHDLR_NAME, FALSE, includeConshdlrCountsols(), SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrGetName(), and TRUE.
Referenced by checkSolution().
|
static |
destructor of constraint handler to free constraint handler data (called when SCIP is exiting)
Definition at line 1375 of file cons_countsols.c.
References CONSHDLR_NAME, freeInt(), SCIP_DECL_CONSINIT(), SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPconshdlrSetData(), and SCIPfreeBlockMemory.
|
static |
initialization method of constraint handler (called after problem was transformed)
Definition at line 1401 of file cons_countsols.c.
References CONSHDLR_NAME, SCIP_CALL, SCIP_DECL_CONSEXIT(), SCIP_OKAY, SCIP_VARTYPE_CONTINUOUS, SCIPaddVarLocks(), SCIPallocBlockMemoryArray, SCIPcaptureVar(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPgetNContVars(), SCIPgetNOrigVars(), SCIPgetNVars(), SCIPgetOrigVars(), SCIPgetTransformedVar(), SCIPvarGetName(), SCIPvarGetType(), and setInt().
Referenced by SCIP_DECL_CONSFREE().
|
static |
deinitialization method of constraint handler (called before transformed problem is freed)
Definition at line 1471 of file cons_countsols.c.
References CONSHDLR_NAME, FALSE, SCIP_CALL, SCIP_DECL_CONSINITSOL(), SCIP_OKAY, SCIPaddVarLocks(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPfreeBlockMemoryArrayNull, SCIPfreeMemoryArrayNull, SCIPhashmapFree(), SCIPreleaseVar(), SCIPsparseSolFree(), and SCIPvarGetName().
Referenced by SCIP_DECL_CONSINIT().
|
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 1546 of file cons_countsols.c.
References CONSHDLR_NAME, SCIP_CALL, SCIP_DECL_CONSEXITSOL(), SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPblkmem(), SCIPcaptureVar(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPduplicateBlockMemoryArray, SCIPgetNBinVars(), SCIPgetNContVars(), SCIPgetNVars(), SCIPgetVars(), SCIPhashmapCreate(), SCIPhashmapInsert(), SCIPvarGetOrigvarSum(), SCIPvarGetProbindex(), and SCIPvarGetType().
Referenced by SCIP_DECL_CONSEXIT().
|
static |
solving process deinitialization method of constraint handler (called before branch and bound process data is freed)
Definition at line 1631 of file cons_countsols.c.
References CONSHDLR_NAME, SCIP_DECL_CONSENFOLP(), SCIP_INVALIDCALL, SCIP_OKAY, SCIPABORT, SCIPconshdlrGetData(), SCIPconshdlrGetName(), and SCIPerrorMessage.
Referenced by SCIP_DECL_CONSINITSOL().
|
static |
constraint enforcing method of constraint handler for LP solutions
Definition at line 1655 of file cons_countsols.c.
References checkSolution(), SCIP_CALL, SCIP_CUTOFF, SCIP_DECL_CONSENFORELAX(), SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconshdlrGetData(), SCIPcreateLPSol(), SCIPdebugMsg, and SCIPfreeSol().
Referenced by SCIP_DECL_CONSEXITSOL().
|
static |
constraint enforcing method of constraint handler for relaxation solutions
Definition at line 1692 of file cons_countsols.c.
References checkSolution(), SCIP_CALL, SCIP_CUTOFF, SCIP_DECL_CONSENFOPS(), SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconshdlrGetData(), and SCIPdebugMsg.
Referenced by SCIP_DECL_CONSENFOLP().
|
static |
constraint enforcing method of constraint handler for pseudo solutions
Definition at line 1724 of file cons_countsols.c.
References checkSolution(), SCIP_CALL, SCIP_CUTOFF, SCIP_DECL_CONSCHECK(), SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconshdlrGetData(), SCIPcreatePseudoSol(), SCIPdebugMsg, and SCIPfreeSol().
Referenced by SCIP_DECL_CONSENFORELAX().
|
static |
feasibility check method of constraint handler for integral solutions
Definition at line 1763 of file cons_countsols.c.
References SCIP_DECL_CONSLOCK(), SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconshdlrGetData(), SCIPdebugMsg, SCIPwarningMessage(), and TRUE.
Referenced by SCIP_DECL_CONSENFOPS().
|
static |
variable rounding lock method of constraint handler
Definition at line 1793 of file cons_countsols.c.
References SCIP_DECL_DIALOGEXEC(), and SCIP_OKAY.
Referenced by SCIP_DECL_CONSCHECK().
|
static |
comparison method for sorting variables by non-decreasing w.r.t. problem index
Definition at line 2042 of file cons_countsols.c.
References SCIPvarGetProbindex(), and writeExpandedSolutions().
Referenced by SCIP_DECL_DIALOGEXEC().
|
static |
expands the sparse solutions and writes them to the file
scip | SCIP data structure |
file | file handler |
allvars | SCIP variables |
nallvars | number of all variables |
activevars | SCIP variables |
nactivevars | number of active variables |
hashmap | hashmap from active solution variable to the position in the active variables array |
sols | sparse solutions to expands and write |
nsols | number of sparse solutions |
Definition at line 2066 of file cons_countsols.c.
References scalars, SCIP_CALL, SCIP_DECL_DIALOGEXEC(), SCIP_Longint, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPgetProbvarLinearSum(), SCIPhashmapExists(), SCIPhashmapGetImage(), SCIPinfoMessage(), SCIPisIntegral(), SCIPretransformObj(), SCIPsparseSolGetFirstSol(), SCIPsparseSolGetNextSol(), SCIPsparseSolGetNVars(), SCIPvarGetObj(), and TRUE.
Referenced by SCIP_DECL_DIALOGEXEC(), and SCIP_DECL_SORTPTRCOMP().
|
static |
create the interactive shell dialogs for the counting process
scip | SCIP data structure |
Definition at line 2381 of file cons_countsols.c.
References FALSE, SCIP_CALL, SCIP_DECL_DISPOUTPUT(), SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPaddDialogEntry(), SCIPdialogFindEntry(), SCIPdialogHasEntry(), SCIPerrorMessage, SCIPgetRootDialog(), SCIPincludeDialog(), SCIPincludeDialogDefault(), and SCIPreleaseDialog().
Referenced by includeConshdlrCountsols(), and SCIP_DECL_DIALOGEXEC().
|
static |
output method of display column to output file stream 'file'
Definition at line 2448 of file cons_countsols.c.
References CONSHDLR_NAME, DISP_SOLS_NAME, DISP_SOLS_WIDTH, SCIP_Bool, SCIP_Longint, SCIP_OKAY, SCIPconshdlrGetNConss(), SCIPdispGetName(), SCIPdispLongint(), SCIPfindConshdlr(), SCIPgetMessagehdlr(), SCIPgetNCountedSols(), and SCIPinfoMessage().
Referenced by createCountDialog().
|
static |
output method of display column to output file stream 'file'
Definition at line 2483 of file cons_countsols.c.
References CONSHDLR_NAME, DISP_CUTS_NAME, DISP_CUTS_WIDTH, includeConshdlrCountsols(), SCIP_OKAY, SCIPconshdlrGetNConss(), SCIPdispGetName(), SCIPdispLongint(), SCIPfindConshdlr(), SCIPgetMessagehdlr(), and SCIPgetNCountedFeasSubtrees().