All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cons_countsols.c
Go to the documentation of this file.
21 * If this constraint handler is activated than it counts or collects all feasible solutions. We refer to \ref COUNTER for
24 * @todo In the last round of presolving we should check if variables exist, which have up and down lock one. In that
25 * case we know that these locks are coming from this constraint handler. Therefore, they are totally free and can
26 * be ignored in the branch and bound process. To get this result we have to store these variables in the
27 * constraint handler data structure (to remember this free dimensions) and fix them to any feasible value.
30 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
54 #define CONSHDLR_ENFOPRIORITY -9999999 /**< priority of the constraint handler for constraint enforcing */
55 #define CONSHDLR_CHECKPRIORITY -9999999 /**< priority of the constraint handler for checking feasibility */
56 #define CONSHDLR_EAGERFREQ 100 /**< frequency for using all instead of only the useful constraints in separation,
58 #define CONSHDLR_NEEDSCONS FALSE /**< should the constraint handler be skipped, if no constraints are available? */
65 #define DEFAULT_SOLLIMIT -1LL /**< counting stops, if the given number of solutions were found (-1: no limit) */
92 #define CUTOFF_CONSTRAINT(x) SCIP_RETCODE x (SCIP* scip, SCIP_SOL* sol, SCIP_CONSHDLRDATA* conshdlrdata)
109 SCIP_Longint sollimit; /**< counting stops, if the given number of solutions were found (-1: no limit) */
118 SCIP_HASHMAP* hashmap; /**< hashmap to store position of active transformed problem variable in our vars array */
397 /* need to disabled restarts, since collecting solutions won't work but also the captures for variables are not
412 /** creates and adds a constraints which cuts off the current solution from the feasibility region in the case there are
457 SCIP_CALL( SCIPcreateConsSetcover(scip, &cons, "Setcovering created by countsols", nvars, consvars,
471 /** creates and adds a bound disjunction constraints which cuts off the current solution from the feasibility region; if
472 * only binary variables are involved, then a set covering constraint is created which is a special case of a bound
585 SCIP_CALL( SCIPcreateConsSetcover(scip, &cons, "Setcovering created by countsols", nbinvars, consvars,
696 /* the result should be infeasible since we reject any solution; however, if the solution passes the sparse test the
748 /* get original variable to decide if we will count the domain; continuous variables aren't counted */
764 /* the number of integers laying in the interval [lb,ub] is (ub - lb + 1); to make everything integral we
1107 SCIPdebugMessage("<%s> lb: %.15g\t ub: %.15g\n", SCIPvarGetName(var), SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var));
1108 SCIPdebugMessage("<%s> lb: %.15g\t ub: %.15g\n", SCIPvarGetName(vbdvar), SCIPvarGetLbLocal(vbdvar), SCIPvarGetUbLocal(vbdvar));
1209 SCIPdebugMessage("sparse solution is infeasible since the following constraint (and maybe more) is(/are) enabled\n");
1243 /* the solution should not be found through a heuristic since in this case the informations of SCIP are not valid for
1247 /**@todo it might be not necessary to check this assert since we can check in general all solutions of feasibility
1248 * independently of the origin; however, the locally fixed technique does only work if the solution comes from
1249 * the branch and bound tree; in case the solution comes from a heuristic we should try to sequentially fix the
1250 * variables in the branch and bound tree and check after every fixing if all constraints are disabled; at the
1256 /* setting result to infeasible since we reject any solution; however, if the solution passes the sparse test or is
1257 * completely fixed the result is set to SCIP_CUTOFF which cuts off the subtree initialized through the current node
1275 SCIPvarGetName(var), SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var), SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var));
1296 /* in case of continuous variables are present we explicitly cutoff the integer assignment since in case of
1323 SCIPdebugMessage("result is %s\n", *result == SCIP_INFEASIBLE ? "SCIP_INFEASIBLE" : "SCIP_CUTOFF" );
1368 /** destructor of constraint handler to free constraint handler data (called when SCIP is exiting) */
1446 if( strncmp(SCIPvarGetName(conshdlrdata->allvars[nallvars]), "t_andresultant_", strlen("t_andresultant_")) != 0 )
1464 /** deinitialization method of constraint handler (called before transformed problem is freed) */
1499 if( strncmp(SCIPvarGetName(conshdlrdata->allvars[v]), "t_andresultant_", strlen("t_andresultant_")) != 0 )
1535 /** solving process initialization method of constraint handler (called when branch and bound process is about to begin)
1537 * This method is called when the presolving was finished and the branch and bound process is about to begin.
1571 /* get original variable to decide if we will count the domain; continuous variables aren't counted */
1579 /* @todo we need to forbid variable downgrading, from integer type to implicit integer type, e.g. done in
1591 /* get original variable to decide if we will count the domain; continuous variables aren't counted */
1601 /* store mapping from all active variables to their position afetr presolving because during solving new variables
1604 SCIP_CALL( SCIPhashmapCreate(&(conshdlrdata->hashmap), SCIPblkmem(scip), 5 * conshdlrdata->nvars + 1) );
1610 SCIP_CALL( SCIPhashmapInsert(conshdlrdata->hashmap, conshdlrdata->vars[v], (void*) (size_t)(v+1)) );
1624 /** solving process deinitialization method of constraint handler (called before branch and bound process data is freed) */
1640 SCIPerrorMessage("When collecting and counting solutions restarts need to be disabled (presolving/maxrestarts = 0).\n");
1742 SCIPwarningMessage(scip, "a solution comes in over <SCIP_DECL_CONSCHECK(consCheckCountsols)>; currently these solutions are ignored\n");
1849 /* need to disabled restarts, since collecting solutions won't work but also the captures for variables are not
1890 "Problem contains continuous variables (after presolving). Counting projection to integral variables!\n");
1948 SCIPdialogMessage(scip, NULL, " (%d non-trivial feasible subtrees)\n", SCIPgetNCountedFeasSubtrees(scip));
2037 SCIP_HASHMAP* hashmap, /**< hashmap from active solution variable to the position in the active
2102 SCIP_CALL( SCIPgetProbvarLinearSum(scip, vars, scalars, &nvars, nallvars, &constant, &requiredsize, TRUE) );
2210 SCIPdialogMessage(scip, NULL, "no output, because of too many feasible solutions : %s\n", buffer);
2220 SCIPdialogMessage(scip, NULL, "there is no solution collect (set parameter <constraints/countsols/collect> to TRUE)\n");
2288 /* sort original variables array and the corresponding transformed variables w.r.t. the problem index */
2291 SCIPdialogMessage(scip, NULL, "saving %"SCIP_LONGINT_FORMAT" (%d) feasible solutions\n", nsols, nsparsesols);
2313 retcode = writeExpandedSolutions(scip, file, allvars, conshdlrdata->nallvars, conshdlrdata->vars, nvars, conshdlrdata->hashmap, sparsesols, nsparsesols);
2373 "countpresolve", "presolve instance before counting number of feasible solutions", FALSE, NULL) );
2463 SCIPdispLongint(SCIPgetMessagehdlr(scip), file, SCIPgetNCountedFeasSubtrees(scip), DISP_CUTS_WIDTH);
2536 SCIP_CALL( SCIPincludeDisp(scip, DISP_SOLS_NAME, DISP_SOLS_DESC, DISP_SOLS_HEADER, SCIP_DISPSTATUS_OFF,
2539 SCIP_CALL( SCIPincludeDisp(scip, DISP_CUTS_NAME, DISP_CUTS_DESC, DISP_CUTS_HEADER, SCIP_DISPSTATUS_OFF,
2547 SCIP_CALL( SCIPincludeExternalCodeInformation(scip, gmpversion, "Multiple Precision Integers and Rationals Library developed by W. Hart (mpir.org)") );
2551 SCIP_CALL( SCIPincludeExternalCodeInformation(scip, gmpversion, "GNU Multiple Precision Arithmetic Library developed by T. Granlund (gmplib.org)") );
2600 /** returns number of feasible solutions found as SCIP_Longint; if the number does not fit into
2641 /* size must be by two larger than the length of the string, since there need to be storage for a sign and a
2683 * @note You get the pointer to the sparse solutions stored in the constraint handler (not a copy).
2685 * @note The sparse solutions are stored w.r.t. the active variables. This are the variables which got not removed
|