how to implement this algorithm
조회 수: 10 (최근 30일)
이전 댓글 표시
hi every one , i m trying to imliment this algorithm to solve a quadratic function:
Step 1 (Initial solution)
Find an initial solution using a basic local search algorithm
Step 2 (Tabu Search)
Repeat Steps 2.1 to 2.2 for Number Iterations iterations
2.1 (Explore the neighborhood)
2.1.1 Determine the best move while taking into
consideration the tabu moves and the aspiration
criteria. For each move x → x, we find the
solution by solving GPU(x). The cost of the
solution is the total cost of the network.
2.1.2 Determine the number of iterations (according
to a uniform distribution) for which the chosen
site is tabu.
2.2 (TS best solution update)
If the cost of the current solution is less than the cost of
the best solution found so far, update this best solution.
Step 3 (Multi-start)
3.1 (Update the solution)
If the cost of the current solution is less than the cost of
the best solution found so far, update this best solution.
3.2 (Stop condition)
If the number of start is smaller than the maximum
allowed number of starts go to step 2. Otherwise, return
the best cost found so far.
i try this:
% Initialiser le nombre d'itérations :
it_max=100;
it=1;
tic
% génération du solution initiale
S1=randi(SGM,1,eNodeB);
n=length(S1);
% Initialiser la liste de Taboue
tL=zeros(1,n);
% initialisé la meilleur solution
SB=S1;
% calculer le cout de la solution initiale
F=soleval(SB,SGM,eNodeB,c,h);
% initialisé le meilleur cout
FB=F;
%recherche de taboue
while(it<=it_max)
% Explorer le voisinage
best_cost=inf;
for j=1:n
if(tL(j)==0)
SV=perm1(SB,j);
FV=soleval1(SV,SGM,eNodeB,c,h);
% si le cout de la solution courante <cout de meilleur solution
% choisir le meilleur mouvement selon le cout
if FV< best_cost
best_cost =FV;
Bmv=j;
end
end
end
% mettre à jour la meilleur solution par la meilleur solution voisine
SB=perm1(SB,Bmv);
% mettre à jours la liste de Taboue
tL=tL-(tL>0);
% determiner le nombre des itérations pour lesquelle le mouvement
% choisit est tabou(valeur choisit aléatoirement en 5 et 9)
tL(Bmv)=7;
% si le cout de la solution courante <cout de meilleur solution
% mettre à jour la meilleur solution
if(best_cost<=FB)
FB=best_cost;
SB=SV;
end
it=it+1;
it
end
but, it dosent working , tha,k you for helping me.
댓글 수: 4
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!