Slide 1

Slide 1 text

Hipster: An Open Source Java Library for Heuristic Search Pablo Rodríguez-Mier, Adrián González-Sieira, Manuel Mucientes, Manuel Lama, Alberto Bugarín. Centro Singular de Investigación en Tecnoloxías da Información Universidade de Santiago de Compostela 16 de junio de 2014 citius.usc.es

Slide 2

Slide 2 text

Problem Solving as State Space Search - I Many AI problems can be formulated as State Space Search. We have a problem and we need to find a solution: Where do we start from? What is the solution of the problem? How can we assess the quality of a solution of a problem? Which actions or steps can we take in order to solve it? How can we estimate how far we are from the solution during the search? Examples: 16 de junio de 2014 1/26

Slide 3

Slide 3 text

Problem Solving as State Space Search - II In a nutshell, a state space search problem is defined in terms of states, actions and transitions. States: representation of a particular configuration of our problem. Initial state: where we start searching from. Goal state: state which represents a valid solution. Actions: description of the possible actions or movements that we can do from a given state. Transitions: describe how actions lead from one given state to a different state. The solution to a problem is the sequence of actions that lead from the initial state to the goal state. 16 de junio de 2014 2/26

Slide 4

Slide 4 text

8-Puzzle game example - Step 1 16 de junio de 2014 3/26

Slide 5

Slide 5 text

8-Puzzle game example - Step 2 16 de junio de 2014 4/26

Slide 6

Slide 6 text

8-Puzzle game example - Step 3 16 de junio de 2014 5/26

Slide 7

Slide 7 text

8-Puzzle game example - Step 4 16 de junio de 2014 6/26

Slide 8

Slide 8 text

8-Puzzle game example - Step 5 16 de junio de 2014 7/26

Slide 9

Slide 9 text

8-Puzzle game example - Step 6 16 de junio de 2014 8/26

Slide 10

Slide 10 text

Motivation - I Why did we create Hipster? There is an important lack of standard implementations of algorithms in Java. Most implementations are neither extensible nor flexible: The search process cannot be controlled. Costs are usually floats or doubles, there is no way to use complex custom costs. There is no way to handle more than one single goal. ... Graph specific libraries are not always suitable for problem solving! 16 de junio de 2014 9/26

Slide 11

Slide 11 text

Motivation - II Project Goals Iterative algorithms. while(search.hasNext()) search.next(); Flexible, extensible, reusable. Hipster.createAStar(problem).search(goal); Hipster.createIDA(problem).search(goal); Powerful, simple, strong-typed API. Generic types → compile-time type safety. Builders to assist the specification of search problems. Highly-tested code. Unit tests, continuous integration in the cloud. Open-Source. Permissive Apache 2.0 (GPL compatible) license. 16 de junio de 2014 10/26

Slide 12

Slide 12 text

Currently implemented algorithms Uninformed search (no heuristics) Depth First Search (DFS) Breadth First Search (BFS) Dijkstra’s algorithm Bellman-Ford Informed search A* algorithm Iterative Deepening A* (IDA*) Anytime Dynamic A* (AD*) Local search Hill-climbing. Enforced Hill-climbing. 16 de junio de 2014 11/26

Slide 13

Slide 13 text

Solving 8-Puzzle with Hipster 8-Puzzle state space formulation example States: 8-Puzzle represented as an array of numbers. Actions: movements of the empty tile (RIGHT, LEFT, UP, DOWN). Transitions: state × action → state’ (board with the tiles swapped). Example: {5,4,0,7,2,6,8,1,3} × LEFT = {5,0,4,7,2,6,8,1,3} Solution: minimal sequence of actions from initial to goal 16 de junio de 2014 12/26

Slide 14

Slide 14 text

Solving 8-Puzzle with Hipster - Step 1 16 de junio de 2014 13/26

Slide 15

Slide 15 text

Solving 8-Puzzle with Hipster - Step 2 16 de junio de 2014 14/26

Slide 16

Slide 16 text

Solving 8-Puzzle with Hipster - Step 3 16 de junio de 2014 15/26

Slide 17

Slide 17 text

Solving 8-Puzzle with Hipster - Step 4 16 de junio de 2014 16/26

Slide 18

Slide 18 text

Solving 8-Puzzle with Hipster - Step 5 16 de junio de 2014 17/26

Slide 19

Slide 19 text

Solving 8-Puzzle with Hipster - Step 6 16 de junio de 2014 18/26

Slide 20

Slide 20 text

Solving 8-Puzzle with Hipster - Step 7 16 de junio de 2014 19/26

Slide 21

Slide 21 text

Solving 8-Puzzle with Hipster - Step 8 Finally, we select an algorithm to perform the search until the goal state is reached. List goalState = Arrays.asList(0,1,2,3,4,5,6,7,8); Hipster.createDijkstra(p).search(goalState); 16 de junio de 2014 20/26

Slide 22

Slide 22 text

Different ways to search Search can also be done in multiple ways. Automatic search: Hipster.createAStar(p).search(goalState); Automatic search with event listeners: Hipster.createAStar(p).search(new Algorithm. SearchListener() { public void handle(Object node){ ... } }); Fine-grained iterative search: for (Node n : Hipster.createAStar(p)) { System.out.println("Current state is " + n.state()); if (n.state().equals(goalState)) ... } 16 de junio de 2014 21/26

Slide 23

Slide 23 text

Java 8 lambda expressions Boilerplate code (anonymous interface implementations) can be removed using Java 8 lambda expressions: 16 de junio de 2014 22/26

Slide 24

Slide 24 text

Hipster in Action Solving 8-Puzzle problem with Hipster. 3 minute video tutorial: http://youtu.be/ZPOhmnzOKA4 16 de junio de 2014 23/26

Slide 25

Slide 25 text

Research projects using Hipster - I Anytime Motion Replanning in State Lattices for Wheeled Robots. Use of the Anytime Dynamic A* (AD*) for path search with replanning. Custom costs to evaluate the states: Collision probability. Path traversal time. Probability to reach safely the goal state. 16 de junio de 2014 24/26

Slide 26

Slide 26 text

Research projects using Hipster - II Automatic Web Service Composition Backward A* search to minimize the number of services. Heuristics to estimate the distance to the goal. w1 w4 w5 L1 L2 L3 w6 w3 w2 w7 w8 o2 o3 o4 o5 o6 i4 i5 i6 i8 i9 i10 i11 i7 o7 o8 o9 o10 o11 o12 o13 i12 i13 i14 i15 i16 L0 L4 WI WO w9 o1 o14 o15 o16 i1 i2 i3 i17 i18 i19 16 de junio de 2014 25/26

Slide 27

Slide 27 text

Conclusions A powerful but easy to use Java Library for using and developing search algorithms. Open Source, Apache 2.0 license. Suitable for commercial and research projects. Good for prototyping and testing algorithms. Also suitable for teaching. 16 de junio de 2014 26/26

Slide 28

Slide 28 text

Thanks for listening! Questions? Hipster Web Page http://citiususc.github.io/hipster 16 de junio de 2014