0

我在 TSPTW 问题中应用了禁忌搜索,但它给我的结果类似于使用交换枢轴规则(2 个城市之间的交换)获得最佳改进,但是在一些论文中,据说禁忌给出接近最优的结果(我有使用另一种算法的具有 0 个约束违反的相同初始解决方案的最佳解决方案)。所以我想确定一下,这个结果正常吗?这是我应用禁忌的伪代码:

Running Tabu for number of iteration
Tabu tenure=7
list TabuList
with each solution I saved, the two exchanged cities
bestsol=initial solution
currsol=initial solution
tabufun()
{
   while(i<iteration)
   {
    i++;
    currsol=bestneighbourhood(currsol)
    if(currsol.fitness < bestsol.fitness)  // curr is better than best
      bestsol=currsol
  }
return bestsol // result of tabu search
}

bestneighbourhood(currsol)
{
  solutions=getallexchanepossiblesolution(currsol)
  // if for first time save global min, firsttime is global variable set to true
 for(each sol in solutions)
{
   bestneigh=sol;
   if(firstTime)
  {
      globalmin= sol.fitness
      firsttime=false
  }
if(sol.fitness()<globalmin)
{
   globalmin=sol.fitness()
}
   check if cityi and cityj existing in tabulist
   if not existing
  {
    //update all elements in tabulist, element has tabu value=0 remove it from list
    //and decrement tabu value of others
    //add cityi and cityj in tabu list with intial tabu value=tabu tenure
    break;
  }
  else
 {
   //check for aspiration
   if(sol.fitness<globalmin)
   {
     //update tabu list
     //reinitialize this cityi and cityj with tabu tenure
   break;
 }
else
 conitnue

}
 return bestneigh

}

4

0 回答 0