54#define EVENTHDLR_NAME "probdatavardeleted"
55#define EVENTHDLR_DESC "event handler for variable deleted event"
101 SCIP_PROBDATA* probdata;
106 TCLIQUE_WEIGHT maxcliqueweight;
107 TCLIQUE_STATUS status;
108 TCLIQUE_GRAPH* currgraph;
115 int nnodesdeleteddegreethisround;
116 int nnodesdeletedneighbourthisround;
123 assert(scip != NULL);
124 probdata = SCIPgetProbData(scip);
125 assert(probdata != NULL);
127 printf(
"\npreprocessing...\n");
130 if( !tcliqueCreate(&currgraph) )
132 SCIPerrorMessage(
"could not flush the clique graph\n");
136 assert(currgraph != NULL);
138 if( !tcliqueAddNode(currgraph, tcliqueGetNNodes(probdata->oldgraph)-1, 0) )
140 SCIPerrorMessage(
"could not add a node to the clique graph\n");
144 for ( i = 0; i < tcliqueGetNNodes(probdata->oldgraph); i++ )
147 firstedge = tcliqueGetFirstAdjedge(probdata->oldgraph, i);
148 lastedge = tcliqueGetLastAdjedge(probdata->oldgraph, i);
149 while ( firstedge <= lastedge )
151 if ( *firstedge > i )
153 if( !tcliqueAddEdge(currgraph, i, *firstedge) )
155 SCIPerrorMessage(
"could not add an edge to the clique graph\n");
163 if( !tcliqueFlush(currgraph) )
165 SCIPerrorMessage(
"could not flush the clique graph\n");
169 currnnodes = tcliqueGetNNodes(probdata->oldgraph);
172 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(probdata->deletednodes), currnnodes) );
173 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(probdata->new2oldnode), currnnodes) );
178 for ( i = 0; i < currnnodes; i++ )
181 tcliqueChangeWeight(currgraph, i, 1);
183 probdata->new2oldnode[i] = i;
187 tcliqueMaxClique(NULL, NULL, NULL, NULL, currgraph, NULL, NULL, maxcliquenodes,
188 &nmaxcliquenodes, &maxcliqueweight, 0, 0, 50000, 0, INT_MAX, -1, NULL, &status);
189 opt = ( status == TCLIQUE_OPTIMAL ?
' ' :
'*' );
190 printf(
"size of the maximum clique: %d%c \n", nmaxcliquenodes, opt);
193 nnodesdeleteddegreethisround = 1;
194 nnodesdeletedneighbourthisround = 1;
198 while ( (nnodesdeleteddegreethisround > 0) || (nnodesdeletedneighbourthisround > 0) )
201 nnodesdeleteddegreethisround = 0;
202 nnodesdeletedneighbourthisround = 0;
206 while ( changed == TRUE )
210 degrees = tcliqueGetDegrees(currgraph);
211 for (i = 0; i < currnnodes; i++)
214 if ( (degrees[i] < nmaxcliquenodes )
217 probdata->deletednodes[ndeletednodes] = probdata->new2oldnode[i];
219 nnodesdeleteddegreethisround++;
225 newnodes[actnewnode] = probdata->new2oldnode[i];
235 tcliqueFree(&currgraph);
237 if( !tcliqueCreate(&currgraph) )
239 SCIPerrorMessage(
"could not create the clique graph\n");
243 assert(currgraph != NULL);
245 if( !tcliqueAddNode(currgraph, actnewnode-1, 0) )
247 SCIPerrorMessage(
"could not add a node to the clique graph\n");
251 for ( i = 0; i < actnewnode; i++ )
254 firstedge = tcliqueGetFirstAdjedge(probdata->oldgraph, newnodes[i]);
255 lastedge = tcliqueGetLastAdjedge(probdata->oldgraph, newnodes[i]);
256 while ( firstedge <= lastedge )
260 for ( j = i+1; j < actnewnode; j++ )
262 if ( *firstedge == newnodes[j] )
264 if( !tcliqueAddEdge(currgraph, i, j) )
266 SCIPerrorMessage(
"could not add an edge to the clique graph\n");
277 if( !tcliqueFlush(currgraph) )
279 SCIPerrorMessage(
"could not flush the clique graph\n");
284 currnnodes = tcliqueGetNNodes(currgraph);
286 for ( i = 0; i < actnewnode; i++ )
288 probdata->new2oldnode[i] = newnodes[i];
293 probdata->new2oldnode[i] = -1;
301 while ( changed == TRUE )
306 for ( i = 0; i < currnnodes; i++ )
314 for ( j = 0; j < currnnodes; j++ )
318 if ( (j != i) && !tcliqueIsEdge(currgraph, i, j)
325 firstedge = tcliqueGetFirstAdjedge(currgraph, i);
326 lastedge = tcliqueGetLastAdjedge(currgraph, i);
327 while ( firstedge <= lastedge )
330 if ( !tcliqueIsEdge(currgraph, j, *firstedge) )
339 probdata->deletednodes[ndeletednodes] = probdata->new2oldnode[i];
342 nnodesdeletedneighbourthisround++;
350 if ( ndeletednodes == 0 || probdata->deletednodes[ndeletednodes-1] != probdata->new2oldnode[i])
352 newnodes[actnewnode] = probdata->new2oldnode[i];
360 newnodes[actnewnode] = probdata->new2oldnode[i];
370 tcliqueFree(&currgraph);
372 if( !tcliqueCreate(&currgraph) )
374 SCIPerrorMessage(
"could not create the clique graph\n");
378 assert(currgraph != NULL);
380 if( !tcliqueAddNode(currgraph, actnewnode-1, 0) )
382 SCIPerrorMessage(
"could not add a node to the clique graph\n");
386 for ( i = 0; i < actnewnode; i++ )
389 firstedge = tcliqueGetFirstAdjedge(probdata->oldgraph, newnodes[i]);
390 lastedge = tcliqueGetLastAdjedge(probdata->oldgraph, newnodes[i]);
391 while ( firstedge <= lastedge )
395 for ( j = i+1; j < actnewnode; j++ )
397 if ( *firstedge == newnodes[j] )
400 if( !tcliqueAddEdge(currgraph, i, j) )
402 SCIPerrorMessage(
"could not add an edge to the clique graph\n");
412 if( !tcliqueFlush(currgraph) )
414 SCIPerrorMessage(
"could not flush the clique graph\n");
419 currnnodes = tcliqueGetNNodes(currgraph);
422 for ( i = 0; i < actnewnode; i++ )
424 probdata->new2oldnode[i] = newnodes[i];
430 probdata->new2oldnode[i] = -1;
435 printf(
"Round %d of preprocessing:\n", myround);
436 printf(
" deleted low degree vertices: %d\n", nnodesdeleteddegreethisround);
437 printf(
" deleted almost cliques: %d\n", nnodesdeletedneighbourthisround);
443 probdata->deletednodes[i] = -1;
446 printf(
"preprocessing overall deleted vertices: %d\n\n", ndeletednodes);
448 probdata->graph = currgraph;
450 SCIPfreeBufferArray(scip, &newnodes);
451 SCIPfreeBufferArray(scip, &maxcliquenodes);
472 assert(scip != NULL);
473 assert(sourcedata != NULL);
474 assert(targetdata != NULL);
477 SCIP_CALL( SCIPallocBlockMemory(scip, targetdata) );
479 if( !tcliqueCreate(&((*targetdata)->graph)) )
481 SCIPerrorMessage(
"could not create the clique graph\n");
485 (*targetdata)->maxstablesets = sourcedata->maxstablesets;
486 (*targetdata)->nstablesets = sourcedata->nstablesets;
487 (*targetdata)->oldgraph = sourcedata->oldgraph;
490 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &((*targetdata)->stablesets), sourcedata->maxstablesets) );
491 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &((*targetdata)->stablesetlengths), sourcedata->maxstablesets) );
492 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &((*targetdata)->stablesetvars), sourcedata->maxstablesets) );
493 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &((*targetdata)->deletednodes), tcliqueGetNNodes(sourcedata->oldgraph)) );
494 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &((*targetdata)->new2oldnode), tcliqueGetNNodes(sourcedata->oldgraph)) );
496 for ( i = 0; i < tcliqueGetNNodes(sourcedata->oldgraph); i++ )
498 (*targetdata)->deletednodes[i] = sourcedata->deletednodes[i];
499 (*targetdata)->new2oldnode[i] = sourcedata->new2oldnode[i];
503 for ( i = 0; i < sourcedata->nstablesets; i++ )
505 assert(sourcedata->stablesetvars[i] != NULL);
506 (*targetdata)->stablesetlengths[i] = sourcedata->stablesetlengths[i];
507 SCIP_CALL( SCIPtransformVar(scip, sourcedata->stablesetvars[i], &((*targetdata)->stablesetvars[i])) );
508 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &((*targetdata)->stablesets[i]), sourcedata->stablesetlengths[i]) );
509 for ( j = 0; j <sourcedata->stablesetlengths[i]; j++ )
511 (*targetdata)->stablesets[i][j] = sourcedata->stablesets[i][j];
516 (*targetdata)->constraintssize = tcliqueGetNNodes(sourcedata->graph);
517 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(*targetdata)->constraints, (*targetdata)->constraintssize) );
519 SCIP_CALL( SCIPtransformConss(scip, tcliqueGetNNodes(sourcedata->graph), sourcedata->constraints,
520 (*targetdata)->constraints) );
522 if( !tcliqueAddNode((*targetdata)->graph, tcliqueGetNNodes(sourcedata->graph)-1, 0) )
524 SCIPerrorMessage(
"could not add a node to the clique graph\n");
528 for ( i = 0; i < tcliqueGetNNodes(sourcedata->graph); i++ )
531 firstedge = tcliqueGetFirstAdjedge(sourcedata->graph, i);
532 lastedge = tcliqueGetLastAdjedge(sourcedata->graph, i);
533 while ( firstedge <= lastedge )
535 if ( *firstedge > i )
537 if( !tcliqueAddEdge((*targetdata)->graph, i, *firstedge) )
539 SCIPerrorMessage(
"could not add an edge to the clique graph\n");
547 if( !tcliqueFlush((*targetdata)->graph) )
549 SCIPerrorMessage(
"could not flush the clique graph\n");
563 assert(scip != NULL);
564 assert(probdata != NULL);
567 for ( i = 0; i < tcliqueGetNNodes((*probdata)->graph); i++)
569 SCIP_CALL( SCIPreleaseCons(scip, &((*probdata)->constraints[i])) );
571 SCIPfreeBlockMemoryArray(scip, &((*probdata)->constraints), (*probdata)->constraintssize);
574 for ( i = (*probdata)->nstablesets-1; i >= 0; i-- )
576 SCIPfreeBlockMemoryArray(scip, &((*probdata)->stablesets[i]), (*probdata)->stablesetlengths[i]);
577 SCIP_CALL( SCIPreleaseVar(scip, &((*probdata)->stablesetvars[i])) );
580 SCIPfreeBlockMemoryArray(scip, &((*probdata)->new2oldnode), tcliqueGetNNodes((*probdata)->oldgraph));
581 SCIPfreeBlockMemoryArray(scip, &((*probdata)->deletednodes), tcliqueGetNNodes((*probdata)->oldgraph));
582 SCIPfreeBlockMemoryArray(scip, &((*probdata)->stablesetvars), (*probdata)->maxstablesets);
583 SCIPfreeBlockMemoryArray(scip, &((*probdata)->stablesetlengths), (*probdata)->maxstablesets);
584 SCIPfreeBlockMemoryArray(scip, &((*probdata)->stablesets), (*probdata)->maxstablesets);
586 tcliqueFree(&(*probdata)->graph);
587 SCIPfreeBlockMemory(scip, probdata);
596 assert(probdata != NULL);
597 assert(*probdata != NULL);
599 SCIPfreeBlockMemoryArray(scip, &((*probdata)->new2oldnode), tcliqueGetNNodes((*probdata)->oldgraph));
600 SCIPfreeBlockMemoryArray(scip, &((*probdata)->deletednodes), tcliqueGetNNodes((*probdata)->oldgraph));
602 for ( i = (*probdata)->nstablesets-1; i >= 0; i-- )
604 SCIPfreeBlockMemoryArray(scip, &((*probdata)->stablesets[i]), (*probdata)->stablesetlengths[i]);
605 SCIP_CALL( SCIPreleaseVar(scip, &((*probdata)->stablesetvars[i])) );
607 SCIPfreeBlockMemoryArray(scip, &((*probdata)->stablesetvars), (*probdata)->maxstablesets);
608 SCIPfreeBlockMemoryArray(scip, &((*probdata)->stablesetlengths), (*probdata)->maxstablesets);
609 SCIPfreeBlockMemoryArray(scip, &((*probdata)->stablesets), (*probdata)->maxstablesets);
612 for ( i = 0; i < tcliqueGetNNodes((*probdata)->graph); i++ )
614 SCIP_CALL( SCIPreleaseCons(scip, &((*probdata)->constraints[i])) );
616 SCIPfreeBlockMemoryArray(scip, &((*probdata)->constraints), (*probdata)->constraintssize);
619 tcliqueFree(&((*probdata)->graph));
620 tcliqueFree(&((*probdata)->oldgraph));
623 SCIPfreeBlockMemory(scip, probdata);
638 SCIP_PROBDATA* probdata;
641 assert(SCIPeventGetType(event) == SCIP_EVENTTYPE_VARDELETED);
642 var = SCIPeventGetVar(event);
643 probdata = (SCIP_PROBDATA*) eventdata;
645 assert(probdata != NULL);
649 idx = (int)(
size_t) SCIPvarGetData(var);
651 SCIPdebugMessage(
"remove variable %s [%d] from list of stable sets\n", SCIPvarGetName(var), idx);
653 assert(probdata->stablesetvars[idx] == var);
656 SCIPfreeBlockMemoryArray(scip, &(probdata->stablesets[idx]), probdata->stablesetlengths[idx]);
657 SCIP_CALL( SCIPreleaseVar(scip, &(probdata->stablesetvars[idx])) );
660 for( ; idx < probdata->nstablesets - 1; idx++)
662 probdata->stablesets[idx] = probdata->stablesets[idx + 1];
663 probdata->stablesetlengths[idx] = probdata->stablesetlengths[idx + 1];
664 probdata->stablesetvars[idx] = probdata->stablesetvars[idx + 1];
665 SCIPvarSetData(probdata->stablesetvars[idx], (SCIP_VARDATA*) (
size_t) idx);
668 probdata->nstablesets--;
689 SCIP_PROBDATA* probdata = NULL;
694 printf(
"Creating problem: %s \n", name);
697 SCIP_CALL( SCIPallocBlockMemory(scip, &probdata) );
700 if( !tcliqueCreate(&((probdata)->oldgraph)) )
702 SCIPerrorMessage(
"could not create the clique graph\n");
707 if( !tcliqueAddNode((probdata)->oldgraph, nnodes-1, 0) )
709 SCIPerrorMessage(
"could not add a node to the clique graph\n");
715 for ( i = 0; i < nedges; i++ )
717 assert((edges[i][0] > 0) && (edges[i][0] <= nnodes));
718 assert((edges[i][1] > 0) && (edges[i][1] <= nnodes));
720 if( !tcliqueAddEdge((probdata)->oldgraph, edges[i][0]-1, edges[i][1]-1) )
722 SCIPerrorMessage(
"could not add an edge to the clique graph\n");
727 if( !tcliqueFlush((probdata)->oldgraph) )
729 SCIPerrorMessage(
"could not flush the clique graph\n");
734 probdata->constraintssize = nnodes;
735 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(probdata->constraints), probdata->constraintssize) );
738 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(probdata->stablesets), 2) );
739 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(probdata->stablesetlengths), 2) );
740 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(probdata->stablesetvars), 2) );
742 probdata->maxstablesets = 2;
743 probdata->nstablesets = 0;
747 eventExecProbdatavardeleted, NULL) );
750 SCIP_CALL( SCIPcreateProb(scip, name, probdelorigColoring, probtransColoring, probdeltransColoring,
751 NULL, NULL, NULL, probdata) );
766 SCIP_PROBDATA* probdata;
768 assert(scip != NULL);
769 probdata = SCIPgetProbData(scip);
770 assert(probdata != NULL);
772 return probdata->nstablesets;
781 SCIP_PROBDATA* probdata;
785 assert(scip != NULL);
786 probdata = SCIPgetProbData(scip);
787 assert(probdata != NULL);
789 for ( i = 0; i < probdata->nstablesets; i++ )
791 printf(
"Set %d: ", i);
792 for ( j = 0; j < probdata->stablesetlengths[i]; j++ )
794 printf(
"%d, ", probdata->stablesets[i][j]+1);
796 printf(
"ub = %f", SCIPvarGetUbLocal(probdata->stablesetvars[i]));
797 printf(
", inLP = %u", SCIPvarIsInLP(probdata->stablesetvars[i]));
809 SCIP_PROBDATA* probdata;
813 assert(scip != NULL);
814 probdata = SCIPgetProbData(scip);
815 assert(probdata != NULL);
818 printf(
"Set %d: ", i);
819 for ( j = 0; j < probdata->stablesetlengths[i]; j++ )
821 printf(
"%d, ", probdata->stablesets[i][j]+1);
823 if ( probdata->stablesetvars[i] != NULL )
824 printf(
"ub = %f", SCIPvarGetUbLocal(probdata->stablesetvars[i]));
838 SCIP_PROBDATA* probdata;
840 assert(scip != NULL);
841 probdata = SCIPgetProbData(scip);
842 assert(probdata != NULL);
843 assert((setindex >= 0) && (setindex < probdata->nstablesets));
846 SCIP_CALL( SCIPcatchVarEvent(scip, var, SCIP_EVENTTYPE_VARDELETED, SCIPfindEventhdlr(scip,
EVENTHDLR_NAME),
847 (SCIP_EVENTDATA*) probdata, NULL) );
849 probdata->stablesetvars[setindex] = var;
861 SCIP_PROBDATA* probdata;
863 assert(scip != NULL);
864 probdata = SCIPgetProbData(scip);
865 assert(probdata != NULL);
866 assert ( (setindex >= 0) && (setindex < probdata->nstablesets));
868 return probdata->stablesetvars[setindex];
879 SCIP_PROBDATA* probdata;
884 assert(scip != NULL);
885 probdata = SCIPgetProbData(scip);
886 assert(probdata != NULL);
889 u = probdata->stablesetlengths[setindex]-1;
893 if ( probdata->stablesets[setindex][m] == node )
897 if ( probdata->stablesets[setindex][m] > node )
901 if ( probdata->stablesets[setindex][m] < node )
922 assert(scip != NULL);
923 assert(set1 != NULL && set2 != NULL);
924 assert(nset1nodes > 0 && nset2nodes > 0);
926 if ( nset1nodes != nset2nodes )
930 for ( i = 0; i < nset1nodes; i++ )
932 if ( set1[i] != set2[i] )
951 SCIP_PROBDATA* probdata;
954 assert(stablesetnodes != NULL);
955 assert(scip != NULL);
956 probdata = SCIPgetProbData(scip);
957 assert(probdata != NULL);
960 SCIPsortDownInt(stablesetnodes, nstablesetnodes);
965 probdata->stablesets[i],
966 probdata->stablesetlengths[i]) )
985 SCIP_PROBDATA* probdata;
989 assert(stablesetnodes != NULL);
990 assert(scip != NULL);
991 probdata = SCIPgetProbData(scip);
992 assert(probdata != NULL);
996 for ( i = 0; i < nstablesetnodes-2; i++ )
998 assert(stablesetnodes[i]>stablesetnodes[i+1]);
1003 if ( (probdata->nstablesets + 1) > probdata->maxstablesets)
1005 newsize = SCIPcalcMemGrowSize(scip, probdata->maxstablesets + 1);
1006 assert(newsize > probdata->nstablesets + 1);
1007 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &(probdata->stablesets), probdata->maxstablesets, newsize) );
1008 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &(probdata->stablesetlengths), probdata->maxstablesets, newsize) );
1009 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &(probdata->stablesetvars), probdata->maxstablesets, newsize) );
1010 SCIPdebugMessage(
"Set-array resized: %d --> %d\n", probdata->maxstablesets, newsize);
1011 probdata->maxstablesets = newsize;
1015 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(probdata->stablesets[probdata->nstablesets]), nstablesetnodes) );
1016 probdata->stablesetlengths[probdata->nstablesets] = nstablesetnodes;
1017 probdata->stablesetvars[probdata->nstablesets] = NULL;
1018 for ( i = 0; i < nstablesetnodes; i++ )
1020 assert(stablesetnodes[i] >= 0);
1021 probdata->stablesets[probdata->nstablesets][i] = stablesetnodes[i];
1023 *setindex = probdata->nstablesets;
1025 probdata->nstablesets++;
1039 SCIP_PROBDATA* probdata;
1041 assert(scip != NULL);
1042 probdata = SCIPgetProbData(scip);
1043 assert(probdata != NULL);
1045 *stableset = probdata->stablesets[setindex];
1046 *nelements = probdata->stablesetlengths[setindex];
1058 SCIP_PROBDATA* probdata;
1060 assert(scip != NULL);
1061 probdata = SCIPgetProbData(scip);
1062 assert(probdata != NULL);
1064 *stablesets = probdata->stablesets;
1065 *nelements = probdata->stablesetlengths;
1066 *nstablesets = probdata->nstablesets;
1075 SCIP_PROBDATA* probdata;
1077 assert(scip != NULL);
1078 probdata = SCIPgetProbData(scip);
1079 assert(probdata != NULL);
1081 return tcliqueGetNNodes(probdata->graph);
1090 SCIP_PROBDATA* probdata;
1092 assert(scip != NULL);
1093 probdata = SCIPgetProbData(scip);
1094 assert(probdata != NULL);
1096 return tcliqueGetNNodes(probdata->oldgraph);
1106 SCIP_PROBDATA* probdata;
1108 assert(scip != NULL);
1109 probdata = SCIPgetProbData(scip);
1110 assert(probdata != NULL);
1112 return probdata->graph;
1121 SCIP_PROBDATA* probdata;
1123 assert(scip != NULL);
1124 probdata = SCIPgetProbData(scip);
1125 assert(probdata != NULL);
1127 return probdata->oldgraph;
1136 SCIP_PROBDATA* probdata;
1138 assert(scip != NULL);
1139 probdata = SCIPgetProbData(scip);
1140 assert(probdata != NULL);
1142 return probdata->deletednodes;
1151 SCIP_PROBDATA* probdata;
1153 assert(scip != NULL);
1154 probdata = SCIPgetProbData(scip);
1155 assert(probdata != NULL);
1157 return probdata->new2oldnode;
1168 SCIP_PROBDATA* probdata;
1171 assert(scip != NULL);
1172 probdata = SCIPgetProbData(scip);
1174 assert(probdata != NULL);
1179 if ( probdata->new2oldnode[i] == node )
1181 if ( probdata->new2oldnode[i] == -1 )
1194 SCIP_PROBDATA* probdata;
1196 assert(scip != NULL);
1197 probdata = SCIPgetProbData(scip);
1198 assert(probdata != NULL);
1200 return probdata->constraints;
1210 SCIP_PROBDATA* probdata;
1212 assert(scip != NULL);
1213 probdata = SCIPgetProbData(scip);
1214 assert(probdata != NULL);
1215 assert(node >= 0 && node < tcliqueGetNNodes(probdata->graph));
1217 return probdata->constraints[node];
1224 TCLIQUE_GRAPH* graph,
1225 TCLIQUE_GRAPH* cgraph
1234 assert(scip != NULL);
1235 assert(graph != NULL);
1236 assert(cgraph != NULL);
1239 nnodes = tcliqueGetNNodes(graph);
1243 if( !tcliqueAddNode(cgraph, nnodes-1, 0) )
1245 SCIPerrorMessage(
"could not add a node to the clique graph\n");
1251 for ( i = 0; i < nnodes; i++ )
1253 firstedge = tcliqueGetFirstAdjedge(graph, i);
1254 lastedge = tcliqueGetLastAdjedge(graph, i);
1255 for ( j = 0; j < *firstedge && j < i; j++ )
1257 if( !tcliqueAddEdge(cgraph, i, j) )
1259 SCIPerrorMessage(
"could not add an edge to the clique graph\n");
1263 while ( firstedge < lastedge )
1265 for ( j = *firstedge+1; j < *(firstedge+1) && j < i; j++ )
1267 if( !tcliqueAddEdge(cgraph, i, j) )
1269 SCIPerrorMessage(
"could not add an edge to the clique graph\n");
1277 if( !tcliqueAddEdge(cgraph, i, j) )
1279 SCIPerrorMessage(
"could not add an edge to the clique graph\n");
1285 if( !tcliqueFlush(cgraph) )
1287 SCIPerrorMessage(
"could not flush the clique graph\n");
1295 assert((tcliqueIsEdge(graph, i, j) && !tcliqueIsEdge(cgraph, i, j))
1296 || (!tcliqueIsEdge(graph, i, j) && tcliqueIsEdge(cgraph, i, j)));
1309 SCIP_CONS** constraints;
1313 assert(scip != NULL);
1316 assert(constraints != NULL);
1318 for ( i = 0; i < nnodes; i++ )
1320 char consname[SCIP_MAXSTRLEN];
1323 (void) SCIPsnprintf(consname, SCIP_MAXSTRLEN,
"Node-Constraint%d", i+1);
1325 SCIP_CALL( SCIPcreateConsSetcover(scip, &constraints[i], consname, 0, NULL, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE) );
1326 SCIP_CALL( SCIPaddCons(scip, constraints[i]) );
1342 assert(arraynodes != NULL);
1344 for ( i = 0; i < narraynodes; i++ )
1346 if ( arraynodes[i] == node )
1364 assert(array1nodes != NULL);
1365 assert(narray1nodes > 0);
1366 assert(array2nodes != NULL);
1367 assert(narray2nodes > 0);
1369 if ( narray1nodes != narray2nodes )
1373 for ( i = 0; i < narray1nodes; i++ )
1375 if ( array1nodes[i] != array2nodes[i] )
SCIP_RETCODE SCIPcreateProbColoring(SCIP *scip, const char *name, int nnodes, int nedges, int **edges)
void COLORprobPrintStableSets(SCIP *scip)
void COLORprobGetStableSet(SCIP *scip, int setindex, int **stableset, int *nelements)
static SCIP_RETCODE preprocessGraph(SCIP *scip)
SCIP_Bool COLORprobIsNodeInArray(int node, int *arraynodes, int narraynodes)
static SCIP_DECL_PROBTRANS(probtransColoring)
int COLORprobGetNewNodeForOriginalNode(SCIP *scip, int node)
TCLIQUE_GRAPH * COLORprobGetOriginalGraph(SCIP *scip)
SCIP_CONS ** COLORprobGetConstraints(SCIP *scip)
SCIP_RETCODE COLORprobAddNewStableSet(SCIP *scip, int *stablesetnodes, int nstablesetnodes, int *setindex)
int * COLORprobGetOriginalNodesForNewNodes(SCIP *scip)
SCIP_RETCODE COLORprobSetUpArrayOfCons(SCIP *scip)
int COLORprobGetNNodes(SCIP *scip)
int COLORprobGetOriginalNNodes(SCIP *scip)
SCIP_VAR * COLORprobGetVarForStableSet(SCIP *scip, int setindex)
static SCIP_DECL_EVENTEXEC(eventExecProbdatavardeleted)
static SCIP_DECL_PROBDELTRANS(probdeltransColoring)
void COLORprobGetStableSets(SCIP *scip, int ***stablesets, int **nelements, int *nstablesets)
SCIP_CONS * COLORprobGetConstraint(SCIP *scip, int node)
void COLORprobPrintStableSet(SCIP *scip, int setnumber)
SCIP_Bool COLORprobStableSetIsNew(SCIP *scip, int *stablesetnodes, int nstablesetnodes)
SCIP_Bool COLORprobStableSetsAreEqual(SCIP *scip, int *set1, int nset1nodes, int *set2, int nset2nodes)
SCIP_Bool COLORprobEqualSortedArrays(int *array1nodes, int narray1nodes, int *array2nodes, int narray2nodes)
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)
SCIP_RETCODE COLORprobAddVarForStableSet(SCIP *scip, int setindex, SCIP_VAR *var)
static SCIP_DECL_PROBDELORIG(probdelorigColoring)
int COLORprobGetNStableSets(SCIP *scip)
int * COLORprobGetDeletedNodes(SCIP *scip)
problem data for vertex coloring algorithm
SCIP_VAR ** stablesetvars