public GAAStarLazy(Maze maze, bool mark_path, bool step_by_step, TieBreakingStrategy tie_breaking_strategy, Heuristic heuristic, int neighborhood) { h = maze.GetH(); w = maze.GetW(); open_list = new BinaryHeap(w * h); graph = new GAAStarNode[h, w]; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { graph[y, x] = new GAAStarNode(maze.GetMazeCell(x, y), tie_breaking_strategy); //مقدار کشف کننده فعلاً تعیین نمیشود } } this.heuristic = heuristic; this.mark_path = mark_path; this.step_by_step = step_by_step; this.neighborhood = neighborhood; goal = graph[maze.GetGoal().Y, maze.GetGoal().X]; start = graph[maze.GetStart().Y, maze.GetStart().X]; new_goal = null; path_cost_last_execution = n_searches = 0; unblocked_cells = null; piece_of_pseudo_code_being_executed = PieceOfPseudoCode.Null;// null; delta_h = new List <int>(); path_cost = new List <int>(); delta_h.Add(0); /* delta_h(0) := 0 */ path_cost.Add(0); /* path_cost(0) := 0 */ }
public GAAStarNode(Cell maze_cell, TieBreakingStrategy tie_breaking_strategy) { this.maze_cell = maze_cell; search = 0; f = g = h = INFINITY_INT; this.tie_breaking_strategy = tie_breaking_strategy; }
/* Public: */ public AStar(Maze maze, bool mark_path, bool step_by_step, TieBreakingStrategy tie_breaking_strategy, Heuristic heuristic, int neighborhood) { h = maze.GetH(); w = maze.GetW(); open_list = new BinaryHeap(w * h); graph = new AStarNode[h, w]; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { graph[y, x] = new AStarNode(maze.GetMazeCell(x, y), tie_breaking_strategy); graph[y, x].h = heuristic.DistanceToGoal(graph[y, x].GetMazeLightCell(), maze.GetGoal()); } } has_solution = false; this.mark_path = mark_path; this.step_by_step = step_by_step; this.neighborhood = neighborhood; goal = graph[maze.GetGoal().Y, maze.GetGoal().X]; start = graph[maze.GetStart().Y, maze.GetStart().X]; start.parent = null; start.g = start.GetMazeLightCell().GetCost(); start.f = start.g + start.h; open_list.Insert(start); }
/* Public: */ public DStarLite(Maze maze, bool mark_path, bool step_by_step, TieBreakingStrategy tie_breaking_strategy, Heuristic heuristic, int neighborhood) { h = maze.GetH(); w = maze.GetW(); open_list = new BinaryHeap(w * h); graph = new DStatLiteNode[h, w]; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { graph[y, x] = new DStatLiteNode(maze.GetMazeCell(x, y), tie_breaking_strategy); graph[y, x].h = heuristic.DistanceToGoal(graph[y, x].GetMazeCell(), maze.GetGoal()); if (maze.cells[y, x].GetCost() == 0x7F) { graph[y, x].type_robot_vision = 1; //graph[y, x].real_type = 1; } else { graph[y, x].type_robot_vision = 0; //graph[y, x].real_type = 0; } graph[y, x].g = (graph[y, x].rhs = 2147483647); graph[y, x].iteration = mazeiteration; graph[y, x].parent = null; } } has_solution = false; this.mark_path = mark_path; this.step_by_step = step_by_step; this.neighborhood = neighborhood; goal = graph[maze.GetGoal().Y, maze.GetGoal().X]; start = graph[maze.GetStart().Y, maze.GetStart().X]; start.parent = null; start.g = start.GetMazeCell().GetCost(); start.f = start.g + start.h; open_list.Insert(start); //------------------------------ this.cde = new Key.Key_comparator(); this.u = new TreeSet(this.cde); this.goal.rhs = 0; //this.iteration += 1; this.u.clear(); this.u.add(new Key(this.goal)); this.goal.real_type = (this.goal.type_robot_vision = 0); this.start.real_type = (this.start.type_robot_vision = 0); }
public Node(int x, int y) { this.parent = null; this.X = x; this.Y = y; this.h = 0; this.used = false; this.type_robot_vision = (this.real_type = 0); this.g = (this.rhs = 2147483647); this.iteration = 0; tie_breaking_strategy = TieBreakingStrategy.HIGHEST_G_VALUES; }
public Node(Cell maze_cell, TieBreakingStrategy tie_breaking_strategy) { closed = false; this.maze_cell = maze_cell; this.tie_breaking_strategy = tie_breaking_strategy; this.parent = null; this.maze_cell.X = maze_cell.X; this.maze_cell.Y = maze_cell.Y; this.h = 0; this.used = false; this.type_robot_vision = (this.real_type = 0); this.g = (this.rhs = 2147483647); this.iteration = 0; }
private void comboTieBreaking_SelectedIndexChanged(object sender, EventArgs e) { switch (comboTieBreaking.SelectedIndex) { case 0: tie_breaking_strategy = TieBreakingStrategy.HIGHEST_G_VALUES; break; case 1: tie_breaking_strategy = TieBreakingStrategy.SMALLEST_G_VALUES; break; case 2: tie_breaking_strategy = TieBreakingStrategy.NONE; break; } }
public AStarNode(Cell maze_cell, TieBreakingStrategy tie_breaking_strategy) { closed = false; this.maze_cell = maze_cell; this.tie_breaking_strategy = tie_breaking_strategy; }