public TabuSearch(ITrajectorySearch sol, uint seconds) { this.sol = sol; tabuList = new ArrayList(); locker = new object(); SetTime(seconds); }
public bool boltzman(ITrajectorySearch s_temp, ITrajectorySearch s) { if (r.Next(0, 2) < Math.Pow(Math.E, -((s_temp.ObjectifFunction() - s.ObjectifFunction()) / temperature))) { return true; } return false; }
public SimulatedAnnealing(ITrajectorySearch m, double alfa, uint seconds) { if (alfa <= 0 && alfa >= 1) { throw (new Exception("Wrong temperature adjust")); } this.alfa = alfa; sol = m; r = new Random(); locker = new object(); SetTime(seconds); }
public void Solve() { ITrajectorySearch min = sol; sol = sol.GenerateInitialSolution(); while (!sol.StopSearch() && !stopProcess) { lock (locker) { sol = sol.AdjustSolution(); if (sol.ObjectifFunction() < min.ObjectifFunction()) { min = sol; } } } if (tm != null) { StopTimer(); } }
public void Solve() { sol = sol.GenerateInitialSolution(); while (!sol.StopSearch() && !stopProcess) { // find a better neighbourgh solution ITrajectorySearch sTemp = sol.AdjustSolution(); if(!tabuList.Contains(sTemp.ObjectifFunction())) { // lock (locker) { tabuList.Add(sTemp.ObjectifFunction()); if (sTemp.ObjectifFunction() > sol.ObjectifFunction()) { sol = sTemp; } // } } } if(tm!=null) StopTimer(); }
public void Solve() { ITrajectorySearch solTemp; sol = sol.GenerateInitialSolution(); temperature = 1; while (!sol.StopSearch() && !stopProcess) { lock (locker) { solTemp = sol.AdjustSolution(); if (solTemp.ObjectifFunction() > sol.ObjectifFunction() || boltzman(solTemp, sol)) { sol = solTemp; } updateTemperature(); } } if (tm != null) { StopTimer(); } }
public TabuSearch(ITrajectorySearch sol) { this.sol = sol; tabuList = new ArrayList(); locker = new object(); }
public IterativeLocalSearch(ITrajectorySearch sol, uint seconds) { this.sol = sol; locker = new object(); SetTime(seconds); }