SlideShare a Scribd company logo
1 of 28
Download to read offline
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
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
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
8-Puzzle game example - Step 1
16 de junio de 2014 3/26
8-Puzzle game example - Step 2
16 de junio de 2014 4/26
8-Puzzle game example - Step 3
16 de junio de 2014 5/26
8-Puzzle game example - Step 4
16 de junio de 2014 6/26
8-Puzzle game example - Step 5
16 de junio de 2014 7/26
8-Puzzle game example - Step 6
16 de junio de 2014 8/26
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
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
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
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
Solving 8-Puzzle with Hipster - Step 1
16 de junio de 2014 13/26
Solving 8-Puzzle with Hipster - Step 2
16 de junio de 2014 14/26
Solving 8-Puzzle with Hipster - Step 3
16 de junio de 2014 15/26
Solving 8-Puzzle with Hipster - Step 4
16 de junio de 2014 16/26
Solving 8-Puzzle with Hipster - Step 5
16 de junio de 2014 17/26
Solving 8-Puzzle with Hipster - Step 6
16 de junio de 2014 18/26
Solving 8-Puzzle with Hipster - Step 7
16 de junio de 2014 19/26
Solving 8-Puzzle with Hipster - Step 8
Finally, we select an algorithm to perform the search until the goal state
is reached.
List<Integer> goalState = Arrays.asList(0,1,2,3,4,5,6,7,8);
Hipster.createDijkstra(p).search(goalState);
16 de junio de 2014 20/26
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
Java 8 lambda expressions
Boilerplate code (anonymous interface implementations) can be
removed using Java 8 lambda expressions:
16 de junio de 2014 22/26
Hipster in Action
Solving 8-Puzzle problem with Hipster. 3 minute video tutorial:
http://youtu.be/ZPOhmnzOKA4
16 de junio de 2014 23/26
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
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
w6w3
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
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
Thanks for listening!
Questions?
Hipster Web Page
http://citiususc.github.io/hipster
16 de junio de 2014

More Related Content

Similar to Hipster: An Open Source Java Library for Heuristic Search

Data Science as a Commodity: Use MADlib, R, & other OSS Tools for Data Scienc...
Data Science as a Commodity: Use MADlib, R, & other OSS Tools for Data Scienc...Data Science as a Commodity: Use MADlib, R, & other OSS Tools for Data Scienc...
Data Science as a Commodity: Use MADlib, R, & other OSS Tools for Data Scienc...
Sarah Aerni
 
Summer Independent Study Report
Summer Independent Study ReportSummer Independent Study Report
Summer Independent Study Report
Shreya Chakrabarti
 

Similar to Hipster: An Open Source Java Library for Heuristic Search (20)

Data Science as a Commodity: Use MADlib, R, & other OSS Tools for Data Scienc...
Data Science as a Commodity: Use MADlib, R, & other OSS Tools for Data Scienc...Data Science as a Commodity: Use MADlib, R, & other OSS Tools for Data Scienc...
Data Science as a Commodity: Use MADlib, R, & other OSS Tools for Data Scienc...
 
Summer Independent Study Report
Summer Independent Study ReportSummer Independent Study Report
Summer Independent Study Report
 
Narrative Mind Lessons Learned H4D Stanford 2016
Narrative Mind Lessons Learned H4D Stanford 2016Narrative Mind Lessons Learned H4D Stanford 2016
Narrative Mind Lessons Learned H4D Stanford 2016
 
Narrative Mind Lessons Learned
Narrative Mind Lessons LearnedNarrative Mind Lessons Learned
Narrative Mind Lessons Learned
 
Crime Analysis using Data Analysis
Crime Analysis using Data AnalysisCrime Analysis using Data Analysis
Crime Analysis using Data Analysis
 
What is it
What is it What is it
What is it
 
Big data analytics 1
Big data analytics 1Big data analytics 1
Big data analytics 1
 
Analyzing Big Data's Weakest Link (hint: it might be you)
Analyzing Big Data's Weakest Link  (hint: it might be you)Analyzing Big Data's Weakest Link  (hint: it might be you)
Analyzing Big Data's Weakest Link (hint: it might be you)
 
Analysing User Knowledge, Competence and Learning during Online Activities
Analysing User Knowledge, Competence and Learning during Online ActivitiesAnalysing User Knowledge, Competence and Learning during Online Activities
Analysing User Knowledge, Competence and Learning during Online Activities
 
Big Data: the weakest link
Big Data: the weakest linkBig Data: the weakest link
Big Data: the weakest link
 
