1 package aco
.strategy
.acs
;
6 import aco
.mediator
.acs
.*;
8 public class ACSPheromoneStrategy
9 extends PheromoneStrategy
{
11 public ACSPheromoneStrategy(ACSMediator acom
) {
12 super((ACOMediator
) acom
);
15 //global Pheromone Update
16 public void pheromoneUpdate(Ant
[] ants
) {
17 double deltaTau
= 1.0 / (double)acom
.getGlobalBestTourLength();
20 for (int i
= 0; i
< acom
.getNumOfCities(); i
++) {
21 j
= acom
.getGlobalBestTour(i
);
22 l
= acom
.getGlobalBestTour(i
+1);
23 acom
.setPheromone(j
, l
,
24 ( (1 - acom
.getRoh()) * acom
.getPheromone(j
, l
) ) +
25 (acom
.getRoh() * deltaTau
) );
27 //g.pheromones[l][j] = g.pheromones[j][l];
28 acom
.setChoiceInformation(j
, l
,
29 acom
.getPheromone(j
, l
) *
30 Math
.pow((1.0/ acom
.getDistance(j
, l
) ), acom
.getBeta()));
32 //g.choice_info[j][l] = g.pheromones[j][l] *
33 //Math.pow((1.0/g.distance_matrix[j][l]), beta);
34 //g.choice_info[l][j] = g.choice_info[l][j];
38 //local Pheromone Update
39 public void localPheromoneUpdate(Ant k
, int i
) {
40 int j
= k
.getTour(i
-1);
43 acom
.setPheromone(j
, l
,
44 ( (1 - acom
.getRoh()) * acom
.getPheromone(j
, l
) ) +
45 ( acom
.getRoh() * acom
.getTauZero() ));
47 //g.pheromones[l][j] = g.pheromones[j][l];
48 acom
.setChoiceInformation(j
, l
,
49 acom
.getPheromone(j
, l
) *
50 Math
.pow( (1.0/acom
.getDistance(j
, l
)), acom
.getBeta() ) );
53 protected void depositPheromone(Ant ant
) {}
55 protected void evaporate() {}