Simulated Annealing fix (#910)
* @Async and Spring Security * @Async with SecurityContext propagated * Spring and @Async * Simulated Annealing algorithm * Simulated Annealing algorithm * Rebase * Rebase * SA further fixes
This commit is contained in:
parent
c2f7711923
commit
daa711d5a3
|
@ -17,11 +17,9 @@ public class SimulatedAnnealing {
|
|||
if (t > 0.1) {
|
||||
currentSolution.swapCities();
|
||||
double currentDistance = currentSolution.getDistance();
|
||||
if (currentDistance == 0)
|
||||
continue;
|
||||
if (currentDistance < bestDistance) {
|
||||
bestDistance = currentDistance;
|
||||
} else if (Math.exp((currentDistance - bestDistance) / t) < Math.random()) {
|
||||
} else if (Math.exp((bestDistance - currentDistance) / t) < Math.random()) {
|
||||
currentSolution.revertSwap();
|
||||
}
|
||||
t *= coolingRate;
|
||||
|
|
Loading…
Reference in New Issue