fix an issue in the global update
This commit is contained in:
		| @@ -110,10 +110,11 @@ class Colony: | ||||
|                 if None == bestCandidate or candidate[0] < bestCandidate[0]: | ||||
|                     bestCandidate = candidate | ||||
|  | ||||
|                 dTheta = 1.0 / ((candidate[0].total_seconds() / 60.0) or 1.0) | ||||
|                 for i in range(1, len(candidate[1])): | ||||
|                     update = (1.0 - self.Configuration.Epsilon) * self.PheromoneMatrix[candidate[1][i - 1], candidate[1][i]] + dTheta | ||||
|                     self.PheromoneMatrix[candidate[1][i - 1], candidate[1][i]] = max(update, self.Configuration.ThetaZero) | ||||
|                 if None != bestSequence: | ||||
|                     dTheta = 1.0 / ((bestSequence[0].total_seconds() / 60.0) or 1.0) | ||||
|                     for i in range(1, len(bestSequence[1])): | ||||
|                         update = (1.0 - self.Configuration.Epsilon) * self.PheromoneMatrix[bestSequence[1][i - 1], bestSequence[1][i]] +  self.Configuration.Epsilon * dTheta | ||||
|                         self.PheromoneMatrix[bestSequence[1][i - 1], bestSequence[1][i]] = max(update, self.Configuration.ThetaZero) | ||||
|  | ||||
|             # check if we find a new best candidate | ||||
|             if None != bestCandidate: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user