public IEnumerable<ExecutionResult> Solve(ExecutionRequest request) { var moves = new List<MoveDirection>(); ExecutionResult best = null; for (int i = 0; i < MaxIterations; i++) // while (true) { best = new SearchSolver().Solve(request).First(); moves.AddRange(best.Commands); // select best move and move from it if (best.Snapshot.Finished) { break; }; request = new ExecutionRequest { Snapshot = best.Snapshot, Options = request.Options }; request.Options.MinEstimation = double.MinValue; } return new[] { new ExecutionResult { Snapshot = best.Snapshot, Commands = moves.ToArray(), Estimate = best.Estimate } }; }
public MainWindow() { InitializeComponent(); _input = JsonConvert.DeserializeObject<Input>(File.ReadAllText("input.json")); var options = JsonConvert.DeserializeObject<ExecutionOptions>(File.ReadAllText("options.json")); //new ExecutionOptions //{ // MaxWidth = 4, // MaxHeight = 6, // MinEstimation = double.MinValue, // AttractorRatio = 10, // DepthPenaltyRatio = 10, // //HiddenHolesPenalty = 10, // AdjacencyDownRatio = 5 //} _execution = new ExecutionRequest { Snapshot = new Snapshot(_input, _input.SourceSeeds.First()), Options = options }; _solver = new IterativeSearchSolver(4000); //new TraverseSolver(); SizeChanged += (s, e) => Update(); commandBar.SpawnEvent += commandBarSpawnEvent; commandBar.Move += commandBarMove; commandBar.StartSolver += commandBarStartSolver; }
public IEnumerable<ExecutionResult> Solve(ExecutionRequest request) { return Calculate( request.Snapshot, null, request.Options, (int)Math.Ceiling(request.Options.MaxHeight), request.Options.MinEstimation); }
private static ExecutionResult Calculate(Snapshot snapshot, ExecutionOptions options) { var request = new ExecutionRequest { Snapshot = snapshot, Options = options }; var solver = new IterativeSearchSolver(1200); //new TraverseSolver(); return solver.Solve(request).First(); }