assert(colors !=
NULL);
139 for( i = 0; i <
nnodes; i++)
167 int* stablesetnodes;
170assert(graph !=
NULL);
171assert(colors !=
NULL);
174 nnodes= tcliqueGetNNodes(graph);
185 for( i = 0; i <
nnodes; i++ )
188values[i] = degrees[i] + ( colors[i] == -1 ?
nnodes: 0);
195stablesetnodes[0] = sortednodes[0];
197 for( i = 1; i <
nnodes; i++)
199 if( colors[sortednodes[i]] != -1 )
204 for( j = 0; j < nstablesetnodes; j++ )
206 if( tcliqueIsEdge(graph, sortednodes[i], stablesetnodes[j]) )
212 if( indNode ==
TRUE)
214stablesetnodes[nstablesetnodes] = sortednodes[i];
219 for( i = 0; i < nstablesetnodes; i++ )
221assert(colors[stablesetnodes[i]] == -1);
222colors[stablesetnodes[i]] = nextcolor;
246assert(graph !=
NULL);
247assert(colors !=
NULL);
252 for( i = 0; i <
nnodes; i++ )
284assert(graph !=
NULL);
285assert(colors !=
NULL);
288 nnodes= tcliqueGetNNodes(graph);
292 for( i = 0; i <
nnodes; i++ )
296 if( colors[i] == colors[*j] )
343assert(graph !=
NULL);
344assert(heurdata !=
NULL);
345assert(success !=
NULL);
347 if( heurdata->output >= 1 )
348printf(
"Running tabu coloring with maxcolors = %d...\n", maxcolors);
351 nnodes= tcliqueGetNNodes(graph);
356 for( i = 0; i <
nnodes; i++ )
358 if( colors[i] < 0 || colors[i] >= maxcolors )
361colors[i] = rnd % maxcolors;
363assert( 0 <= colors[i] && colors[i] < maxcolors );
372 for( i = 0; i <
nnodes; i++ )
376 for( j = 0; j < maxcolors; j++ )
387 for( node1 = 0; node1 <
nnodes; node1++ )
389color1 = colors[node1];
392 while( firstedge <= lastedge )
395color2 = colors[node2];
396assert( 0 <= color2 && color2 < maxcolors );
397(adj[node1][color2])++;
398 if( color1 == color2 )
403assert( obj % 2 == 0 );
408restrictive =
FALSE;
413 for( iter = 1; iter <= heurdata->maxiter; iter++ )
420 for( node1 = 0; node1 <
nnodes; node1++ )
423color1 = colors[node1];
424assert( 0 <= color1 && color1 < maxcolors );
427 if( adj[node1][color1] > 0 )
431 for( j = 0; j < maxcolors; j++ )
437d = adj[node1][j] - adj[node1][color1];
442 if( heurdata->output >= 1 )
443printf(
" Feasible solution found after %d iterations!\n\n", iter);
452 if( tabu[node1][j] < iter && d < minvalue )
471assert( minnode != -1 );
472assert( mincolor >= 0 );
475assert( colors[minnode] != mincolor );
476oldcolor = colors[minnode];
477colors[minnode] = mincolor;
483 if( heurdata->output == 2 && (iter) % (heurdata->dispfreq) == 0 )
485printf(
"Iter: %d obj: %d critical: %d node: %d color: %d delta: %d\n", iter, obj, ncritical, minnode,
494assert( tabu[minnode][oldcolor] < iter );
495tabu[minnode][oldcolor] = iter + (heurdata->tabubase) + (
int) (((double) ncritical) * (heurdata->tabugamma));
500(adj[*firstedge][mincolor])++;
501(adj[*firstedge][oldcolor])--;
505 if( heurdata->output == 2 )
507printf(
"Best objective: %d\n ", bestobj);
510printf(
"\nTabu list is probably too restrictive.\n");
514 if( heurdata->output >= 1 && bestobj != 0 )
516printf(
" No feasible solution found after %d iterations!\n\n", iter-1);
519 for( i = 0; i <
nnodes; i++ )
528*success = (obj == 0);
543assert(heur !=
NULL);
591assert(heurdata !=
NULL);
606assert(constraints !=
NULL);
611 if( heurdata->usetabu )
624 for( i = 0; i <
nnodes; i++ )
625bestcolors[i] = colors[i];
631 for( i = 0; i <= ncolors; i++ )
635 for( j = 0; j <
nnodes; j++ )
637 if( bestcolors[j] == i )
639colors[nstablesetnodes] = j;
645 for( j = 0; j <
nnodes; j++ )
648 for( k = 0; k < nstablesetnodes; k++ )
650 if( j == colors[k] || tcliqueIsEdge(graph, j, colors[k]) )
657 if( indnode ==
TRUE)
659colors[nstablesetnodes] = j;
667assert(setnumber != -1);
677 for( j = 0; j < nstablesetnodes; j++ )
692assert(sol !=
NULL);
732assert(heur !=
NULL);
739 "heuristics/initcol/usetabu",
740 "should the tabu search heuristic be used in order to improve the greedy-solution?",
744 "heuristics/initcol/maxiter",
745 "maximal number of iterations to be performed in each tabu-run",
749 "heuristics/initcol/tabubase",
750 "constant part of the tabu-duration",
754 "heuristics/initcol/tabugamma",
755 "factor for the linear part of the tabu-duration",
759 "heuristics/initcol/output",
760 "verbosity level for the output of the tabu search, 0: no output, 1: normal, 2: high",
764 "heuristics/initcol/dispfreq",
765 "frequency for displaying status information, only active with output verbosity level 2",
Constraint handler for the set partitioning / packing / covering constraints .
constraint handler for storing the graph at each node of the tree
SCIP_RETCODE SCIPaddCoefSetppc(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
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 SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
SCIP_RETCODE SCIPincludeHeurBasic(SCIP *scip, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, SCIP_HEURTIMING timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata)
SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
const char * SCIPheurGetName(SCIP_HEUR *heur)
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
#define SCIPallocMemoryArray(scip, ptr, num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPfreeMemoryArray(scip, ptr)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
SCIP_RETCODE SCIPtrySolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
SCIP_RETCODE SCIPcreateVar(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype, SCIP_Bool initial, SCIP_Bool removable, SCIP_DECL_VARDELORIG((*vardelorig)), SCIP_DECL_VARTRANS((*vartrans)), SCIP_DECL_VARDELTRANS((*vardeltrans)), SCIP_DECL_VARCOPY((*varcopy)), SCIP_VARDATA *vardata)
SCIP_RETCODE SCIPchgVarUbLazy(SCIP *scip, SCIP_VAR *var, SCIP_Real lazyub)
void SCIPsortDownIntInt(int *intarray1, int *intarray2, int len)
void SCIPsortDownInt(int *intarray, int len)
static SCIP_RETCODE greedyStableSet(SCIP *scip, TCLIQUE_GRAPH *graph, int *colors, int nextcolor)
static SCIP_RETCODE runTabuCol(TCLIQUE_GRAPH *graph, int seed, int maxcolors, int *colors, SCIP_HEURDATA *heurdata, SCIP_Bool *success)
#define DEFAULT_TABUGAMMA
SCIP_RETCODE SCIPincludeHeurInit(SCIP *scip)
static SCIP_DECL_HEURCOPY(heurCopyInit)
static SCIP_DECL_HEUREXEC(heurExecInit)
static SCIP_RETCODE greedyInitialColoring(SCIP *scip, TCLIQUE_GRAPH *graph, int *colors, int *ncolors)
static SCIP_Bool hasUncoloredNode(int nnodes, int *colors)
static int getNViolatedEdges(TCLIQUE_GRAPH *graph, int *colors)
static SCIP_DECL_HEURFREE(heurFreeInit)
initial primal heuristic for the vertex coloring problem
variable pricer for the vertex coloring problem
SCIP_CONS ** COLORprobGetConstraints(SCIP *scip)
SCIP_RETCODE COLORprobAddNewStableSet(SCIP *scip, int *stablesetnodes, int nstablesetnodes, int *setindex)
int COLORprobGetNNodes(SCIP *scip)
SCIP_VAR * COLORprobGetVarForStableSet(SCIP *scip, int setindex)
TCLIQUE_GRAPH * COLORprobGetGraph(SCIP *scip)
SCIP_RETCODE COLORprobAddVarForStableSet(SCIP *scip, int setindex, SCIP_VAR *var)
int COLORprobGetNStableSets(SCIP *scip)
problem data for vertex coloring algorithm
file reader for vertex coloring instances
int * tcliqueGetLastAdjedge(TCLIQUE_GRAPH *tcliquegraph, int node)
int * tcliqueGetDegrees(TCLIQUE_GRAPH *tcliquegraph)
int * tcliqueGetFirstAdjedge(TCLIQUE_GRAPH *tcliquegraph, int node)
struct TCLIQUE_Graph TCLIQUE_GRAPH
struct SCIP_HeurData SCIP_HEURDATA
enum SCIP_Retcode SCIP_RETCODE
struct SCIP_VarData SCIP_VARDATA
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4