52 #define CONSHDLR_NAME "countsols" 53 #define CONSHDLR_DESC "constraint to count feasible solutions" 54 #define CONSHDLR_ENFOPRIORITY -9999999 55 #define CONSHDLR_CHECKPRIORITY -9999999 56 #define CONSHDLR_EAGERFREQ 100 58 #define CONSHDLR_NEEDSCONS FALSE 61 #define DEFAULT_SPARSETEST TRUE 62 #define DEFAULT_DISCARDSOLS TRUE 63 #define DEFAULT_ACTIVE FALSE 64 #define DEFAULT_COLLECT FALSE 65 #define DEFAULT_SOLLIMIT -1LL 68 #define DISP_SOLS_NAME "sols" 69 #define DISP_SOLS_DESC "number of detected feasible solutions" 70 #define DISP_SOLS_HEADER " sols " 71 #define DISP_SOLS_WIDTH 7 72 #define DISP_SOLS_PRIORITY 110000 73 #define DISP_SOLS_POSITION 100000 74 #define DISP_SOLS_STRIPLINE TRUE 76 #define DISP_CUTS_NAME "feasST" 77 #define DISP_CUTS_DESC "number of detected non trivial feasible subtrees" 78 #define DISP_CUTS_HEADER "feasST" 79 #define DISP_CUTS_WIDTH 6 80 #define DISP_CUTS_PRIORITY 110000 81 #define DISP_CUTS_POSITION 110000 82 #define DISP_CUTS_STRIPLINE TRUE 92 #define CUTOFF_CONSTRAINT(x) SCIP_RETCODE x (SCIP* scip, SCIP_SOL* sol, SCIP_CONSHDLRDATA* conshdlrdata) 96 struct SCIP_ConshdlrData
150 assert(newvalue < LONG_MAX);
153 mpz_set_si(*value, (
long) newvalue);
167 assert(0 <= exponent && exponent < LONG_MAX);
170 mpz_ui_pow_ui(*value, 2UL, (
unsigned long) exponent);
172 assert(exponent < 64);
197 mpz_add_ui(*value, *value, 1UL);
212 mpz_add(*value, *value, *summand);
214 (*value) += (*summand);
226 assert(0 <= factor && factor < LONG_MAX);
229 mpz_mul_ui(*value, *value, (
unsigned long) factor);
245 (void) mpz_get_str(*buffer, 10, value);
247 (void)
SCIPsnprintf (*buffer, buffersize,
"%" SCIP_LONGINT_FORMAT
"", value);
261 if( 0 != mpz_fits_sint_p(value) )
264 return mpz_get_si(value);
283 assert( var != NULL );
300 (*conshdlrdata)->feasST = 0;
301 (*conshdlrdata)->nDiscardSols = 0;
302 (*conshdlrdata)->nNonSparseSols = 0;
303 (*conshdlrdata)->solutions = NULL;
304 (*conshdlrdata)->nsolutions = 0;
305 (*conshdlrdata)->ssolutions = 0;
309 (*conshdlrdata)->cutoffSolution = NULL;
310 (*conshdlrdata)->warning =
FALSE;
311 (*conshdlrdata)->hashmap = NULL;
312 (*conshdlrdata)->allvars = NULL;
313 (*conshdlrdata)->vars = NULL;
314 (*conshdlrdata)->nallvars = 0;
315 (*conshdlrdata)->nvars = 0;
316 (*conshdlrdata)->continuous =
FALSE;
335 conshdlrdata->active =
FALSE;
337 SCIPdebugMsg(scip,
"check solution in original space before counting\n");
353 conshdlrdata->active =
TRUE;
356 #define checkSolutionOrig(scip, sol, conshdlrdata) 373 assert( scip != NULL );
381 for( h = 0; h < nheuristics && valid; ++h )
390 "At least one heuristic is not turned off! Heuristic solutions are currently not accepted.\n");
400 SCIPwarningMessage(scip,
"counting forces parameter <presolving/maxrestarts> to 0\n");
428 assert( scip != NULL );
429 assert( sol != NULL );
430 assert( conshdlrdata != NULL );
432 vars = conshdlrdata->vars;
433 nvars = conshdlrdata->nvars;
438 for( v = 0; v < nvars; ++v )
442 assert( var != NULL );
492 assert( scip != NULL );
493 assert( sol != NULL );
494 assert( conshdlrdata != NULL );
496 vars = conshdlrdata->vars;
497 nvars = conshdlrdata->nvars;
499 nconsvars = nvars * 2;
509 for( v = nvars - 1; v >= 0; --v )
524 bounds[nconsvars] = 1;
529 bounds[nconsvars] = 0;
549 bounds[nconsvars] = lb + 1.0;
554 bounds[nconsvars] = ub - 1.0;
559 bounds[nconsvars] = valueInt + 1.0;
560 consvars[nconsvars] = var;
563 bounds[nconsvars] = valueInt - 1.0;
567 consvars[nconsvars] = var;
574 if( nvars == nbinvars )
576 for( v = nbinvars - 1; v >= 0; --v )
591 nconsvars, consvars, boundtypes, bounds,
626 if( conshdlrdata->nsolutions == conshdlrdata->ssolutions )
628 if( conshdlrdata->ssolutions == 0 )
630 conshdlrdata->ssolutions = 100;
635 assert( conshdlrdata->ssolutions < INT_MAX / 2);
636 conshdlrdata->ssolutions *= 2;
640 assert( conshdlrdata->nsolutions < conshdlrdata->ssolutions );
643 nvars = conshdlrdata->nvars;
645 SCIPdebugMsg(scip,
"creating solution number %d\n", conshdlrdata->nsolutions);
649 assert(solution != NULL);
653 assert(ubvalues != NULL);
654 assert(lbvalues != NULL);
656 for( v = nvars - 1; v >= 0; --v )
660 var = conshdlrdata->vars[v];
671 ubvalues[v] = lbvalues[v];
674 SCIPdebugMsg(scip,
"variable <%s> [%" SCIP_LONGINT_FORMAT
",%" SCIP_LONGINT_FORMAT
"]\n",
678 conshdlrdata->solutions[conshdlrdata->nsolutions] = solution;
679 conshdlrdata->nsolutions++;
695 assert( scip != NULL );
696 assert( sol != NULL );
697 assert( conshdlrdata != NULL );
698 assert( result != NULL );
718 SCIPdebugMsg(scip,
"counts number of solutions represented through the given one\n");
748 for( v = 0; v < nvars; ++v )
777 conshdlrdata->feasST++;
779 if( conshdlrdata->collect )
784 addInt(&conshdlrdata->nsols, &newsols);
787 else if(!conshdlrdata->discardsols)
789 SCIP_CALL( conshdlrdata->cutoffSolution(scip, sol, conshdlrdata) );
790 addOne(&conshdlrdata->nsols);
791 conshdlrdata->nNonSparseSols++;
792 if( conshdlrdata->collect )
798 conshdlrdata->nDiscardSols++;
825 SCIPdebugMsg(scip,
"check logicor %d constraints\n", nconss);
827 assert( scip != NULL );
828 assert( conshdlr != NULL );
833 assert( conss != NULL );
838 for( ; c >= 0 && nconss > 0 && (*satisfied); --c )
852 for( v = 0; v < nvars && !fixedone; ++v )
864 (*satisfied) =
FALSE;
900 SCIPdebugMsg(scip,
"check knapsack %d constraints\n", nconss);
902 assert( scip != NULL );
903 assert( conshdlr != NULL );
908 assert( conss != NULL );
913 for( ; c >= 0 && nconss > 0 && (*satisfied); --c )
927 SCIPdebugMsg(scip,
"knapsack capacity = %" SCIP_LONGINT_FORMAT
"\n", capacity);
929 capa = capacity + 0.1;
931 for( v = nvars - 1; v >= 0 && capa >= 0 ; --v )
934 SCIPdebugMsg(scip,
"weight = %" SCIP_LONGINT_FORMAT
" :\n", weights[v]);
938 assert( weights[v] >= 0);
947 else if( weights[v] >= 1 )
960 (*satisfied) =
FALSE;
995 assert( scip != NULL );
996 assert( conshdlr != NULL );
1001 assert( conss != NULL );
1003 (*satisfied) =
TRUE;
1006 for( ; c >= 0 && nconss > 0 && (*satisfied); --c )
1012 satisfiedbound =
FALSE;
1020 for( v = nvars-1; v >= 0 && !satisfiedbound; --v )
1034 if( !satisfiedbound )
1038 (*satisfied) =
FALSE;
1072 SCIPdebugMsg(scip,
"check varbound %d constraints\n", nconss);
1074 assert( scip != NULL );
1075 assert( conshdlr != NULL );
1080 assert( conss != NULL );
1082 (*satisfied) =
TRUE;
1085 for( ; c >= 0 && nconss > 0 && (*satisfied); --c )
1113 (*satisfied) =
FALSE;
1142 SCIPdebugMsg(scip,
"check if the sparse solution is feasible\n");
1144 assert( scip != NULL );
1145 assert( sol != NULL );
1146 assert( feasible != NULL );
1154 assert(conshdlrs != NULL);
1157 for( h = nconshdlrs ; h >= 0 ; --h )
1159 conshdlr = conshdlrs[h];
1160 assert( conshdlr != NULL );
1172 SCIPdebugMsg(scip,
"constraint handler %s has %d active constraint(s)\n",
1180 SCIPdebugMsg(scip,
"a <logicor> constraint cannot be disabled\n");
1189 SCIPdebugMsg(scip,
"a <knapsack> constraint cannot be disabled\n");
1198 SCIPdebugMsg(scip,
"a <bounddisjunction> constraint cannot be disabled\n");
1207 SCIPdebugMsg(scip,
"a <varbound> constraint cannot be disabled\n");
1213 SCIPdebugMsg(scip,
"sparse solution is infeasible since the following constraint (and maybe more) is(/are) enabled\n");
1242 assert( scip != NULL );
1243 assert( sol != NULL );
1244 assert( conshdlrdata != NULL );
1245 assert( result != NULL );
1275 for( v = 0; v < nvars; ++v )
1278 SCIPdebugMsg(scip,
"variables <%s> Local Bounds are [%g,%g] Global Bounds are [%g,%g]\n",
1290 addOne(&conshdlrdata->nsols);
1291 conshdlrdata->nNonSparseSols++;
1293 SCIPdebugMsg(scip,
"-> add one to number of solutions\n");
1295 if( conshdlrdata->collect )
1303 if( conshdlrdata->continuous )
1305 SCIP_CALL( conshdlrdata->cutoffSolution(scip, sol, conshdlrdata) );
1311 else if( conshdlrdata->sparsetest )
1321 if( conshdlrdata->sollimit > -1 && (!valid || conshdlrdata->sollimit <= nsols) )
1350 assert(conshdlrdata != NULL);
1353 if( conshdlrdata->active )
1357 assert(scip != NULL);
1358 assert(conshdlr != NULL);
1370 #define consCopyCountsols NULL 1378 assert(conshdlr != NULL);
1383 assert(conshdlrdata != NULL);
1386 freeInt(&conshdlrdata->nsols);
1388 assert( conshdlrdata->solutions == NULL );
1389 assert( conshdlrdata->nsolutions == 0 );
1390 assert( conshdlrdata->ssolutions == 0 );
1404 assert( conshdlr != NULL );
1408 assert(conshdlrdata != NULL );
1411 conshdlrdata->feasST = 0;
1412 conshdlrdata->nDiscardSols = 0;
1413 conshdlrdata->nNonSparseSols = 0;
1414 setInt(&conshdlrdata->nsols, 0LL);
1416 conshdlrdata->solutions = NULL;
1417 conshdlrdata->nsolutions = 0;
1418 conshdlrdata->ssolutions = 0;
1420 if( conshdlrdata->active )
1438 for( v = 0; v < norigvars; ++v )
1442 assert(nallvars < conshdlrdata->nallvars);
1445 assert(conshdlrdata->allvars[nallvars] != NULL);
1450 if( strncmp(
SCIPvarGetName(conshdlrdata->allvars[nallvars]),
"t_andresultant_", strlen(
"t_andresultant_")) != 0 )
1459 assert(nallvars == conshdlrdata->nallvars);
1476 assert( conshdlr != NULL );
1480 assert(conshdlrdata != NULL );
1483 for( v = conshdlrdata->nvars - 1; v >= 0; --v )
1488 if( conshdlrdata->hashmap != NULL)
1496 conshdlrdata->nvars = 0;
1498 if( conshdlrdata->allvars != NULL )
1501 for( v = 0; v < conshdlrdata->nallvars; ++v )
1503 if( strncmp(
SCIPvarGetName(conshdlrdata->allvars[v]),
"t_andresultant_", strlen(
"t_andresultant_")) != 0 )
1513 conshdlrdata->nallvars = 0;
1516 if( conshdlrdata->nsolutions > 0 )
1518 for( s = conshdlrdata->nsolutions - 1; s >= 0 ; --s )
1524 conshdlrdata->nsolutions = 0;
1525 conshdlrdata->ssolutions = 0;
1527 assert( conshdlrdata->solutions == NULL );
1529 conshdlrdata->continuous =
FALSE;
1531 assert( conshdlrdata->solutions == NULL );
1532 assert( conshdlrdata->nsolutions == 0 );
1533 assert( conshdlrdata->ssolutions == 0 );
1549 assert( conshdlr != NULL );
1553 assert(conshdlrdata != NULL );
1555 if( conshdlrdata->active )
1560 assert(conshdlrdata->nsolutions == 0);
1561 assert(conshdlrdata->solutions == NULL);
1567 for( v = conshdlrdata->nvars - 1; v >= 0; --v )
1581 conshdlrdata->nvars = v + 1;
1587 for( v = conshdlrdata->nvars - 1; v >= 0; --v )
1611 for( v = conshdlrdata->nvars - 1; v >= 0; --v )
1620 conshdlrdata->cutoffSolution = addBinaryCons;
1622 conshdlrdata->cutoffSolution = addIntegerCons;
1634 assert(scip != NULL);
1635 assert(conshdlr != NULL);
1636 assert(nconss == 0);
1640 assert(conshdlrdata != NULL );
1642 if( conshdlrdata->active && restart )
1644 SCIPerrorMessage(
"When collecting and counting solutions restarts need to be disabled (presolving/maxrestarts = 0).\n");
1658 SCIPdebugMsg(scip,
"method SCIP_DECL_CONSENFOLP(consEnfolpCountsols)\n");
1660 assert( scip != NULL );
1661 assert( conshdlr != NULL );
1662 assert( nconss == 0 );
1665 assert( conshdlrdata != NULL );
1667 if( conshdlrdata->active )
1669 if( !solinfeasible )
1695 SCIPdebugMsg(scip,
"method SCIP_DECL_CONSENFORELAX(consEnfolpCountsols)\n");
1697 assert( scip != NULL );
1698 assert( conshdlr != NULL );
1699 assert( nconss == 0 );
1702 assert( conshdlrdata != NULL );
1704 if( conshdlrdata->active )
1706 if( !solinfeasible )
1727 SCIPdebugMsg(scip,
"method SCIP_DECL_CONSENFOPS(consEnfopsCountsols)\n");
1729 assert( scip != NULL );
1730 assert( conshdlr != NULL );
1731 assert( nconss == 0 );
1734 assert( conshdlrdata != NULL );
1737 if( conshdlrdata->active )
1739 if( !solinfeasible )
1768 SCIPdebugMsg(scip,
"method SCIP_DECL_CONSCHECK(consCheckCountsols)\n");
1771 assert( conshdlrdata != NULL );
1773 if( conshdlrdata->active )
1775 if( !conshdlrdata->warning )
1777 SCIPwarningMessage(scip,
"a solution comes in over <SCIP_DECL_CONSCHECK(consCheckCountsols)>; currently these solutions are ignored\n");
1778 conshdlrdata->warning =
TRUE;
1871 int displayprimalbound;
1882 if( nrestarts != 0 )
1887 SCIPwarningMessage(scip,
"counting forces parameter <presolving/maxrestarts> to 0\n");
1925 "Problem contains continuous variables (after presolving). Counting projection to integral variables!\n");
1930 if( displayprimalbound != 0 )
1935 if( displaygap != 0 )
1942 if( displayprimalbound != 2 )
1947 if( displayprimalbound != 2 )
1961 SCIPdialogMessage(scip, NULL,
"Feasible Solutions : %" SCIP_LONGINT_FORMAT
"", nsols);
1971 if( requiredsize > buffersize )
1977 assert( buffersize >= requiredsize );
1988 if( displayprimalbound != 0 )
1992 if( displaygap != 0 )
1998 if( displaysols != 2 )
2002 if( displayfeasST != 2 )
2049 assert(var1 != NULL);
2050 assert(var2 != NULL);
2087 assert(scip != NULL);
2088 assert(file != NULL);
2089 assert(hashmap != NULL);
2090 assert(allvars != NULL || nallvars == 0);
2091 assert(activevars != NULL || nactivevars == 0);
2092 assert(sols != NULL || nsols == 0);
2102 for( s = 0; s < nsols; ++s )
2104 sparsesol = sols[s];
2105 assert(sparsesol != NULL);
2118 SCIPinfoMessage(scip, file,
"%d(%" SCIP_LONGINT_FORMAT
"), ", s+1, solcnt);
2123 for( v = 0; v < nallvars; ++v )
2132 vars[0] = allvars[v];
2138 assert(requiredsize <= nallvars);
2139 assert(nvars <= nactivevars);
2141 realvalue = constant;
2143 for( i = 0; i < nvars; ++i )
2147 assert(0 <= idx && idx < nactivevars);
2148 assert(activevars[idx] == vars[i]);
2151 realvalue +=
scalars[i] * sol[idx];
2185 assert( scip != NULL );
2218 assert( conshdlr != NULL );
2221 assert( conshdlrdata != NULL );
2223 nsparsesols = conshdlrdata->nsolutions;
2237 if( requiredsize > buffersize )
2239 buffersize = requiredsize;
2244 assert( buffersize >= requiredsize );
2245 SCIPdialogMessage(scip, NULL,
"no output, because of too many feasible solutions : %s\n", buffer);
2249 else if( nsols == 0 )
2253 else if( nsparsesols == 0 )
2255 SCIPdialogMessage(scip, NULL,
"there is no solution collect (set parameter <constraints/countsols/collect> to TRUE)\n");
2272 if( filename[0] !=
'\0' )
2274 file = fopen(filename,
"w");
2293 nvars = conshdlrdata->nvars;
2294 sparsesols = conshdlrdata->solutions;
2314 assert(norigvars == conshdlrdata->nallvars);
2326 SCIPdialogMessage(scip, NULL,
"saving %" SCIP_LONGINT_FORMAT
" (%d) feasible solutions\n", nsols, nsparsesols);
2331 for( v = 0; v < norigvars; ++v )
2338 assert(transvar != NULL);
2339 assert(transvar == allvars[v]);
2348 retcode =
writeExpandedSolutions(scip, file, allvars, conshdlrdata->nallvars, conshdlrdata->vars, nvars, conshdlrdata->hashmap, sparsesols, nsparsesols);
2354 SCIPdialogMessage(scip, NULL,
"written solutions information to file <%s>\n", filename);
2393 assert( root != NULL );
2399 "count",
"count number of feasible solutions",
FALSE, NULL) );
2408 "countpresolve",
"presolve instance before counting number of feasible solutions",
FALSE, NULL) );
2419 assert(submenu != NULL);
2425 "allsolutions",
"write all counted primal solutions to file",
FALSE, NULL) );
2436 assert(setmenu != NULL);
2455 assert(disp != NULL);
2457 assert(scip != NULL);
2461 assert( conshdlr != NULL );
2488 assert(disp != NULL);
2489 assert(scip != NULL);
2494 assert( conshdlr != NULL );
2520 char gmpversion[20];
2529 consEnfolpCountsols, consEnfopsCountsols, consCheckCountsols, consLockCountsols,
2532 assert(conshdlr != NULL);
2546 "is the constraint handler active?",
2550 "should the sparse solution test be turned on?",
2554 "is it allowed to discard solutions?",
2558 "should the solutions be collected?",
2562 "counting stops, if the given number of solutions were found (-1: no limit)",
2573 NULL, NULL, NULL, NULL, NULL, NULL, dispOutputSols,
2576 NULL, NULL, NULL, NULL, NULL, NULL, dispOutputFeasSubtrees,
2582 (void)
SCIPsnprintf(gmpversion, (
int)
sizeof(gmpversion),
"MPIR %s", mpir_version);
2586 (void)
SCIPsnprintf(gmpversion, (
int)
sizeof(gmpversion),
"GMP %s", gmp_version);
2649 assert( conshdlr != NULL );
2652 assert( conshdlrdata != NULL );
2671 assert( conshdlr != NULL );
2674 assert( conshdlrdata != NULL );
2680 assert(0 <= (
int) (mpz_sizeinbase( conshdlrdata->nsols, 10 ) + 2));
2681 *requiredsize = (int) (mpz_sizeinbase( conshdlrdata->nsols, 10 ) + 2);
2682 if( *requiredsize <= buffersize)
2683 toString(conshdlrdata->nsols, buffer, buffersize);
2685 if( conshdlrdata->nsols <
pow(10.0, (
double)buffersize) )
2687 toString(conshdlrdata->nsols, buffer, buffersize);
2688 *requiredsize = (int)strlen(*buffer);
2704 assert( scip != NULL );
2708 assert( conshdlr != NULL );
2711 assert( conshdlrdata != NULL );
2713 return conshdlrdata->feasST;
2736 assert( scip != NULL );
2740 assert( conshdlr != NULL );
2743 assert( conshdlrdata != NULL );
2745 *vars = conshdlrdata->vars;
2746 *nvars = conshdlrdata->nvars;
2747 *sols = conshdlrdata->solutions;
2748 *nsols = conshdlrdata->nsolutions;
enum SCIP_Result SCIP_RESULT
static SCIP_RETCODE createCountDialog(SCIP *scip)
enum SCIP_BoundType SCIP_BOUNDTYPE
void SCIPconshdlrSetData(SCIP_CONSHDLR *conshdlr, SCIP_CONSHDLRDATA *conshdlrdata)
#define DISP_SOLS_STRIPLINE
SCIP_RETCODE SCIPincludeDialogDefault(SCIP *scip)
SCIP_Bool SCIPconsIsEnabled(SCIP_CONS *cons)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define CONSHDLR_ENFOPRIORITY
static SCIP_RETCODE checkBounddisjunction(SCIP *scip, SCIP_CONSHDLR *conshdlr, int nconss, SCIP_Bool *satisfied)
void SCIPdialoghdlrClearBuffer(SCIP_DIALOGHDLR *dialoghdlr)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_STAGE SCIPgetStage(SCIP *scip)
#define CONSHDLR_EAGERFREQ
void SCIPsparseSolGetFirstSol(SCIP_SPARSESOL *sparsesol, SCIP_Longint *sol, int nvars)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Constraint handler for variable bound constraints .
void SCIPdialogMessage(SCIP *scip, FILE *file, const char *formatstr,...)
static SCIP_RETCODE checkKnapsack(SCIP *scip, SCIP_CONSHDLR *conshdlr, int nconss, SCIP_Bool *satisfied)
SCIP_RETCODE SCIPaddDialogEntry(SCIP *scip, SCIP_DIALOG *dialog, SCIP_DIALOG *subdialog)
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
#define CUTOFF_CONSTRAINT(x)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPsetConshdlrEnforelax(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSENFORELAX((*consenforelax)))
SCIPInterval pow(const SCIPInterval &x, const SCIPInterval &y)
SCIP_Real * SCIPgetBoundsBounddisjunction(SCIP *scip, SCIP_CONS *cons)
static void addOne(Int *value)
int SCIPgetNOrigVars(SCIP *scip)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
#define SCIP_CALL_FINALLY(x, y)
SCIP_RETCODE SCIPcreateConsSetcover(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)
int SCIPgetNPseudoBranchCands(SCIP *scip)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPdispLongint(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, SCIP_Longint val, int width)
int SCIPconshdlrGetNEnabledConss(SCIP_CONSHDLR *conshdlr)
int SCIPgetNVarsBounddisjunction(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPgetTransformedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **transvar)
SCIP_Bool SCIPsparseSolGetNextSol(SCIP_SPARSESOL *sparsesol, SCIP_Longint *sol, int nvars)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
static void setPowerOfTwo(Int *value, SCIP_Longint exponent)
SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
static SCIP_RETCODE checkParameters(SCIP *scip)
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPcount(SCIP *scip)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
SCIP_RETCODE SCIPaddLongintParam(SCIP *scip, const char *name, const char *desc, SCIP_Longint *valueptr, SCIP_Bool isadvanced, SCIP_Longint defaultvalue, SCIP_Longint minvalue, SCIP_Longint maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
void SCIPgetNCountedSolsstr(SCIP *scip, char **buffer, int buffersize, int *requiredsize)
SCIP_RETCODE SCIPincludeConshdlrBasic(SCIP *scip, SCIP_CONSHDLR **conshdlrptr, const char *name, const char *desc, int enfopriority, int chckpriority, int eagerfreq, SCIP_Bool needscons, SCIP_DECL_CONSENFOLP((*consenfolp)), SCIP_DECL_CONSENFOPS((*consenfops)), SCIP_DECL_CONSCHECK((*conscheck)), SCIP_DECL_CONSLOCK((*conslock)), SCIP_CONSHDLRDATA *conshdlrdata)
static SCIP_DECL_CONSENFORELAX(consEnforelaxCountsols)
#define CONSHDLR_NEEDSCONS
int SCIPsnprintf(char *t, int len, const char *s,...)
enum SCIP_Retcode SCIP_RETCODE
#define CONSHDLR_CHECKPRIORITY
SCIP_RETCODE SCIPaddVarLocks(SCIP *scip, SCIP_VAR *var, int nlocksdown, int nlocksup)
static void multInt(Int *value, SCIP_Longint factor)
static SCIP_DECL_CONSENFOPS(consEnfopsCountsols)
SCIP_HEUR ** SCIPgetHeurs(SCIP *scip)
int SCIPvarGetProbindex(SCIP_VAR *var)
int SCIPdialogFindEntry(SCIP_DIALOG *dialog, const char *entryname, SCIP_DIALOG **subdialog)
SCIP_VAR ** SCIPgetOrigVars(SCIP *scip)
#define consCopyCountsols
static GRAPHNODE ** active
#define SCIPfreeBlockMemory(scip, ptr)
SCIP_VAR ** SCIPgetVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
Constraint handler for AND constraints, .
#define SCIPduplicateBufferArray(scip, ptr, source, num)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_DECL_DIALOGEXEC(SCIPdialogExecCountPresolve)
#define DISP_CUTS_STRIPLINE
SCIP_RETCODE SCIPcreateLPSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
#define SCIPfreeBufferArray(scip, ptr)
Constraint handler for counting feasible solutions.
Constraint handler for the set partitioning / packing / covering constraints .
static void checkSolutionOrig(SCIP *scip, SCIP_SOL *sol, SCIP_CONSHDLRDATA *conshdlrdata)
#define SCIPallocBlockMemory(scip, ptr)
#define SCIPdebugPrintCons(x, y, z)
#define DISP_CUTS_PRIORITY
static SCIP_RETCODE conshdlrdataCreate(SCIP *scip, SCIP_CONSHDLRDATA **conshdlrdata)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
static SCIP_DECL_CONSFREE(consFreeCountsols)
static SCIP_DECL_CONSEXIT(consExitCountsols)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
int SCIPgetNContVars(SCIP *scip)
void SCIPgetCountedSparseSols(SCIP *scip, SCIP_VAR ***vars, int *nvars, SCIP_SPARSESOL ***sols, int *nsols)
int SCIPgetNConshdlrs(SCIP *scip)
SCIP_Longint SCIPgetNCountedSols(SCIP *scip, SCIP_Bool *valid)
static void freeInt(Int *value)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
static SCIP_DECL_CONSHDLRCOPY(conshdlrCopyCountsols)
SCIP_DIALOG * SCIPgetRootDialog(SCIP *scip)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
static SCIP_DECL_CONSINITSOL(consInitsolCountsols)
SCIP_RETCODE SCIPsetConshdlrInitsol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITSOL((*consinitsol)))
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
SCIP_RETCODE SCIPincludeDialog(SCIP *scip, SCIP_DIALOG **dialog, SCIP_DECL_DIALOGCOPY((*dialogcopy)), SCIP_DECL_DIALOGEXEC((*dialogexec)), SCIP_DECL_DIALOGDESC((*dialogdesc)), SCIP_DECL_DIALOGFREE((*dialogfree)), const char *name, const char *desc, SCIP_Bool issubmenu, SCIP_DIALOGDATA *dialogdata)
Constraint handler for knapsack constraints of the form , x binary and .
static SCIP_DECL_CONSENFOLP(consEnfolpCountsols)
SCIP_VAR * SCIPgetVarVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPsolve(SCIP *scip)
SCIP_RETCODE SCIPsetConshdlrCopy(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), SCIP_DECL_CONSCOPY((*conscopy)))
#define DISP_SOLS_POSITION
SCIP_Longint * SCIPsparseSolGetLbs(SCIP_SPARSESOL *sparsesol)
SCIP_VAR ** SCIPgetVarsBounddisjunction(SCIP *scip, SCIP_CONS *cons)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_Bool SCIPisParamFixed(SCIP *scip, const char *name)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
SCIP_CONSHDLR ** SCIPgetConshdlrs(SCIP *scip)
SCIP_Real SCIPgetRhsVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPdelConsLocal(SCIP *scip, SCIP_CONS *cons)
Constraint handler for logicor constraints (equivalent to set covering, but algorithms are suited fo...
SCIP_Real SCIPgetVbdcoefVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
SCIP_RETCODE SCIPpresolve(SCIP *scip)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_RETCODE SCIPcheckSolOrig(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *feasible, SCIP_Bool printreason, SCIP_Bool completely)
SCIP_VAR ** SCIPgetVarsLogicor(SCIP *scip, SCIP_CONS *cons)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_RETCODE SCIPsetConshdlrFree(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSFREE((*consfree)))
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
static SCIP_RETCODE checkLogicor(SCIP *scip, SCIP_CONSHDLR *conshdlr, int nconss, SCIP_Bool *satisfied)
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
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_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
void SCIPsortDownPtrPtr(void **ptrarray1, void **ptrarray2, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
static SCIP_Bool varIsUnfixedLocal(SCIP_VAR *var)
int SCIPheurGetFreq(SCIP_HEUR *heur)
SCIP_RETCODE SCIPgetIntParam(SCIP *scip, const char *name, int *value)
SCIP_RETCODE SCIPunfixParam(SCIP *scip, const char *name)
SCIP_VAR * SCIPgetVbdvarVarbound(SCIP *scip, SCIP_CONS *cons)
static void toString(Int value, char **buffer, int buffersize)
SCIP_RETCODE SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize, SCIP_Bool mergemultiples)
SCIP_RETCODE SCIPsetEmphasis(SCIP *scip, SCIP_PARAMEMPHASIS paramemphasis, SCIP_Bool quiet)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
SCIP_RETCODE SCIPincludeConshdlrCountsols(SCIP *scip)
static SCIP_DECL_CONSLOCK(consLockCountsols)
static SCIP_DECL_CONSCHECK(consCheckCountsols)
SCIP_RETCODE SCIPgetPseudoBranchCands(SCIP *scip, SCIP_VAR ***pseudocands, int *npseudocands, int *npriopseudocands)
SCIP_BOUNDTYPE * SCIPgetBoundtypesBounddisjunction(SCIP *scip, SCIP_CONS *cons)
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
SCIP_Longint SCIPgetCapacityKnapsack(SCIP *scip, SCIP_CONS *cons)
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_RETCODE SCIPincludeDisp(SCIP *scip, const char *name, const char *desc, const char *header, SCIP_DISPSTATUS dispstatus, SCIP_DECL_DISPCOPY((*dispcopy)), SCIP_DECL_DISPFREE((*dispfree)), SCIP_DECL_DISPINIT((*dispinit)), SCIP_DECL_DISPEXIT((*dispexit)), SCIP_DECL_DISPINITSOL((*dispinitsol)), SCIP_DECL_DISPEXITSOL((*dispexitsol)), SCIP_DECL_DISPOUTPUT((*dispoutput)), SCIP_DISPDATA *dispdata, int width, int priority, int position, SCIP_Bool stripline)
static void setInt(Int *value, SCIP_Longint newvalue)
SCIP_Longint * SCIPsparseSolGetUbs(SCIP_SPARSESOL *sparsesol)
SCIP_Longint SCIPgetNCountedFeasSubtrees(SCIP *scip)
SCIP_RETCODE SCIPsparseSolCreate(SCIP_SPARSESOL **sparsesol, SCIP_VAR **vars, int nvars, SCIP_Bool cleared)
SCIP_Bool SCIPdialogHasEntry(SCIP_DIALOG *dialog, const char *entryname)
static SCIP_RETCODE includeConshdlrCountsols(SCIP *scip, SCIP_Bool dialogs)
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
#define SCIPreallocMemoryArray(scip, ptr, newnum)
SCIP_RETCODE SCIPdialoghdlrGetWord(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *prompt, char **inputword, SCIP_Bool *endoffile)
#define SCIPallocMemoryArray(scip, ptr, num)
static SCIP_DECL_SORTPTRCOMP(varCompProbindex)
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
SCIP_Longint SCIPconvertRealToLongint(SCIP *scip, SCIP_Real real)
SCIP_RETCODE SCIPdialoghdlrAddHistory(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *command, SCIP_Bool escapecommand)
SCIP_RETCODE SCIPcreatePseudoSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
int SCIPgetNBinVars(SCIP *scip)
int SCIPconshdlrGetNActiveConss(SCIP_CONSHDLR *conshdlr)
int SCIPgetNVars(SCIP *scip)
#define DEFAULT_DISCARDSOLS
int SCIPsparseSolGetNVars(SCIP_SPARSESOL *sparsesol)
int SCIPgetNHeurs(SCIP *scip)
static void addInt(Int *value, Int *summand)
SCIP_DIALOG * SCIPdialoghdlrGetRoot(SCIP_DIALOGHDLR *dialoghdlr)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
static const SCIP_Real scalars[]
SCIP_RETCODE SCIPsetConshdlrInit(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINIT((*consinit)))
SCIP_RETCODE SCIPsetConshdlrExit(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXIT((*consexit)))
static SCIP_DECL_CONSEXITSOL(consExitsolCountsols)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_Real SCIPretransformObj(SCIP *scip, SCIP_Real obj)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
default user interface dialog
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
#define DISP_CUTS_POSITION
static SCIP_DECL_CONSINIT(consInitCountsols)
int SCIPgetNVarsKnapsack(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE countSparseSol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool feasible, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_RESULT *result)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_RETCODE SCIPreleaseDialog(SCIP *scip, SCIP_DIALOG **dialog)
SCIP_RETCODE SCIPcreateConsBounddisjunction(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_BOUNDTYPE *boundtypes, SCIP_Real *bounds, 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 SCIPincludeExternalCodeInformation(SCIP *scip, const char *name, const char *description)
static SCIP_RETCODE collectSolution(SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_SOL *sol)
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPinterruptSolve(SCIP *scip)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
static SCIP_RETCODE checkVarbound(SCIP *scip, SCIP_CONSHDLR *conshdlr, int nconss, SCIP_Bool *satisfied)
static void allocInt(Int *value)
void SCIPprintError(SCIP_RETCODE retcode)
constraint handler for bound disjunction constraints
SCIP_Longint * SCIPgetWeightsKnapsack(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPsetConshdlrExitsol(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXITSOL((*consexitsol)))
#define SCIPfreeMemoryArrayNull(scip, ptr)
SCIP_Real SCIPgetLhsVarbound(SCIP *scip, SCIP_CONS *cons)
const char * SCIPdispGetName(SCIP_DISP *disp)
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
#define DISP_SOLS_PRIORITY
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
static SCIP_RETCODE checkSolution(SCIP *scip, SCIP_SOL *sol, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_RESULT *result)
static SCIP_DECL_DISPOUTPUT(dispOutputSols)
SCIP_RETCODE SCIPprintVar(SCIP *scip, SCIP_VAR *var, FILE *file)
SCIP_RETCODE SCIPgetNegatedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **negvar)
void SCIPsparseSolFree(SCIP_SPARSESOL **sparsesol)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPsetParamsCountsols(SCIP *scip)
static SCIP_Longint getNCountedSols(Int value, SCIP_Bool *valid)
#define SCIPreallocBufferArray(scip, ptr, num)
#define DEFAULT_SPARSETEST
static SCIP_RETCODE checkFeasSubtree(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *feasible)