Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in...

27
Ricochet Robots Mitch Powell Daniel Tilgner

Transcript of Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in...

Page 1: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Ricochet RobotsMitch PowellDaniel Tilgner

Page 2: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Abstract

•Ricochet robots is a board game created in Germany in 1999.

•A player is given 30 seconds to find a best solution to the presented board.

•Our goal is to develop an algorithm that finds a minimal solution as quickly as possible.

Page 3: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

So what exactly is ricochet robots?

•A board game in which the object is to move a specific robot to an end location in as few steps as possible using the following restrictions:▫A robot can only move in the four cardinal

directions, not diagonally.▫When moved, the robot will continue

moving until it reaches a wall or another robot at which time it will stop. This constitutes one step.

Page 4: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.
Page 5: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.
Page 6: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.
Page 7: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.
Page 8: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.
Page 9: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.
Page 10: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.
Page 11: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.
Page 12: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

The Problem• Given an directed graph G=(V , E) let V be the set of all vertices contained

in the graph, each representing a square on the board and E be the set of all edges connecting V where each vertex w contained in V can be defined as w = (Occ. , Targ.) where Occ. is a temporal variable describing the occupation of the square and can be either a 1 describing an occupied square or a 0 describing an unoccupied square and Targ. can be either a 0 representing that the square is not the target of the objective robot or a 1 representing that the square is the target of the objective robot. Given a target robot on a square v in V such that v = (1,0) and a target square t in V such that t = (0,1) let a function P(i,j) describes a number of edge traversals on a path between two squares i and j in V. Find a P’(v , t) such that P’(v , t) ≤ P (v , w) for all P.

• A stipulation on the problem is that there may exist more than one occupied square w in V such that w = (1,0). The robots occupying each square w where w ≠ v may traverse their own paths under the condition that the traversal of such a robot from its original square w to another square t means that w = (0,0) and t = (1,0). This change makes t unreachable.

Page 13: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Wait what.

Page 14: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Informally, please.

•For a given board configuration, find the path for the specified robot to reach the target space in as few steps as possible.

•As each robot can be moved at any time, available paths are updated after each movement.

•The movement of any robot counts as one step.

Page 15: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Contributions

•Michael Fogleman▫Wrote a solver using iterative deepening.▫We used this solver as a benchmark for

checking solutions.•Randy Coulman

▫Using pre-computing to create estimates for an A* algorithm.

Page 16: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Statement and implementation

•Breadth-First Search▫Generate a state tree where any state of

the board was given by moving a robot in any available direction.

▫Breadth-first traversal of state tree until a solution is found.

▫As soon as a solution is found it is guaranteed to be a minimal path (at which point the algorithm stops).

Page 17: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

BFS cont.

•Optimization:▫No-memoization▫Visited states with linear search▫Visited states with binary search▫Visited states with hash set

Board states were condensed to 8-byte strings where non-object robots were indistinct from one another.

Page 18: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Branch and Bound• Generating a state tree of all possible candidate

solutions.• Initial “best” path found by attempting to move

objective robot towards the goal without moving the other robots.

• While the step count for each branch is less than the current best solution, the branch is traversed depth-first.

• If the goal is reached, that new path becomes the best solution and the next branch is explored until all branches have been checked.

• Guaranteed to find the shortest path by exhaustion.

Page 19: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

A* and Iterative Deepening• Many alternative solutions exist. Michael Fogleman

used iterative deepening to create a fast solver while Randy Coulman used an A* algorithm.

• Iterative deepening is a depth-first search in which the depth is increased with each iteration. It is essentially equivalent to a breadth-first search, but on each iteration it instead visits the nodes in the same order as a depth first search.

• A* traverses a graph and builds a tree of partial paths as it does so. The leaves are stored in a priority queue where the cost is the distance traveled plus an estimate of the distance to the goal.

Page 20: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Evidence

•Maximum number of steps through all trials: 16 (i.e. we encountered no board configuration that took more than 16 steps to solve)

•Average number of steps through all trials: 6.3

•BFS with Hash table average time to solve: 829 milliseconds

•BFS with Binary search average time to solve: 2160 milliseconds

Page 21: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Holes

•Lack of evidence that prioritization of the objective bot results in a minimal number of visited states.

•Not distinguishing between objective robots has the same issue.

•While no unsolvable boards have been found, this doesn’t preclude the possibility that some could exist.

•There could be methods/tools for increasing the speed of the process.

Page 22: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Interpretation• Breadth-first search with a hash algorithm is

the best solution we found for average case or longer solutions.

• As the number of visited states gets higher, it gets more and more important to efficiently search the list of visited states.

• Without dynamic programming, the BFS becomes significantly less useful.

• So far, no solution longer than 7 steps has been able to be returned without dynamic programming.

Page 23: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Interpretation cont.

•Branch and bound runs very quickly if lower bounded solution is found very early into the search. Otherwise it is forced to run an exhaustive search with a large upper bound, increasing time needed dramatically.

•Could be useful in application purposes to test a solution by giving it a small bound.

Page 24: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Conclusions

•Breadth-first search seems to be the best solution to the problem. It guarantees a best solution and for boards where the best solution is small, it is incredibly fast.

•Other algorithms which rely on estimates and predictions such as A* or branch and bound depend heavily on initial conditions.

Page 25: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Future Work

•Generating pre-computed boards•Maintain a list of known board setups

with large step solutions•Other algorithms to try (A*, B*, alpha-beta

pruning, etc.)•Buying a physical copy and clowning my

friends

Page 26: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Questions

•What algorithm design technique made breadth-first search viable?

•What is the worst-case starting branching factor?

•What algorithm would you use to input and test your own solution?

Page 27: Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in 1999. A player is given 30 seconds to find.

Answers

•What algorithm design technique made breadth-first search viable?▫Dynamic Programming

•What is the worst-case starting branching factor?▫16 (4 robots with 4 directions each)

•What algorithm would you use to input and test your own solution?▫Branch and Bound