protected override void InternalSolve() { ReinitializePrivates(); InitializeMoveFactories(); while (!TimeToEnd()) { _bestFactory = null; _bestMove = null; foreach (ITransformationFactory factory in MoveFactories) { if (TimeToEnd()) { break; } AssesMovesFromFactory(factory); } ChooseToPerform(); } if (_previousBest != null && _previousBest.IsBetterThan(Solution)) { Solution = _previousBest; _previousBest.RestoreStructures(); _scoringFunction.AssesSolution(Solution); } if (DiagnosticMessages) { Console.WriteLine($"Number of transformations performed {NumberOfMoves}."); } }
private void ReinitializePrivates() { _previousBest = null; _bestFactory = null; _bestMove = null; _numberOfLoopsWithoutImprovement = 0; _timeToStop = false; }
private void AssesMovesFromFactory(ITransformationFactory factory) { var moves = factory.GenerateMoves().ToList(); foreach (var move in moves) { if (TimeToEnd()) { break; } move.Asses(); if (FirstIsBetter(move, _bestMove)) { _bestMove = move; _bestFactory = factory; } } }
public TextService(ITransformationFactory transformationFactory) { _transformationFactory = transformationFactory; }
public CatsController(ICatService catService, ITransformationFactory transformationFactory) { CatService = catService; TransformationFactory = transformationFactory; }
public TransformationFactoryWrapper(ITransformationFactory factory) { _factory = factory; }
public TransformationProvider( ITransformationFactory factory) { _factory = factory; }