All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sepa_clique.c
Go to the documentation of this file.
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
38 #define SEPA_DELAY FALSE /**< should separation method be delayed, if other separators found cuts? */
41 #define DEFAULT_MAXTREENODES 10000 /**< maximal number of nodes in branch and bound tree (-1: no limit) */
42 #define DEFAULT_BACKTRACKFREQ 1000 /**< frequency for premature backtracking up to tree level 1 (0: no backtracking) */
43 #define DEFAULT_MAXSEPACUTS 10 /**< maximal number of clique cuts separated per separation round (-1: no limit) */
44 #define DEFAULT_MAXZEROEXTENSIONS 1000 /**< maximal number of zero-valued variables extending the clique (-1: no limit) */
46 #define DEFAULT_CLIQUEDENSITY 0.05 /**< minimal density of cliques to use a dense clique table */
60 SCIP_Real* varsolvals; /**< LP solution of binary variables (contained in a 3-clique in implgraph) */
64 int backtrackfreq; /**< frequency for premature backtracking up to tree level 1 (0: no backtracking) */
65 int maxsepacuts; /**< maximal number of clique cuts separated per separation round (-1: no limit) */
66 int maxzeroextensions; /**< maximal number of zero-valued variables extending the clique (-1: no limit) */
70 SCIP_Bool tcliquegraphloaded; /**< TRUE if tcliquegraph is already loaded (tcliquegraph can be NULL),
196 SCIP_CALL( SCIPreallocMemoryArray(scip, &tcliquegraph->cliqueids, tcliquegraph->cliqueidssize) );
203 /** adds a node to the tclique graph defined as a variable-value pair; adds all cliques to the cliqueids array the
275 /** adds all variable/value pairs to the tclique graph that are contained in an existing 3-clique */
310 SCIP_CALL( tcliquegraphAddNode(scip, tcliquegraph, var, (SCIP_Bool)value, &cliquegraphidx[value][i]) );
318 /** adds all variable/value pairs to the tclique graph that are contained in a 3-clique in the implication graph */
335 /**@todo search for 3-clique in the implication graph w.r.t. to implicit binary variable (SCIPvarIsBinary()) */
345 /* detect 3-cliques in the clique graph: triples (x,y,z) in the implication graph with x -> y', x -> z', and y -> z';
346 * in order to avoid double checks, we only check triplets with variable indices xindex < yindex < zindex;
347 * we don't have to check triples with x == y, x == z, or y == z, because cliques with the same variable occuring
348 * twice lead to fixings of this or all other variables which should already have been detected in presolving
350 for( xi = 0; xi < nvars-2 && !SCIPisStopped(scip); ++xi ) /* at least two variables must be left over for y and z */
371 /**@todo search for 3-clique in the implication graph w.r.t. to implicit binary variable (SCIPvarIsBinary()) */
396 for( ; i < xnbinimpls-1 && !SCIPisStopped(scip); ++i ) /* at least one variable must be left over for z */
428 /**@todo search for 3-clique in the implication graph w.r.t. to implicit binary variable (SCIPvarIsBinary()) */
429 /* scan the remaining implications of x == xvalue and the implications of y == yvalue for equal entries */
512 SCIP_CALL( tcliquegraphAddNode(scip, tcliquegraph, x, (SCIP_Bool)xvalue, &cliquegraphidx[xvalue][xi]) );
516 SCIP_CALL( tcliquegraphAddNode(scip, tcliquegraph, y, (SCIP_Bool)yvalue, &cliquegraphidx[yvalue][yi]) );
520 SCIP_CALL( tcliquegraphAddNode(scip, tcliquegraph, z, (SCIP_Bool)zvalue, &cliquegraphidx[zvalue][zi]) );
535 /** adds all variable/value pairs to the tclique graph that have implications to two variables of the same existing clique */
552 /**@todo search for 3-clique in the implication graph w.r.t. to implicit binary variable (SCIPvarIsBinary()) */
558 /* detect triples (x,y,z) with implications x -> y' and x -> z' and a clique that contains y and z;
559 * because all cliques stored in the clique table are at least 3-cliques, y and z are already member of the
560 * tclique graph due to tcliquegraphAddCliqueVars(); therefore, we only have to process pairs x == xvalue
581 /**@todo search for 3-clique in the implication graph w.r.t. to implicit binary variable (SCIPvarIsBinary()) */
631 * (the ones in the implication graph have already been processed by tcliquegraphAddImplicsVars())
639 SCIP_CALL( tcliquegraphAddNode(scip, tcliquegraph, x, (SCIP_Bool)xvalue, &cliquegraphidx[xvalue][xi]) );
698 /**@todo search for 3-clique in the implication graph w.r.t. to implicit binary variable (SCIPvarIsBinary()) */
775 tcliquegraph->tablewidth = (tcliquegraph->nnodes + nbits-1) / nbits; /* number of ints needed */
778 if( (SCIP_Real)tcliquegraph->nnodes * (SCIP_Real)tcliquegraph->tablewidth/1024.0 > cliquetablemem )
791 SCIPdebugMessage("clique separator: constructing dense clique table (%d kb, %d cliques, %d nodes, density: %.2f)\n",
812 #if 0 /**@todo this assert is currently not valid since implicit binary variables in cliques are ignored,
813 * i.e., corresponding nodes and edges are not added to the tclique graph. Enable assert again if
828 assert(var != NULL); /* var must exist even if negated, since it is stored in the tcliquegraph */
908 /* insert all variable/value pairs that have implications to two variables of the same existing clique */
914 /* it occurs that it might be that some cliques were not yet removed from the global clique array, so SCIPgetNClique
920 SCIP_CALL( tcliquegraphConstructCliqueTable(scip, sepadata->tcliquegraph, sepadata->cliquetablemem, sepadata->cliquedensity) );
1006 == ((tcliquegraph->cliquetable[node2*tcliquegraph->tablewidth + node1/nbits] & (1 << (node1 % nbits))) != 0)); /*lint !e701*/
1053 /* check if node2 is contained in adjacency list of node1 (list is ordered by adjacent nodes) */
1094 /* check for each node in given nodes set, if it is adjacent to the given node or shares a common clique */
1100 /* check if the node is adjacent to the given node (nodes and adjacent nodes are ordered by node index) */
1149 (void) SCIPsnprintf(cutname, SCIP_MAXSTRLEN, "clique%"SCIP_LONGINT_FORMAT"_%d", sepadata->ncalls, sepadata->ncuts);
1150 SCIP_CALL( SCIPcreateEmptyRowSepa(scip, &cut, sepa, cutname, -SCIPinfinity(scip), 1.0, FALSE, FALSE, TRUE) );
1198 /* we don't accept the solution as new incumbent, because we want to find many violated clique inequalities */
1246 /* if we found more than half the cuts we are allowed to generate, we accept the clique as new incumbent,
1260 /* in case an internal SCIP error occurred we stop the algorithm and store the error code for later
1305 /* if we already detected that no implications between binary variables exist, nothing has to be done */
1324 /* we did not find any variables that are contained in a clique with at least 3 variables in the
1340 SCIP_CALL( SCIPgetSolVals(scip, sol, tcliquegraph->nnodes, tcliquegraph->vars, sepadata->varsolvals) );
1345 maxzeroextensions = (sepadata->maxzeroextensions == -1 ? INT_MAX : sepadata->maxzeroextensions);
1353 tcliqueMaxClique(tcliqueGetnnodesClique, tcliqueGetweightsClique, tcliqueIsedgeClique, tcliqueSelectadjnodesClique,
1355 cliquenodes, &ncliquenodes, &cliqueweight, (int)sepadata->scaleval-1, (int)sepadata->scaleval+1,
1358 /* in case an internal error occurred during the maximal clique computation, evaluate that one */
1416 /** solving process deinitialization method of separator (called before branch and bound process data is freed) */
1502 SCIP_CALL( SCIPincludeSepaBasic(scip, &sepa, SEPA_NAME, SEPA_DESC, SEPA_PRIORITY, SEPA_FREQ, SEPA_MAXBOUNDDIST,
1539 &sepadata->cliquetablemem, TRUE, DEFAULT_CLIQUETABLEMEM, 0.0, (SCIP_Real)INT_MAX/1024.0, NULL, NULL) );
|