Tabu Algorithms for Graph Coloring

Determine the number of conflicting edges:

  Traverse the adjacency matrix of the graph, search for edges, and get the vertex numbers at both ends of the edge. Then use the vertex_color[] array to query the coloring of the two vertices, record if they are equal, otherwise query the next edge.

Among them, vertex_color[] is initialized when the solution is initialized. What is stored is the coloring of each vertex.

Choose to move:

  Moves need to be divided into two categories: taboo moves and non-taboo moves. The reason for recording non-taboo moves is to unlock the ban mechanism - to prevent good solutions from being banned, which greatly reduces the efficiency of the algorithm. Movement is for vertices, so the outer loop is a loop traversal of vertices. In the inner loop, it is first necessary to determine whether this point is a conflict point--judging by whether adjacent_color_table[vertex][current_color] is equal to 0, if it is equal to 0 , it means that there are no neighbors with the same color as him, that is, no processing is required; otherwise, it needs to be processed. The processing method is to calculate Δ(u,i,j)=M[u][j]-M[u][i], and then it is necessary to judge whether the move is a taboo move or a non-taboo move--directly judge by tabutenure_table, store the move The minimum delta, tabu_delta.

  [When judging the type of move, the judgment of current_color==move_color is passed directly, and this situation is not handled]

  For taboo move, two judgment conditions are required: 1.tabu_delta < delta; 2.tabu_delta+f<best_f -- the number of conflicting edges of the solution after the move is less than the number of conflicting edges of the best solution in history;

  For non-taboo move, a move is randomly selected;

  Then there is, implement move. Here is mainly to modify and update some information: vertex_color[] , adjacent_color_table , tabu_tenure_table , f ---conflict_edges , best_f

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325816443&siteId=291194637