Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
Conflicts:
	.config/deploy-artifacts.sh
	.config/maven-settings.xml
	hipster-all/pom.xml
	hipster-core/pom.xml
	hipster-examples/pom.xml
	hipster-jung/pom.xml
	hipster-test/pom.xml
	pom.xml
  • Loading branch information
pablo.rodriguez.mier committed Dec 10, 2014
2 parents 2d95852 + 7444359 commit 0ab39ba
Show file tree
Hide file tree
Showing 200 changed files with 9,591 additions and 8,030 deletions.
13 changes: 8 additions & 5 deletions .config/deploy-artifacts.sh
@@ -1,13 +1,16 @@
#!/bin/bash

echo "Auto-deploying artifacts..."
echo "Auto-deploying Hipster artifacts..."
echo "Current branch: $TRAVIS_BRANCH"

if [ "$TRAVIS_REPO_SLUG" == "citiususc/hipster" ] && [ "$TRAVIS_JDK_VERSION" == "oraclejdk7" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo "Running mvn deploy..."
mvn deploy --settings .config/maven-settings.xml -DskipTests=true
echo "Running mvn deploy, current directory: `pwd`"
# Deploy to CITIUS
#mvn --settings .config/maven-settings.xml -P citius-snapshot-deploy deploy -DskipTests=true
# Deploy to Sonatype Nexus OSS
mvn --settings .config/maven-settings.xml deploy -DskipTests=true
else
echo "Skipping deployment for this build..."
echo "Skipping deployment for this build..."
fi

echo "Deployment script finished."
echo "Deployment script finished."
74 changes: 74 additions & 0 deletions .config/deploy-site.sh
@@ -0,0 +1,74 @@
#!/bin/bash

#TRAVIS_REPO_SLUG="citiususc/hipster"
#TRAVIS_JDK_VERSION="oraclejdk7"
#TRAVIS_PULL_REQUEST="false"
#TRAVIS_BRANCH="master"
#HOME=`pwd`

echo "Preparing Hipster site for auto-deploy"
echo "TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG - TRAVIS_JDK_VERSION=$TRAVIS_JDK_VERSION - TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST"

if [ "$TRAVIS_REPO_SLUG" == "citiususc/hipster" ] && [ "$TRAVIS_JDK_VERSION" == "oraclejdk7" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then

# Decide the documentation version folder name depending on the branch and the version in the pom.xml
# wget https://raw.githubusercontent.com/citiususc/hipster/$TRAVIS_BRANCH/pom.xml > /dev/null 2>&1
# Take the version from the main pom.xml
# grep -m 1 -E '<version>[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9_]+(-[0-9]+)?)?</version>' pom.xml
VERSION=`grep -m 1 "<hipster.version>" pom.xml | cut -d ">" -f 2 | cut -d "<" -f 1`
# rm pom.xml

# Validate if the version is correct (example 1.0.0-SNAPSHOT, or 1.0.0-alpha-1)
VERSION_REGEX='^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9_]+(-[0-9]+)?)?$'
if [[ $VERSION =~ $VERSION_REGEX ]]; then
echo "Current version is $VERSION"
else
echo "Version error. Unrecognized version $VERSION"
exit 1
fi

echo "Deploying Hipster [$VERSION] site and documentation to GitHub gh-pages"
echo "Current directory is: `pwd`"


echo "Building javadocs..."
mvn javadoc:aggregate

# Build site only if this is the development branch.
if [ "$TRAVIS_BRANCH" == "master" ]; then
echo "Building site..."
mvn site:site
fi

# First, copy the generated site to the new folder
mkdir $HOME/site
cp -Rf target/site/* $HOME/site
# Remove the apidocs site and use the aggregated javadoc instead
rm -rf $HOME/site/apidocs
# Copy the apidocs to the site folder
mkdir $HOME/site/documentation
mkdir $HOME/site/documentation/javadoc
mkdir $HOME/site/documentation/javadoc/$VERSION
cp -Rf target/apidocs/* $HOME/site/documentation/javadoc/$VERSION

# Now prepare for uploading the site to gh-pages

cd $HOME
git clone --quiet --branch=gh-pages https://github.com/citiususc/hipster.git gh-pages > /dev/null

# Copy and overwrite the site with the new content
cp -Rf $HOME/site/* gh-pages/
cd gh-pages

# Config git user and credentials
git config --global user.email "travis@travis-ci.org"
git config --global user.name "travis-ci"
git config credential.helper "store --file=.git/credentials"
echo "https://${GITHUB_TOKEN}:@github.com" > .git/credentials

git add -A
git commit -a -m "auto-commit $TRAVIS_BRANCH Hipster site updated (build $TRAVIS_BUILD_NUMBER)"
git push -q origin gh-pages > /dev/null
echo "Published $TRAVIS_BRANCH Hipster site to gh-pages."

fi
10 changes: 8 additions & 2 deletions .config/maven-settings.xml
Expand Up @@ -17,11 +17,17 @@

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<!-- Internal organization repository for snapshots -->
<server>
<id>citius-nexus-snapshots</id>
<username>${env.NEXUS_SNAPSHOT_USERNAME}</username>
<password>${env.NEXUS_SNAPSHOT_PASSWORD}</password>
</server>
<!-- Sonatype Maven repository for snapshots -->
<server>
<id>sonatype-nexus-snapshots</id>
<username>${env.SONATYPE_SNAPSHOT_USERNAME}</username>
<password>${env.SONATYPE_SNAPSHOT_PASSWORD}</password>
</server>
</servers>
</settings>

</settings>
22 changes: 17 additions & 5 deletions .travis.yml
@@ -1,9 +1,21 @@
language: java
jdk:
- oraclejdk7
- openjdk6
- oraclejdk7
- oraclejdk8
- openjdk7
branches:
only:
- master
- development
before_install: 'mvn -version'
- master
- development
after_success:
- chmod +x .config/deploy-site.sh
#- .config/deploy-site.sh
- chmod +x .config/deploy-artifacts.sh
#- .config/deploy-artifacts.sh
env:
global:
- secure: ILdOYjPt+8g5rlexXBYAhECtn5Zm26FRf0/nwCxUU303qtzFQyMcxinIC93aun880OnINjA7fzQeBkG4P+LSVOAXbmGTGhtyPBzMOGcnZouJM/RyXHUft6tAXPimXQ7JjDFjyv7EzSeStk/4WEp0mkxheIryZS3X1pbED1TqgUM=
- secure: cwV1rA8+CUHonJg40dRHCcd8KmYl9EzpCUcnS8vm/1qNkXpRmEAvwNKjZct0sZ8ZFKjKEUEzhyG0+cZVRzvEhi108/WZ5pIxp01EdtSFZTlIg73llALb2P8HClHuy4XSBDz0G4nTLES11usUGpCsLckSudNtb7bdUAH356NxFvQ=
- secure: XNFSHaGHiJfj4TvW6Oud1Z1dKnkXYk0njX2xjfljfFlHf4eCSIUxO9giad4xq2sE7vrjk+JpLLj/te7qjug91Ih7KH0i9T56d57q9vfu8juW49NBQxRnfhlvYWyrto5rmnKEa8Mcs/smgER6dllsURz10AqLKM32mkijG4VgdcM=
- secure: VFkAqPydQ9NTxXkp/gNzNUoaYd/xvryKy+ARXJhbvgUkpO2VMyo2D2wU1G6ECVzitqpO+gaUn2mu7fO1M0KjpeKp5Si7HG3fUVb4sXg6Sim563iot2rJUfiXpu6FOqPfUwQHpyUXqUfAPOA6bI9ZNKNBAurGxgLgt4AP2PjObV4=
- secure: Q5UXkBKvrqcC09peZa/U/XilT4q32fm2tWEu/0Pq0JquKS+BmOevEmntW0zMBe8R5K5AzbuDKurAyelCqXDNj3W8Tjg/xreIqR3ccnfo202wkLiIAtko8oUXzyiLgeMjjyge76lHIkaGxWXNGzsDUZmq5qUQW2YEQ5vGiv0vc5A=
Empty file removed NOTICE
Empty file.
164 changes: 115 additions & 49 deletions README.md
@@ -1,26 +1,28 @@
![Hipster](src/main/doclava/custom/assets/hipster-template/assets/images/header-logo.png?raw=true)

A powerful, easy to use heuristic search library implemented in pure java.
A powerful and friendly heuristic search library implemented in pure java.

## Goals
## What's Hipster?

The aim of Hipster is to provide an easy to use yet powerful and flexible Java library for heuristic search.
Hipster relies on a flexible model with generic operators to change the behavior without modifying the internals. All algorithms are also implemented in an iterative way, avoiding recursion. This has many benefits: full control over the search, access to the internals at runtime or a better and clear scale-out for large search spaces using the heap memory.
The aim of Hipster is to provide an easy to use yet powerful and flexible type-safe Java library for heuristic search.
Hipster relies on a flexible model with generic operators that allow you to reuse and change the behavior of the algorithms very easily. Algorithms are also implemented in an iterative way, avoiding recursion. This has many benefits: full control over the search, access to the internals at runtime or a better and clear scale-out for large search spaces using the heap memory.

You can use Hipster to solve from simple graph search problems to more advanced state-space search problems where the state space is complex and weights are not just double values but custom defined costs.

## Features

The current version of the library comes with some very well-known and wide used search algorithms. Note that this list may not be exhaustive:

* Search algorithms:
* Uninformed search:
* Depth-First-Search (DFS).
* Breadth-First-Search (BFS).
* DFS: Depth-First-Search.
* BFS: Breadth-First-Search.
* Dijkstra.
* Bellman-Ford.
* Informed search:
* A\* algorithm.
* Iterative Deepening A\* (IDA\*).
* Anytime D\* (AD\*).
* A\*. \\A star\\
* IDA\*: Iterative Deepening A\*. \\IDA star\\
* AD\*: Anytime Dynamic A\*. \\AD star\\
* Local search:
* Hill-Climbing.
* Enforced-Hill-Climbing.
Expand All @@ -29,64 +31,109 @@ The current version of the library comes with some very well-known and wide used
* 3rd party adapters:
* [Java Universal/Graph (JUNG)](http://jung.sourceforge.net/) adapter.

If you don't find the algorithm or the feature you are looking for, please consider contributing to Hipster!. You can open a new issue or better fork this repository and create a pull request with your contribution. If you go for this second option, please follow the contribution guidelines.
If you don't find the algorithm or the feature you are looking for, please consider contributing to Hipster!. You can open a new issue or better fork this repository and create a pull request with your contribution.

## Getting started

The easiest way to use Hipster is adding it as a dependency with your favourite dependency manager.
Maven users can include the library using the following snippet:

#### Snapshots

````xml
<repositories>
<repository>
<id>snapshots</id>
<name>CITIUS Snapshots</name>
<url>http://tec.citius.usc.es/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
#### Snapshots ![Build Status](https://api.travis-ci.org/citiususc/hipster.svg?branch=development)

You can use the latest (unstable) version of Hipster under development. Just add the following dependency into your pom.xml:

```xml
<!-- Use sonatype oss public for snapshots -->
<repositories>
<repository>
<id>sonatype-oss-public</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<dependencies>
<!--
Add this dependency under your pom.xml <dependencies> section to add
all the dependencies of Hipster to your project. Add hipster-core
instead of hipster-all for basic functionality.
-->
<dependency>
<groupId>es.usc.citius.hipster</groupId>
<artifactId>hipster-all</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
```

<dependencies>
...
<dependency>
<groupId>es.usc.citius.lab</groupId>
<artifactId>hipster-all</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
````
#### Releases [![Stories in Ready](https://badge.waffle.io/citiususc/hipster.png?label=ready&title=Ready)](http://waffle.io/citiususc/hipster)

Current stable release is v1.0.0-rc1. See the [milestones](https://github.com/citiususc/hipster/milestones) to check the current development status.

```xml
<dependencies>
<!--
Add this dependency under your pom.xml <dependencies> section to add
all the dependencies of Hipster to your project. Add hipster-core
instead of hipster-all for basic functionality.
-->
<dependency>
<groupId>es.usc.citius.hipster</groupId>
<artifactId>hipster-all</artifactId>
<version>1.0.0-rc1</version>
</dependency>
</dependencies>
```

#### Releases
#### Quick Example

TODO;
Let's solve the graph used in [this Wikipedia article](http://en.wikipedia.org/wiki/Shortest_path_problem)
about Shortest paths.

#### Quick Example
![DirectedGraph](http://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Shortest_path_with_direct_weights.svg/512px-Shortest_path_with_direct_weights.svg.png)

Here is a quick example of how to search a shortest path in a graph with Dijkstra's algorithm:
Although Hipster is graph agnostic, we include some useful classes to create a graph or a
directed graph and the search problem. We create a graph using the GraphBuilder class and then
we use the GraphSearchProblem to create the required components to solve it using Dijkstra's algorithm:

```java
// Create a simple weighted directed graph with Hipster
HipsterDirectedGraph<String,Double> graph =
GraphBuilder.<String,Double>newDirectedGraph()
.from("A").to("B").withEdge(4d)
.from("A").to("C").withEdge(2d)
.from("B").to("C").withEdge(5d)
.from("B").to("D").withEdge(10d)
.from("C").to("E").withEdge(3d)
.from("D").to("F").withEdge(11d)
.from("E").to("D").withEdge(4d);

// Search the shortest path with Dijkstra's algorithm and print the result
System.out.println(Hipster.createDijkstra(GraphSearchProblem.from("A").to("F").in(graph)).search());
// Create a simple weighted directed graph with Hipster where
// vertices are Strings and edge values are just doubles
HipsterDirectedGraph<String,Double> graph = GraphBuilder.create()
.connect("A").to("B").withEdge(4d)
.connect("A").to("C").withEdge(2d)
.connect("B").to("C").withEdge(5d)
.connect("B").to("D").withEdge(10d)
.connect("C").to("E").withEdge(3d)
.connect("D").to("F").withEdge(11d)
.connect("E").to("D").withEdge(4d)
.buildDirectedGraph();

// Create the search problem. For graph problems, just use
// the GraphSearchProblem util class to generate the problem with ease.
SearchProblem p = GraphSearchProblem
.startingFrom("A")
.in(graph)
.takeCostsFromEdges()
.build();

// Search the shortest path from "A" to "F"
System.out.println(Hipster.createDijkstra(p).search("F"));
```
But that's not all!. Hipster comes with different problem examples that illustrate how Hipster can be used to solve a wide variety of problems such as the eight puzzle problem, N-Queens problem, etc.

Output result: `Total number of iterations: 7. States: [A, B, C, E, D, F], Actions: [2.0, 1.0, 3.0, 2.0, 2.0], Search information: WeightedNode{state=F, cost=10.0, estimation=0.0, score=10.0}`

But that's not all. Hipster comes with different problem examples
that illustrate how Hipster can be used to solve a [wide variety of problems](https://github.com/citiususc/hipster/tree/development/hipster-examples/src/main/java/es/usc/citius/hipster/examples) (not only graph search).

## What's next?

If you want to learn how to solve a problem by searching with Hipster, check the wiki to [learn the basics](https://github.com/pablormier/hipster/wiki/Solving-problems-with-Hipster) and the JavaDoc documentation. There are also a few implemented examples here.
If you want to learn how to solve a problem by searching with Hipster, check the wiki to [learn the basics](https://github.com/citiususc/hipster/wiki/Getting-Started) and the [JavaDoc documentation](http://citiususc.github.io/hipster/documentation/javadoc/1.0.0-SNAPSHOT). There are also a few implemented examples [here](https://github.com/citiususc/hipster/tree/development/hipster-examples/src/main/java/es/usc/citius/hipster/examples).
We also suggest you to check [this presentation](https://speakerdeck.com/pablormier/hipster-an-open-source-java-library-for-heuristic-search) for a quick introduction.

## License
## License & Citation

This software is licensed under the Apache 2 license, quoted below.

Expand All @@ -107,3 +154,22 @@ This software is licensed under the Apache 2 license, quoted below.



### Citation

This library was presented in the "9th Iberian Conference on Information Systems and Technologies (CISTI), 2014". If you use this library in your research projects, we encourage you to please cite our work:

> Rodriguez-Mier, P., Gonzalez-Sieira, A., Mucientes, M., Lama, M. & Bugarin, A. (2014). **Hipster: An Open Source Java Library for Heuristic Search**. _9th Iberian Conference on Information Systems and Technologies (CISTI)_.
```
@inproceedings{RodriguezMier2014,
author = {Rodriguez-Mier, Pablo and Gonzalez-Sieira, Adrian and Mucientes, Manuel and and Lama, Manuel and Bugarin, Alberto},
booktitle = {9th Iberian Conference on Information Systems and Technologies (CISTI 2014)},
month = jun,
volume = 1,
title = {{Hipster: An Open Source Java Library for Heuristic Search}},
pages = {481--486},
isbn = "978-989-98434-2-4"
address = "Barcelona",
year = {2014}
}
```
28 changes: 25 additions & 3 deletions hipster-all/pom.xml
Expand Up @@ -19,9 +19,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hipster-pom</artifactId>
<groupId>es.usc.citius.hipster</groupId>
<version>1.0.0-alpha-1</version>
<artifactId>hipster-pom</artifactId>
<version>1.0.0-rc1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hipster-all</artifactId>
Expand All @@ -48,5 +48,27 @@
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>${project.artifactId}-${project.version}-all</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 0ab39ba

Please sign in to comment.