SCIP Doxygen Documentation
Loading...
Searching...
No Matches
cons_storeGraph.c
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* SCIP --- Solving Constraint Integer Programs */
5/* */
6/* Copyright (c) 2002-2026 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file cons_storeGraph.c
26 * @brief constraint handler for storing the graph at each node of the tree
27 * @author Gerald Gamrath
28 *
29 * This file implements the constraints that are used for the branching in the coloring algorithm.
30 *
31 * For each node in the branch-and-bound tree, a constraint of this type is created, which stores
32 * all restrictions related to that branch-and-bound node.
33 *
34 * First of all, it stores the type of the constraint ("same" or "differ", the root has type root)
35 * and the two nodes in the graph on which this restriction is applied. When the branch-and-bound
36 * node corresponding to the constraint is examined for the first time, the constraint creates a
37 * graph that takes into account all the restrictions, which are active at this node.
38 * At the root, this is the original (preprocessed) graph. At any other branch-and-bound node, it
39 * takes the graph of the constraint related to the branch-and-bound parent node of the current node and
40 * modifies it so that all restrictions up to this node are respected. Since the graph in the
41 * branch-and-bound parent respects all restrictions on the path to that node, only the last
42 * requirement, the one saved at the current branch-and-bound node, must be added.
43 * This is done as follows: Adding a DIFFER(v,w) constraint is easy, since it suffices to add
44 * an edge between v and w. For a SAME(v,w) constraint, the original idea is to collapse the nodes v
45 * and w into one single vertex. Since this is not possible in the tclique-graph data structure, we
46 * introduce new edges in the graph, so that v and w have the same neighborhood. Hence, in the
47 * pricing routine, each new stable set will either contain both nodes or none of them, since we
48 * create (inclusion-) maximal sets.
49 *
50 * This does of course not hold for sets created in a higher level of the branch-and-bound tree or
51 * in another subtree. In order to forbid all of these sets, which do not fulfill the current
52 * restrictions, a propagation is started when the node is entered the first time and repeated
53 * later, if the node is reentered after the creation of new variables in another subtree. The
54 * propagation simply fixes all variables to 0 which represent a stable set that does not
55 * fulfill the restriction at the current node.
56 *
57 * The information about all fusions of nodes (caused by the SAME() operation) is stored, so that the nodes
58 * constituting a union can be accessed easily. Each union has a representative and a set of nodes, whereas
59 * each node knows the representative of the union it belongs to. At the beginning, each node forms its own
60 * union and therefore each node also represents this union, consisting of only this node. Later on, some
61 * nodes represent unions of several nodes, while other nodes are part of a union which they do not represent,
62 * so they have another node as representative. The representatives of the nodes are returned by the methods
63 * COLORconsGetRepresentative() / COLORconsGetRepresentatives(), the union represented by a node is returned
64 * by COLORconsGetUnion(), the array of unions, indexed by the representing node, is returned by
65 * COLORconsGetUnions().
66 */
67
68#include "scip/type_cons.h"
69#include "cons_storeGraph.h"
70#include "probdata_coloring.h"
71#include "tclique/tclique.h"
72#include "reader_col.h"
73#include "scip/cons_linear.h"
74
75
76/* constraint handler properties */
77#define CONSHDLR_NAME "storeGraph"
78#define CONSHDLR_DESC "storing graph at nodes of the tree constraint handler"
79#define CONSHDLR_ENFOPRIORITY 0 /**< priority of the constraint handler for constraint enforcing */
80#define CONSHDLR_CHECKPRIORITY 2000000 /**< priority of the constraint handler for checking feasibility */
81#define CONSHDLR_PROPFREQ 1 /**< frequency for propagating domains; zero means only preprocessing propagation */
82#define CONSHDLR_EAGERFREQ 100 /**< frequency for using all instead of only the useful constraints in separation,
83 * propagation and enforcement, -1 for no eager evaluations, 0 for first only */
84#define CONSHDLR_DELAYPROP FALSE /**< should propagation method be delayed, if other propagators found reductions? */
85#define CONSHDLR_NEEDSCONS TRUE /**< should the constraint handler be skipped, if no constraints are available? */
86
87#define CONSHDLR_PROP_TIMING SCIP_PROPTIMING_BEFORELP
88
89
90/** constraint data for storing graph constraints */
91struct SCIP_ConsData
92{
93 TCLIQUE_GRAPH* graph; /* the current graph in the B&B-node belonging to this constraint */
94 TCLIQUE_GRAPH* cgraph; /* the complementary graph of the current graph */
95 SCIP_CONS* fathercons; /* the constraint sticking at the B&B-node's father */
96 int* representativeofnode; /* r...[i] = j if node j is representative of the union containing node i */
97 int** unionofnode; /* for all represantatives of a union an array with all the union's members */
98 int* nnodesinunion; /* value at position i = #elements in unionofnode[i] */
99 int node1; /* first node for DIFFER / SAME */
100 int node2; /* second node for DIFFER / SAME */
101 COLOR_CONSTYPE type; /* type of the branching operation: COLOR_CONSTYPE_DIFFER oder COLOR_CONSTYPE_SAME */
102 int propagatedvars; /* number of Vars that existed, the last time, the related node was propagated,
103 used to determine whether the constraint should be repropagated*/
104 SCIP_Bool created; /* flag for saving the creation status of the graph saved in the cons,
105 at the beginning false, after the first activation set to true */
106 SCIP_NODE* stickingatnode; /* the node in the B&B-tree at which the cons is sticking */
107};
108
109
110/** constraint handler data */
111struct SCIP_ConshdlrData
112{
113 SCIP_CONS** stack; /**< stack for storing active constraints */
114 int nstack; /**< number of elements on the stack */
115 int maxstacksize; /**< maximum size of the stack */
116};
117
118
119/*
120 * Local methods
121 */
122
123/** creates and captures the storeGraph constraint for the root node*/
124static
126 SCIP* scip, /**< SCIP data structure */
127 SCIP_CONS** cons, /**< pointer to hold the created constraint */
128 const char* name, /**< name of constraint */
129 TCLIQUE_GRAPH* graph /**< the original graph */
130 )
131{
132 SCIP_CONSHDLR* conshdlr;
133 SCIP_CONSDATA* consdata;
134 int i;
135 int nnodes;
136
137 assert(scip != NULL);
138 assert(graph != NULL);
139 nnodes = tcliqueGetNNodes(graph);
140 /* find the storeGraph constraint handler */
142 if ( conshdlr == NULL )
143 {
144 SCIPerrorMessage("storeGraph constraint handler not found\n");
145 return SCIP_PLUGINNOTFOUND;
146 }
147
148 SCIPdebugMessage("Creating graph storage constraint at root node.\n");
149
150 /* create constraint data */
151 SCIP_CALL( SCIPallocBlockMemory(scip, &consdata) );
152 consdata->graph = graph;
153 consdata->node1 = -1;
154 consdata->node2 = -1;
155 consdata->type = COLOR_CONSTYPE_ROOT;
156 consdata->fathercons = NULL;
157 consdata->propagatedvars = 0;
158 consdata->stickingatnode = NULL;
159 consdata->created = TRUE;
160
161 /* allocate memory for the arrays and fill them */
162 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(consdata->representativeofnode), nnodes) );
163 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(consdata->nnodesinunion), nnodes) );
164 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(consdata->unionofnode), nnodes) );
165 for ( i = 0; i < nnodes; i++ )
166 {
167 consdata->representativeofnode[i] = i;
168 consdata->nnodesinunion[i] = 1;
169 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(consdata->unionofnode[i]), 1) ); /*lint !e866*/
170 consdata->unionofnode[i][0] = i;
171 }
172
173 /* create the complementary graph */
174 if( !tcliqueCreate(&(consdata->cgraph)) )
175 {
176 SCIPerrorMessage("could not flush the clique graph\n");
177 return SCIP_ERROR;
178 }
179
180 assert(consdata->cgraph != NULL);
181
182 SCIP_CALL( COLORprobGetComplementaryGraph(scip, graph, consdata->cgraph) );
183
184 /* create constraint */
185 SCIP_CALL( SCIPcreateCons(scip, cons, name, conshdlr, consdata, FALSE, FALSE, FALSE, FALSE, FALSE,
186 TRUE, FALSE, TRUE, FALSE, FALSE));
187
188 return SCIP_OKAY;
189}
190
191
192/*
193 * Callback methods
194 */
195
196#ifdef SCIP_DISABLED_CODE
197/** copy method for constraint handler plugins (called when SCIP copies plugins) */
198/** We do not want to copy store graph constraints into subSCIPs since they just store information about
199 * branching decisions and are used to enforce those.
200 * However, in subSCIPs, we only want to solve the current MIP with a branch-and-cut approach.
201 */
202#define conshdlrCopyStoreGraph NULL
203#endif
204
205/** destructor of constraint handler to free constraint handler data (called when SCIP is exiting) */
206static
207SCIP_DECL_CONSFREE(consFreeStoreGraph)
208{
209 SCIP_CONSHDLRDATA* conshdlrData;
210
211 assert(scip != NULL);
212 assert(conshdlr != NULL);
213
215
216 conshdlrData = SCIPconshdlrGetData(conshdlr);
217 assert(conshdlrData != NULL);
218
219 SCIPdebugMessage("freeing store graph constraint handler\n");
220
221 /* free constraint handler storage */
222 assert(conshdlrData->stack == NULL);
223 SCIPfreeBlockMemory(scip, &conshdlrData);
224
225 return SCIP_OKAY;
226}
227
228
229/** solving process initialization method of constraint handler (called when branch and bound process is about to begin) */
230static
231SCIP_DECL_CONSINITSOL(consInitsolStoreGraph)
232{
233 SCIP_CONSHDLRDATA* conshdlrData;
234 SCIP_CONS* cons;
235 assert(scip != NULL);
236 assert(conshdlr != NULL);
237
239
240 conshdlrData = SCIPconshdlrGetData(conshdlr);
241 assert(conshdlrData != NULL);
242
243 /* prepare stack */
244 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &conshdlrData->stack, conshdlrData->maxstacksize) );
246
247 /* release constraints */
248 conshdlrData->stack[0] = cons;
249 conshdlrData->nstack = 1;
250
251 return SCIP_OKAY;
252}/*lint !e715*/
253
254
255/** solving process deinitialization method of constraint handler (called before branch and bound process data is freed) */
256static
257SCIP_DECL_CONSEXITSOL(consExitsolStoreGraph)
258{
259 SCIP_CONSHDLRDATA* conshdlrData;
260
261 assert(scip != NULL);
262 assert(conshdlr != NULL);
263
265
266 conshdlrData = SCIPconshdlrGetData(conshdlr);
267 assert(conshdlrData != NULL);
268 assert(conshdlrData->nstack == 1); /* at this point the stack should only have the root-constraint on it */
269 SCIP_CALL( SCIPreleaseCons(scip, &(conshdlrData->stack[0])) );
270 conshdlrData->stack[0] = NULL;
271 SCIPdebugMessage("exiting store graph constraint handler\n");
272
273 /* free stack */
274 SCIPfreeBlockMemoryArray(scip, &conshdlrData->stack, conshdlrData->maxstacksize);
275
276 return SCIP_OKAY;
277}/*lint !e715*/
278
279
280/** frees specific constraint data */
281static
282SCIP_DECL_CONSDELETE(consDeleteStoreGraph)
283{
284 int i;
285
286 assert(scip != NULL);
287 assert(conshdlr != NULL);
288 assert(cons != NULL);
289 assert(consdata != NULL);
290 assert(*consdata != NULL);
291
293
294 SCIPdebugMessage("Deleting store graph constraint: <%s(%d,%d)>.\n", SCIPconsGetName(cons), (*consdata)->node1+1, (*consdata)->node2+1);
295
296 /* free constraint data */
297 if ( (*consdata)->type == COLOR_CONSTYPE_ROOT )
298 {
299 for ( i = tcliqueGetNNodes((*consdata)->graph)-1; i >= 0; i-- )
300 {
301 SCIPfreeBlockMemoryArray(scip, &((*consdata)->unionofnode[i]), (*consdata)->nnodesinunion[i]); /*lint !e866*/
302 assert((*consdata)->nnodesinunion[i] == 1);
303 }
304 SCIPfreeBlockMemoryArray(scip, &((*consdata)->unionofnode), tcliqueGetNNodes((*consdata)->graph));
305 SCIPfreeBlockMemoryArray(scip, &((*consdata)->nnodesinunion), tcliqueGetNNodes((*consdata)->graph));
306 SCIPfreeBlockMemoryArray(scip, &((*consdata)->representativeofnode), tcliqueGetNNodes((*consdata)->graph));
307 tcliqueFree(&((*consdata)->cgraph));
308 }
309 else
310 {
311 if ((*consdata)->created)
312 {
313 for ( i = tcliqueGetNNodes((*consdata)->graph)-1; i >= 0; i-- )
314 {
315 if ( (*consdata)->nnodesinunion[i] > 0 )
316 {
317 SCIPfreeBlockMemoryArray(scip, &((*consdata)->unionofnode[i]), (*consdata)->nnodesinunion[i]); /*lint !e866*/
318 (*consdata)->unionofnode[i] = NULL;
319 }
320 }
321 SCIPfreeBlockMemoryArray(scip, &((*consdata)->unionofnode), tcliqueGetNNodes((*consdata)->graph));
322 SCIPfreeBlockMemoryArray(scip, &((*consdata)->nnodesinunion), tcliqueGetNNodes((*consdata)->graph));
323 SCIPfreeBlockMemoryArray(scip, &((*consdata)->representativeofnode), tcliqueGetNNodes((*consdata)->graph));
324
325 (*consdata)->unionofnode = NULL;
326 (*consdata)->representativeofnode = NULL;
327 (*consdata)->nnodesinunion = NULL;
328
329 if ((*consdata)->graph != NULL)
330 {
331 tcliqueFree(&((*consdata)->graph));
332 }
333 if ((*consdata)->cgraph != NULL)
334 {
335 tcliqueFree(&((*consdata)->cgraph));
336 }
337 }
338 }
339 SCIPfreeBlockMemory(scip, consdata);
340
341 return SCIP_OKAY;
342}
343
344
345/** constraint enforcing method of constraint handler for LP solutions */
346static
347SCIP_DECL_CONSENFOLP(consEnfolpStoreGraph)
348{
349 assert(scip != NULL);
350 assert(conshdlr != NULL);
351 assert(result != NULL);
352
354
355 /* do nothing */
357
358 return SCIP_OKAY;
359}/*lint !e715*/
360
361
362/** constraint enforcing method of constraint handler for pseudo solutions */
363static
364SCIP_DECL_CONSENFOPS(consEnfopsStoreGraph)
365{
366 assert(scip != NULL);
367 assert(conshdlr != NULL);
368 assert(result != NULL);
369
371
372 /* do nothing */
374
375 return SCIP_OKAY;
376}/*lint !e715*/
377
378
379/** feasibility check method of constraint handler for integral solutions */
380static
381SCIP_DECL_CONSCHECK(consCheckStoreGraph)
382{
383 assert(scip != NULL);
384 assert(conshdlr != NULL);
385 assert(result != NULL);
386
388
389 /* do nothing */
391
392 return SCIP_OKAY;
393}/*lint !e715*/
394
395
396/** variable rounding lock method of constraint handler */
397static
398SCIP_DECL_CONSLOCK(consLockStoreGraph)
399{
400 assert(scip != NULL);
401 assert(conshdlr != NULL);
402 assert(cons != NULL);
403
405
406 SCIPdebugMessage("Locking method for store graph constraint: <%s>.\n", SCIPconsGetName(cons));
407
408 return SCIP_OKAY;
409}/*lint !e715*/
410
411
412/** constraint activation notification method of constraint handler */
413static
414SCIP_DECL_CONSACTIVE(consActiveStoreGraph)
415{
416 SCIP_CONSHDLRDATA* conshdlrData;
417 SCIP_CONSDATA* consdata;
418 SCIP_CONSDATA* olddata;
419 TCLIQUE_GRAPH* fathergraph;
420 int i;
421 int j;
422 int* firstedge;
423 int* lastedge;
424 int inserted;
425 int nnodes;
426
427 assert(conshdlr != NULL);
428 assert(cons != NULL);
429
431
432 conshdlrData = SCIPconshdlrGetData(conshdlr);
433 assert(conshdlrData != NULL);
434 assert(conshdlrData->stack != NULL);
435
436 consdata = SCIPconsGetData(cons);
437 assert(consdata != NULL);
438 assert((consdata->type == COLOR_CONSTYPE_ROOT) || (consdata->fathercons != NULL));
439
440 SCIPdebugMessage("Activating store graph constraint: <%s(%d,%d)> [stack size: %d].\n", SCIPconsGetName(cons),
441 (consdata->node1+1), (consdata->node2+1), conshdlrData->nstack+1);
442
443 /* put constraint on the stack */
444 if ( conshdlrData->nstack >= conshdlrData->maxstacksize )
445 {
446 int newsize = SCIPcalcMemGrowSize(scip, conshdlrData->nstack + 1);
447
448 SCIPdebugMessage("reallocating Memory for stack! %d --> %d\n", conshdlrData->maxstacksize, newsize);
449
450 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &(conshdlrData->stack), conshdlrData->maxstacksize, newsize) ); /*lint !e715 !e647*/
451 conshdlrData->maxstacksize = newsize;
452 }
453 conshdlrData->stack[conshdlrData->nstack] = cons;
454 ++(conshdlrData->nstack);
455
456 /* if the current graph was not yet created, create it now */
457 if ( consdata->created == FALSE )
458 {
459 consdata->created = TRUE;
460 olddata = SCIPconsGetData(consdata->fathercons);
461 assert((consdata->type == COLOR_CONSTYPE_ROOT)
462 || (consdata->node1 == olddata->representativeofnode[consdata->node1]
463 && consdata->node2 == olddata->representativeofnode[consdata->node2]));
464 nnodes = tcliqueGetNNodes(olddata->graph);
465 fathergraph = olddata->graph;
466
467 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(consdata->representativeofnode), nnodes) );
468 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(consdata->nnodesinunion), nnodes) );
469 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(consdata->unionofnode), nnodes) );
470
471 for ( i = 0; i < nnodes; i++ )
472 {
473 consdata->representativeofnode[i] = olddata->representativeofnode[i];
474 consdata->nnodesinunion[i] = olddata->nnodesinunion[i];
475 if ( consdata->nnodesinunion[i] > 0 )
476 {
477 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(consdata->unionofnode[i]), consdata->nnodesinunion[i]) ); /*lint !e866*/
478 for ( j = 0; j < consdata->nnodesinunion[i]; j++ )
479 {
480 consdata->unionofnode[i][j] = olddata->unionofnode[i][j];
481 }
482 }
483 }
484
485 /* copy the graph */
486 if( !tcliqueCreate(&(consdata->graph)) )
487 {
488 SCIPerrorMessage("could not flush the clique graph\n");
489 return SCIP_ERROR;
490 }
491
492 if( !tcliqueAddNode((consdata)->graph, nnodes-1, 0) )
493 {
494 SCIPerrorMessage("could not add a node to the clique graph\n");
495 return SCIP_ERROR;
496 }
497
498 for ( i = 0; i < nnodes; i++ )
499 {
500 /* get adjacent nodes for node i and add them to new graph*/
501 firstedge = tcliqueGetFirstAdjedge(fathergraph, i);
502 lastedge = tcliqueGetLastAdjedge(fathergraph, i);
503 while ( firstedge <= lastedge )
504 {
505 if ( *firstedge > i )
506 {
507 if( !tcliqueAddEdge(consdata->graph, i, *firstedge) )
508 {
509 SCIPerrorMessage("could not add an edge to the clique graph\n");
510 return SCIP_ERROR;
511 }
512 }
513 firstedge++;
514 }
515 }
516
517 if( !tcliqueFlush(consdata->graph) )
518 {
519 SCIPerrorMessage("could not flush the clique graph\n");
520 return SCIP_ERROR;
521 }
522
523 assert(consdata->representativeofnode[consdata->node2] == consdata->node2);
524 assert(consdata->representativeofnode[consdata->node1] == consdata->node1);
525
526 /* type == COLOR_CONSTYPE_DIFFER --> insert edge between node1 and node2 */
527 if (consdata->type == COLOR_CONSTYPE_DIFFER)
528 {
529 for ( i = 0; i < consdata->nnodesinunion[consdata->representativeofnode[consdata->node2]]; i++ )
530 {
531 for ( j = 0; j < consdata->nnodesinunion[consdata->representativeofnode[consdata->node1]]; j++ )
532 {
533 if( !tcliqueAddEdge(consdata->graph, consdata->unionofnode[consdata->representativeofnode[consdata->node1]][j],
534 consdata->unionofnode[consdata->representativeofnode[consdata->node2]][i])
535 )
536 {
537 SCIPerrorMessage("could not add an edge to the clique graph\n");
538 return SCIP_ERROR;
539 }
540 }
541 }
542
543 if( !tcliqueFlush(consdata->graph) )
544 {
545 SCIPerrorMessage("could not flush the clique graph\n");
546 return SCIP_ERROR;
547 }
548 }
549 /* type == COLOR_CONSTYPE_SAME --> insert edge (node2, i) - if not yet existing - if there exists an edge (node1, i) and vice versa */
550 else
551 {
552 assert(consdata->type == COLOR_CONSTYPE_SAME);
553 inserted = 0;
554
555 /* add edges from all nodes of union2 to all nodes adjacent to union1 */
556 for ( i = 0; i < consdata->nnodesinunion[consdata->node2]; i++ )
557 {
558 /* set representative of nodes in the union of node2 */
559 consdata->representativeofnode[consdata->unionofnode[consdata->node2][i]] = consdata->node1;
560
561 /* insert edges to all nodes adjacent to node1 */
562 firstedge = tcliqueGetFirstAdjedge(fathergraph, consdata->node1);
563 lastedge = tcliqueGetLastAdjedge(fathergraph, consdata->node1);
564 while ( firstedge <= lastedge )
565 {
566 if ( !tcliqueIsEdge(fathergraph, *firstedge, consdata->node2) )
567 {
568 if( !tcliqueAddEdge(consdata->graph, consdata->unionofnode[consdata->node2][i], *firstedge) )
569 {
570 SCIPerrorMessage("could not add an edge to the clique graph\n");
571 return SCIP_ERROR;
572 }
573 inserted++;
574 }
575 firstedge++;
576 }
577 }
578 /* add edges from all nodes of union1 to all nodes adjacent to union2 */
579 for ( i = 0; i < consdata->nnodesinunion[consdata->node1]; i++ )
580 {
581 /* insert edges to all nodes adjacent to node2 */
582 firstedge = tcliqueGetFirstAdjedge(fathergraph, consdata->node2);
583 lastedge = tcliqueGetLastAdjedge(fathergraph, consdata->node2);
584 while ( firstedge <= lastedge )
585 {
586 if ( !tcliqueIsEdge(fathergraph, *firstedge, consdata->node1) )
587 {
588 if( ! tcliqueAddEdge(consdata->graph, consdata->unionofnode[consdata->node1][i], *firstedge) )
589 {
590 SCIPerrorMessage("could not add an edge to the clique graph\n");
591 return SCIP_ERROR;
592 }
593 inserted++;
594 }
595 firstedge++;
596 }
597 }
598 if ( inserted > 0 )
599 {
600 if( !tcliqueFlush(consdata->graph) )
601 {
602 SCIPerrorMessage("could not flush the clique graph\n");
603 return SCIP_ERROR;
604 }
605 }
606
607 /* update union represented by node1 */
608 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &(consdata->unionofnode[consdata->node1]),
609 consdata->nnodesinunion[consdata->node1],
610 (consdata->nnodesinunion[consdata->node1]) + (consdata->nnodesinunion[consdata->node2])) ); /*lint !e866*/
611 for ( i = 0; i < consdata->nnodesinunion[consdata->node2]; i ++ )
612 {
613 consdata->unionofnode[consdata->node1][consdata->nnodesinunion[consdata->node1]+i]
614 = consdata->unionofnode[consdata->node2][i];
615 }
616 SCIPfreeBlockMemoryArray(scip, &(consdata->unionofnode[consdata->node2]),
617 consdata->nnodesinunion[consdata->node2]); /*lint !e866*/
618 consdata->nnodesinunion[consdata->node1] =
619 (consdata->nnodesinunion[consdata->node1]) + (consdata->nnodesinunion[consdata->node2]);
620 consdata->nnodesinunion[consdata->node2] = 0;
621 consdata->unionofnode[consdata->node2] = NULL;
622
623 /* the constraint associated to node2 can be removed from this branch-and-bound node and its subtree */
625 }
626
627 /* create the complementary graph */
628 if( !tcliqueCreate(&(consdata->cgraph)) )
629 {
630 SCIPerrorMessage("could not flush the clique graph\n");
631 return SCIP_ERROR;
632 }
633 assert(consdata->cgraph != NULL);
634 SCIP_CALL( COLORprobGetComplementaryGraph(scip, consdata->graph, consdata->cgraph) );
635 }
636 /* if new variables where created after the last propagation of this cons, repropagate it */
637 else
638 {
639 if ( (consdata->type != COLOR_CONSTYPE_ROOT) && (consdata->propagatedvars < SCIPgetNTotalVars(scip)) )
640 {
641 SCIP_CALL( SCIPrepropagateNode(scip, consdata->stickingatnode) );
642 }
643 }
644
645 return SCIP_OKAY;
646}
647
648
649
650/** constraint deactivation notification method of constraint handler */
651static
652SCIP_DECL_CONSDEACTIVE(consDeactiveStoreGraph)
653{
654 SCIP_CONSHDLRDATA* conshdlrData;
655#ifdef SCIP_DEBUG
656 SCIP_CONSDATA* consdata;
657#endif
658
659 assert(scip != NULL);
660 assert(conshdlr != NULL);
661 assert(cons != NULL);
662
664
665 conshdlrData = SCIPconshdlrGetData(conshdlr);
666 assert(conshdlrData != NULL);
667 assert(conshdlrData->stack != NULL);
668 assert(conshdlrData->nstack > 0);
669 assert(cons == conshdlrData->stack[conshdlrData->nstack-1]);
670
671#ifdef SCIP_DEBUG
672 consdata = SCIPconsGetData(cons);
673
674 SCIPdebugMessage("Deactivating store graph constraint: <%s(%d,%d)> [stack size: %d].\n", SCIPconsGetName(cons), (consdata->node1+1), (consdata->node2+1), conshdlrData->nstack-1);
675#endif
676
677 /* remove constraint from the stack */
678 --conshdlrData->nstack;
679
680 return SCIP_OKAY;
681}
682
683
684
685/** domain propagation method of constraint handler */
686static
687SCIP_DECL_CONSPROP(consPropStoreGraph)
688{
689 SCIP_CONSHDLRDATA* conshdlrData;
690 SCIP_CONS* cons;
691 SCIP_CONSDATA* consdata;
692 SCIP_VAR* var;
693 int** sets;
694 int* nsetelements;
695 int nsets;
696 int i;
697 int propcount;
698
699 assert(conshdlr != NULL);
700 conshdlrData = SCIPconshdlrGetData(conshdlr);
701 assert(conshdlrData != NULL);
702 assert(conshdlrData->stack != NULL);
703
704 /* get all stable sets */
705 COLORprobGetStableSets(scip, &sets, &nsetelements, &nsets);
707 propcount = 0;
708
709 /* the constraint data of the cons related to the current node */
710 cons = conshdlrData->stack[conshdlrData->nstack-1];
711 consdata = SCIPconsGetData(cons);
712
713 SCIPdebugMessage( "Starting propagation of store graph constraint <%s(%d,%d)> .\n", SCIPconsGetName(cons), (consdata->node1+1), (consdata->node2+1));
714
715 /* propagation for differ: set upper bound to 0 for all stable sets, which contain both nodes */
716 if (consdata->type == COLOR_CONSTYPE_DIFFER)
717 {
718 for ( i = 0; i < nsets; i++ )
719 {
721 {
722 if ( COLORprobIsNodeInStableSet(scip, i, consdata->node1) && COLORprobIsNodeInStableSet(scip, i, consdata->node2) )
723 {
725 SCIP_CALL( SCIPchgVarUb(scip, var, 0.0) );
726 propcount++;
727 }
728 }
729 }
730 }
731
732 /* propagation for same: set upper bound to 0 for all stable sets, which do not contain both nodes */
733 if ( consdata->type == COLOR_CONSTYPE_SAME )
734 {
735 for ( i = 0; i < nsets; i++ )
736 {
738 {
739 if ( (COLORprobIsNodeInStableSet(scip, i, consdata->node1) || COLORprobIsNodeInStableSet(scip, i, consdata->node2))
740 && !(COLORprobIsNodeInStableSet(scip, i, consdata->node1) && COLORprobIsNodeInStableSet(scip, i, consdata->node2)) )
741 {
743 SCIP_CALL( SCIPchgVarUb(scip, var, 0.0) );
744 propcount++;
745 }
746 }
747 }
748 }
749
750 SCIPdebugMessage( "Finished propagation of store graph constraint <%s(%d,%d)>, %d vars fixed.\n", SCIPconsGetName(cons), (consdata->node1+1), (consdata->node2+1), propcount);
751
753 consdata->propagatedvars = SCIPgetNTotalVars(scip);
754
755 return SCIP_OKAY;
756}/*lint !e715*/
757
758/*
759 * interface methods
760 */
761
762
763/** creates the handler for storeGraph constraints and includes it in SCIP */
765 SCIP* scip /**< SCIP data structure */
766 )
767{
768 SCIP_CONSHDLRDATA* conshdlrData;
769 SCIP_CONSHDLR* conshdlr;
770
771 SCIPdebugMessage("Including graph storage constraint handler.\n");
772
773 SCIP_CALL( SCIPallocBlockMemory(scip, &conshdlrData) );
774 conshdlrData->stack = NULL;
775 conshdlrData->nstack = 0;
776 conshdlrData->maxstacksize = 25;
777
778 conshdlr = NULL;
779 /* include constraint handler */
782 consEnfolpStoreGraph, consEnfopsStoreGraph, consCheckStoreGraph, consLockStoreGraph,
783 conshdlrData) );
784 assert(conshdlr != NULL);
785
786 SCIP_CALL( SCIPsetConshdlrDelete(scip, conshdlr, consDeleteStoreGraph) );
787 SCIP_CALL( SCIPsetConshdlrFree(scip, conshdlr, consFreeStoreGraph) );
788 SCIP_CALL( SCIPsetConshdlrInitsol(scip, conshdlr, consInitsolStoreGraph) );
789 SCIP_CALL( SCIPsetConshdlrExitsol(scip, conshdlr, consExitsolStoreGraph) );
790 SCIP_CALL( SCIPsetConshdlrActive(scip, conshdlr, consActiveStoreGraph) );
791 SCIP_CALL( SCIPsetConshdlrDeactive(scip, conshdlr, consDeactiveStoreGraph) );
794
795 return SCIP_OKAY;
796}
797
798/** creates and captures a storeGraph constraint, uses knowledge of the B&B-father*/
800 SCIP* scip, /**< SCIP data structure */
801 SCIP_CONS** cons, /**< pointer to hold the created constraint */
802 const char* name, /**< name of constraint */
803 SCIP_CONS* fatherconstraint, /**< constraint in B&B-father */
804 COLOR_CONSTYPE type, /**< type of the constraint: COLOR_CONSTYPE_SAME or COLOR_CONSTYPE_DIFFER */
805 int node1, /**< the first node of the constraint */
806 int node2, /**< the second node of the constraint */
807 SCIP_NODE* stickingnode /**< the B&B-tree node at which the constraint will be sticking */
808 )
809{
810 SCIP_CONSHDLR* conshdlr;
811 SCIP_CONSDATA* consdata;
812 int temp;
813
814 assert(scip != NULL);
815 assert(fatherconstraint != NULL);
817 assert(stickingnode != NULL);
818
819 /* find the storeGraph constraint handler */
821 if ( conshdlr == NULL )
822 {
823 SCIPerrorMessage("storeGraph constraint handler not found\n");
824 return SCIP_PLUGINNOTFOUND;
825 }
826
827 /* create constraint data */
828 SCIP_CALL( SCIPallocBlockMemory(scip, &consdata) );
829
830 if ( node1 > node2 )
831 {
832 temp = node1;
833 node1 = node2;
834 node2 = temp;
835 }
836 SCIPdebugMessage("Creating store graph constraint: <%s(%d,%d)>. \n", name, (node1+1), (node2+1));
837
838 consdata->node1 = node1;
839 consdata->node2 = node2;
840 consdata->type = type;
841 consdata->fathercons = fatherconstraint;
842 consdata->propagatedvars = 0;
843 consdata->stickingatnode = stickingnode;
844 consdata->created = FALSE;
845
846
847 /* create constraint */
848 SCIP_CALL( SCIPcreateCons(scip, cons, name, conshdlr, consdata, FALSE, FALSE, FALSE, FALSE, TRUE,
849 TRUE, FALSE, TRUE, FALSE, TRUE) );
850
851 return SCIP_OKAY;
852}
853
854
855
856
857/* ----------------------------------- external methods -------------------------- */
858
859/** returns the store graph constraint of the current node, needs the pointer to the constraint handler */
861 SCIP_CONSHDLR* conshdlr /**< constaint handler for store-graph constraints */
862 )
863{
864 SCIP_CONSHDLRDATA* conshdlrData;
865
866 assert(conshdlr != NULL);
867 conshdlrData = SCIPconshdlrGetData(conshdlr);
868 assert(conshdlrData != NULL);
869 assert(conshdlrData->stack != NULL);
870
871 return conshdlrData->stack[conshdlrData->nstack-1];
872}
873
874
875/** returns the store graph constraint of the current node, only needs the pointer to scip */
877 SCIP* scip /**< SCIP data structure */
878 )
879{
880 SCIP_CONSHDLR* conshdlr;
881 SCIP_CONSHDLRDATA* conshdlrData;
882
883 assert(scip != NULL);
884 conshdlr = SCIPfindConshdlr(scip, "storeGraph");
885 if ( conshdlr == NULL )
886 {
887 SCIPerrorMessage("storeGraph constraint handler not found\n");
888 return NULL;
889 }
890 conshdlrData = SCIPconshdlrGetData(conshdlr);
891 assert(conshdlrData != NULL);
892 assert(conshdlrData->stack != NULL);
893 assert(conshdlrData->nstack > 0);
894
895 return conshdlrData->stack[conshdlrData->nstack-1];
896}
897
898
899/** returns the current graph */
901 SCIP* scip /**< SCIP data structure */
902 )
903{
904 SCIP_CONSHDLR* conshdlr;
905 SCIP_CONS* cons;
906 SCIP_CONSDATA* consdata;
907 SCIP_CONSHDLRDATA* conshdlrData;
908
909 assert(scip != NULL);
910 conshdlr = SCIPfindConshdlr(scip, "storeGraph");
911 if ( conshdlr == NULL )
912 {
913 SCIPerrorMessage("storeGraph constraint handler not found\n");
914 return NULL;
915 }
916 conshdlrData = SCIPconshdlrGetData(conshdlr);
917 assert(conshdlrData != NULL);
918 assert(conshdlrData->stack != NULL);
919 cons = conshdlrData->stack[conshdlrData->nstack-1];
920 assert(cons != NULL);
921
922 consdata = SCIPconsGetData(cons);
923 return consdata->graph;
924}
925
926
927/** returns the complementary graph */
929 SCIP* scip /**< SCIP data structure */
930 )
931{
932 SCIP_CONSHDLR* conshdlr;
933 SCIP_CONS* cons;
934 SCIP_CONSDATA* consdata;
935 SCIP_CONSHDLRDATA* conshdlrData;
936
937 assert(scip != NULL);
938
939 conshdlr = SCIPfindConshdlr(scip, "storeGraph");
940 if ( conshdlr == NULL )
941 {
942 SCIPerrorMessage("storeGraph constraint handler not found\n");
943 return NULL;
944 }
945
946 conshdlrData = SCIPconshdlrGetData(conshdlr);
947 assert(conshdlrData != NULL);
948 assert(conshdlrData->stack != NULL);
949
950 cons = conshdlrData->stack[conshdlrData->nstack-1];
951 assert(cons != NULL);
952
953 consdata = SCIPconsGetData(cons);
954 return consdata->cgraph;
955}
956
957
958/** returns array of representatives of all nodes */
960 SCIP* scip /**< SCIP data structure */
961 )
962{
963 SCIP_CONSHDLR* conshdlr;
964 SCIP_CONSHDLRDATA* conshdlrData;
965 SCIP_CONS* cons;
966 SCIP_CONSDATA* consdata;
967
968 assert(scip != NULL);
969
970 conshdlr = SCIPfindConshdlr(scip, "storeGraph");
971 if ( conshdlr == NULL )
972 {
973 SCIPerrorMessage("storeGraph constraint handler not found\n");
974 return NULL;
975 }
976
977 conshdlrData = SCIPconshdlrGetData(conshdlr);
978 assert(conshdlrData != NULL);
979 assert(conshdlrData->stack != NULL);
980
981 cons = conshdlrData->stack[conshdlrData->nstack-1];
982 consdata = SCIPconsGetData(cons);
983 return consdata->representativeofnode;
984}
985
986/** returns the representative of the union which contains a given node */
988 SCIP* scip, /**< SCIP data structure */
989 int node /**< the node, for wich the representative is searched */
990 )
991{
992 SCIP_CONSHDLR* conshdlr;
993 SCIP_CONSHDLRDATA* conshdlrData;
994 SCIP_CONS* cons;
995 SCIP_CONSDATA* consdata;
996
997 assert(scip != NULL);
998
999 conshdlr = SCIPfindConshdlr(scip, "storeGraph");
1000 if ( conshdlr == NULL )
1001 {
1002 SCIPerrorMessage("storeGraph constraint handler not found\n");
1003 return -1;
1004 }
1005
1006 conshdlrData = SCIPconshdlrGetData(conshdlr);
1007 assert(conshdlrData != NULL);
1008 assert(conshdlrData->stack != NULL);
1009
1010 cons = conshdlrData->stack[conshdlrData->nstack-1];
1011 consdata = SCIPconsGetData(cons);
1012 assert(consdata != NULL);
1013
1014 assert(node >= 0 && node < tcliqueGetNNodes(consdata->graph));
1015
1016 return consdata->representativeofnode[node];
1017}
1018
1019/** returns the array of all unions, a union is saved in the array at the position of its representative */
1021 SCIP* scip, /**< SCIP data structure */
1022 int*** unions, /**< output: array containing array which contains nodes in the union */
1023 int** lengths /**< output: lengths of the unions */
1024 )
1025{
1026 SCIP_CONSHDLR* conshdlr;
1027 SCIP_CONSHDLRDATA* conshdlrData;
1028 SCIP_CONS* cons;
1029 SCIP_CONSDATA* consdata;
1030
1031 assert(scip != NULL);
1032 conshdlr = SCIPfindConshdlr(scip, "storeGraph");
1033 if ( conshdlr == NULL )
1034 {
1035 SCIPerrorMessage("storeGraph constraint handler not found\n");
1036 return;
1037 }
1038
1039 conshdlrData = SCIPconshdlrGetData(conshdlr);
1040 assert(conshdlrData != NULL);
1041 assert(conshdlrData->stack != NULL);
1042
1043 cons = conshdlrData->stack[conshdlrData->nstack-1];
1044 consdata = SCIPconsGetData(cons);
1045 assert(consdata != NULL);
1046
1047 *unions = consdata->unionofnode;
1048 *lengths = consdata->nnodesinunion;
1049}
1050
1051/** returns the union which has a given node as representative */
1053 SCIP* scip, /**< SCIP data structure */
1054 int** nodesinunion, /**< output: array containig nodes in the union */
1055 int* nnodesinunion, /**< output: length of the union */
1056 int node /**< the node, whose union we want to get */
1057 )
1058{
1059 SCIP_CONSHDLR* conshdlr;
1060 SCIP_CONSHDLRDATA* conshdlrData;
1061 SCIP_CONS* cons;
1062 SCIP_CONSDATA* consdata;
1063
1064 assert(scip != NULL);
1065 conshdlr = SCIPfindConshdlr(scip, "storeGraph");
1066 if ( conshdlr == NULL )
1067 {
1068 SCIPerrorMessage("storeGraph constraint handler not found\n");
1069 return;
1070 }
1071 conshdlrData = SCIPconshdlrGetData(conshdlr);
1072 assert(conshdlrData != NULL);
1073 assert(conshdlrData->stack != NULL);
1074 cons = conshdlrData->stack[conshdlrData->nstack-1];
1075 consdata = SCIPconsGetData(cons);
1076 assert(consdata != NULL);
1077
1078 *nodesinunion = consdata->unionofnode[node];
1079 *nnodesinunion = consdata->nnodesinunion[node];
1080}
1081
1082/** returns the stack and the number of elements on it */
1084 SCIP* scip, /**< SCIP data structure */
1085 SCIP_CONS*** stack, /**< return value: pointer to the stack */
1086 int* nstackelements /**< return value: pointer to int, for number of elements on the stack */
1087 )
1088{
1089 SCIP_CONSHDLR* conshdlr;
1090 SCIP_CONSHDLRDATA* conshdlrData;
1091
1092 assert(scip != NULL);
1093 conshdlr = SCIPfindConshdlr(scip, "storeGraph");
1094 if ( conshdlr == NULL )
1095 {
1096 SCIPerrorMessage("storeGraph constraint handler not found\n");
1097 return;
1098 }
1099 conshdlrData = SCIPconshdlrGetData(conshdlr);
1100 assert(conshdlrData != NULL);
1101 assert(conshdlrData != NULL);
1102 assert(conshdlrData->stack != NULL);
1103
1104 *stack = conshdlrData->stack;
1105 *nstackelements = conshdlrData->nstack;
1106}
1107
1108
#define CONSHDLR_NEEDSCONS
Definition cons_and.c:96
#define CONSHDLR_CHECKPRIORITY
Definition cons_and.c:88
#define CONSHDLR_DESC
Definition cons_and.c:85
#define CONSHDLR_PROP_TIMING
Definition cons_and.c:99
#define CONSHDLR_PROPFREQ
Definition cons_and.c:90
#define CONSHDLR_EAGERFREQ
Definition cons_and.c:91
#define CONSHDLR_ENFOPRIORITY
Definition cons_and.c:87
#define CONSHDLR_NAME
Definition cons_and.c:84
#define CONSHDLR_DELAYPROP
Definition cons_and.c:95
Constraint handler for linear constraints in their most general form, .
int * COLORconsGetRepresentatives(SCIP *scip)
TCLIQUE_GRAPH * COLORconsGetCurrentGraph(SCIP *scip)
SCIP_RETCODE COLORcreateConsStoreGraph(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_CONS *fatherconstraint, COLOR_CONSTYPE type, int node1, int node2, SCIP_NODE *stickingnode)
void COLORconsGetUnions(SCIP *scip, int ***unions, int **lengths)
void COLORconsGetUnion(SCIP *scip, int **nodesinunion, int *nnodesinunion, int node)
SCIP_CONS * COLORconsGetActiveStoreGraphConsFromHandler(SCIP_CONSHDLR *conshdlr)
int COLORconsGetRepresentative(SCIP *scip, int node)
TCLIQUE_GRAPH * COLORconsGetComplementaryGraph(SCIP *scip)
SCIP_RETCODE COLORincludeConshdlrStoreGraph(SCIP *scip)
SCIP_CONS * COLORconsGetActiveStoreGraphCons(SCIP *scip)
static SCIP_RETCODE createConsStoreGraphAtRoot(SCIP *scip, SCIP_CONS **cons, const char *name, TCLIQUE_GRAPH *graph)
void COLORconsGetStack(SCIP *scip, SCIP_CONS ***stack, int *nstackelements)
constraint handler for storing the graph at each node of the tree
@ COLOR_CONSTYPE_ROOT
@ COLOR_CONSTYPE_DIFFER
@ COLOR_CONSTYPE_SAME
enum COLOR_ConsType COLOR_CONSTYPE
#define NULL
Definition def.h:257
#define SCIP_Bool
Definition def.h:100
#define SCIP_STRINGEQ(name, reference, retcode)
Definition def.h:454
#define TRUE
Definition def.h:102
#define FALSE
Definition def.h:103
#define SCIP_CALL(x)
Definition def.h:364
#define nnodes
Definition gastrans.c:74
int SCIPgetNTotalVars(SCIP *scip)
Definition scip_prob.c:3064
SCIP_RETCODE SCIPdelConsLocal(SCIP *scip, SCIP_CONS *cons)
Definition scip_prob.c:4067
SCIP_RETCODE SCIPsetConshdlrFree(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
Definition scip_cons.c:372
SCIP_RETCODE SCIPsetConshdlrActive(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
Definition scip_cons.c:670
SCIP_RETCODE SCIPsetConshdlrProp(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPROP((*consprop)), int propfreq, SCIP_Bool delayprop, SCIP_PROPTIMING proptiming)
Definition scip_cons.c:281
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)
Definition scip_cons.c:181
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
Definition cons.c:4320
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition scip_cons.c:940
SCIP_RETCODE SCIPsetConshdlrDelete(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
Definition scip_cons.c:578
SCIP_RETCODE SCIPsetConshdlrInitsol(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
Definition scip_cons.c:444
SCIP_RETCODE SCIPsetConshdlrDeactive(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
Definition scip_cons.c:693
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
Definition cons.c:4340
SCIP_RETCODE SCIPsetConshdlrExitsol(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
Definition scip_cons.c:468
SCIP_CONSDATA * SCIPconsGetData(SCIP_CONS *cons)
Definition cons.c:8423
SCIP_RETCODE SCIPcreateCons(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_CONSHDLR *conshdlr, SCIP_CONSDATA *consdata, 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)
Definition scip_cons.c:997
const char * SCIPconsGetName(SCIP_CONS *cons)
Definition cons.c:8393
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition scip_cons.c:1173
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition scip_mem.h:110
int SCIPcalcMemGrowSize(SCIP *scip, int num)
Definition scip_mem.c:139
#define SCIPallocBlockMemoryArray(scip, ptr, num)
Definition scip_mem.h:93
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
Definition scip_mem.h:99
#define SCIPfreeBlockMemory(scip, ptr)
Definition scip_mem.h:108
#define SCIPallocBlockMemory(scip, ptr)
Definition scip_mem.h:89
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPrepropagateNode(SCIP *scip, SCIP_NODE *node)
Definition scip_tree.c:479
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition var.c:24300
SCIP_RETCODE SCIPchgVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition scip_var.c:5875
return SCIP_OKAY
assert(minobj< SCIPgetCutoffbound(scip))
SCIP_VAR * var
SCIP_VAR * COLORprobGetVarForStableSet(SCIP *scip, int setindex)
void COLORprobGetStableSets(SCIP *scip, int ***stablesets, int **nelements, int *nstablesets)
SCIP_CONS * COLORprobGetConstraint(SCIP *scip, int node)
TCLIQUE_GRAPH * COLORprobGetGraph(SCIP *scip)
SCIP_RETCODE COLORprobGetComplementaryGraph(SCIP *scip, TCLIQUE_GRAPH *graph, TCLIQUE_GRAPH *cgraph)
SCIP_Bool COLORprobIsNodeInStableSet(SCIP *scip, int setindex, int node)
problem data for vertex coloring algorithm
#define SCIPerrorMessage
Definition pub_message.h:64
#define SCIPdebugMessage
Definition pub_message.h:96
file reader for vertex coloring instances
tclique user interface
int * tcliqueGetLastAdjedge(TCLIQUE_GRAPH *tcliquegraph, int node)
void tcliqueFree(TCLIQUE_GRAPH **tcliquegraph)
int * tcliqueGetFirstAdjedge(TCLIQUE_GRAPH *tcliquegraph, int node)
TCLIQUE_Bool tcliqueFlush(TCLIQUE_GRAPH *tcliquegraph)
struct TCLIQUE_Graph TCLIQUE_GRAPH
Definition tclique.h:49
TCLIQUE_Bool tcliqueCreate(TCLIQUE_GRAPH **tcliquegraph)
TCLIQUE_Bool tcliqueAddNode(TCLIQUE_GRAPH *tcliquegraph, int node, TCLIQUE_WEIGHT weight)
TCLIQUE_Bool tcliqueAddEdge(TCLIQUE_GRAPH *tcliquegraph, int node1, int node2)
type definitions for constraints and constraint handlers
#define SCIP_DECL_CONSENFOLP(x)
Definition type_cons.h:363
#define SCIP_DECL_CONSDELETE(x)
Definition type_cons.h:229
struct SCIP_Cons SCIP_CONS
Definition type_cons.h:63
#define SCIP_DECL_CONSINITSOL(x)
Definition type_cons.h:201
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
Definition type_cons.h:64
#define SCIP_DECL_CONSPROP(x)
Definition type_cons.h:506
#define SCIP_DECL_CONSACTIVE(x)
Definition type_cons.h:691
#define SCIP_DECL_CONSENFOPS(x)
Definition type_cons.h:431
#define SCIP_DECL_CONSDEACTIVE(x)
Definition type_cons.h:706
#define SCIP_DECL_CONSLOCK(x)
Definition type_cons.h:676
struct SCIP_Conshdlr SCIP_CONSHDLR
Definition type_cons.h:62
struct SCIP_ConsData SCIP_CONSDATA
Definition type_cons.h:65
#define SCIP_DECL_CONSCHECK(x)
Definition type_cons.h:474
#define SCIP_DECL_CONSEXITSOL(x)
Definition type_cons.h:216
#define SCIP_DECL_CONSFREE(x)
Definition type_cons.h:116
@ SCIP_FEASIBLE
Definition type_result.h:45
@ SCIP_DIDNOTFIND
Definition type_result.h:44
@ SCIP_PLUGINNOTFOUND
@ SCIP_INVALIDCALL
@ SCIP_ERROR
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
Definition type_scip.h:39
struct SCIP_Node SCIP_NODE
Definition type_tree.h:63
struct SCIP_Var SCIP_VAR
Definition type_var.h:166