using System.Collections.Generic; namespace MetaheuristicsPCL { public abstract class GradientDescentAlgorithm : Algorithm { protected ISolution currentSolution; public override sealed void Solve(IProblem _pb, IHM _ihm) { base.Solve(_pb, _ihm); currentSolution = pb.RandomSolution(); while (!Done()) { List Neighbours = pb.Neighbourhood(currentSolution); if (Neighbours != null) { ISolution bestSolution = pb.BestSolution(Neighbours); UpdateSolution(bestSolution); } Increment(); } SendResult(); } protected abstract bool Done(); protected abstract void UpdateSolution(ISolution _bestSolution); protected abstract void Increment(); } }