FIWARE Global Summit - Big Data and Machine Learning with FIWARE
FIWARE Global Summit - Big Data and Machine Learning with FIWAREFIWARE Global Summit - Big Data and Machine Learning with FIWARE
FIWARE Global Summit - Big Data and Machine Learning with FIWARE
 
Natural language search using Neo4j
Natural language search using Neo4jNatural language search using Neo4j
Natural language search using Neo4j
 
Natural Language Search with Neo4j - Kenny Bastani @ GraphConnect NY 2013
Natural Language Search with Neo4j - Kenny Bastani @ GraphConnect NY 2013Natural Language Search with Neo4j - Kenny Bastani @ GraphConnect NY 2013
Natural Language Search with Neo4j - Kenny Bastani @ GraphConnect NY 2013
 
uploadscribd.pptx
uploadscribd.pptxuploadscribd.pptx
uploadscribd.pptx
 
We are Digital Puppets
We are Digital PuppetsWe are Digital Puppets
We are Digital Puppets
 
Artificial intelligence: Simulation of Intelligence
Artificial intelligence: Simulation of IntelligenceArtificial intelligence: Simulation of Intelligence
Artificial intelligence: Simulation of Intelligence
 
Analytic innovation transforming instagram data into predicitive analytics wi...
Analytic innovation transforming instagram data into predicitive analytics wi...Analytic innovation transforming instagram data into predicitive analytics wi...
Analytic innovation transforming instagram data into predicitive analytics wi...
 
wendi_ppt
wendi_pptwendi_ppt
wendi_ppt
 
Do you have an "analytics"? How analytics tools work
Do you have an "analytics"? How analytics tools workDo you have an "analytics"? How analytics tools work
Do you have an "analytics"? How analytics tools work
 
Machine learning for java developers
Machine learning for java developersMachine learning for java developers
Machine learning for java developers
 

Recently uploaded

Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
mbmh111980
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
Max Lee
 

Recently uploaded (20)

Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdfStrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
The Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdf
The Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdfThe Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdf
The Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdf
 
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCAOpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabber
 
IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
 
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
 
10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf
 
What need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java DevelopersWhat need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java Developers
 
how-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdfhow-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdf
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
 
CompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdfCompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdf
 

Hipster: An Open Source Java Library for Heuristic Search

  • 1. 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
  • 2. 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
  • 3. 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
  • 4. 8-Puzzle game example - Step 1 16 de junio de 2014 3/26
  • 5. 8-Puzzle game example - Step 2 16 de junio de 2014 4/26
  • 6. 8-Puzzle game example - Step 3 16 de junio de 2014 5/26
  • 7. 8-Puzzle game example - Step 4 16 de junio de 2014 6/26
  • 8. 8-Puzzle game example - Step 5 16 de junio de 2014 7/26
  • 9. 8-Puzzle game example - Step 6 16 de junio de 2014 8/26
  • 10. 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
  • 11. 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
  • 12. 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
  • 13. 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
  • 14. Solving 8-Puzzle with Hipster - Step 1 16 de junio de 2014 13/26
  • 15. Solving 8-Puzzle with Hipster - Step 2 16 de junio de 2014 14/26
  • 16. Solving 8-Puzzle with Hipster - Step 3 16 de junio de 2014 15/26
  • 17. Solving 8-Puzzle with Hipster - Step 4 16 de junio de 2014 16/26
  • 18. Solving 8-Puzzle with Hipster - Step 5 16 de junio de 2014 17/26
  • 19. Solving 8-Puzzle with Hipster - Step 6 16 de junio de 2014 18/26
  • 20. Solving 8-Puzzle with Hipster - Step 7 16 de junio de 2014 19/26
  • 21. Solving 8-Puzzle with Hipster - Step 8 Finally, we select an algorithm to perform the search until the goal state is reached. List<Integer> goalState = Arrays.asList(0,1,2,3,4,5,6,7,8); Hipster.createDijkstra(p).search(goalState); 16 de junio de 2014 20/26
  • 22. 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
  • 23. Java 8 lambda expressions Boilerplate code (anonymous interface implementations) can be removed using Java 8 lambda expressions: 16 de junio de 2014 22/26
  • 24. Hipster in Action Solving 8-Puzzle problem with Hipster. 3 minute video tutorial: http://youtu.be/ZPOhmnzOKA4 16 de junio de 2014 23/26
  • 25. 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
  • 26. 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 w6w3 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
  • 27. 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
  • 28. Thanks for listening! Questions? Hipster Web Page http://citiususc.github.io/hipster 16 de junio de 2014