public class

SimpleEightPuzzleExample

extends Object
java.lang.Object
   ↳ es.usc.citius.hipster.examples.SimpleEightPuzzleExample

Class Overview

Example of using Hipster to solve the 8-puzzle search problem problem using the Dijkstra's algorithm.

In this example a SearchProblem is used to define the components of the search, and the search iterator is later instantiated using this structure. This summarizes the content of this example:

  • Uses SearchProblem, a structure created to facilitate organizing and storing the components of the search.
  • The state of the 8-puzzle problem is modeled as an array. Each position of the array stores the number of each piece of the puzzle at the given position, meaning the 0 the empty space.
  • This problem is modeled with actions, so an ActionFunction is used. This function analyzes which actions are applicable in each state. Valid actions for this problem are moving the empty space in each of the following directions: UP, DOWN, LEFT, RIGHT.
  • The TransitionFunction creates the Transition resulting from apply the given actions to the current state.
  • The CostFunction for this problem is unitary. All actions have unitary cost.
The objective of this search problem is to minimize the number of actions to solve the 8-puzzle.

See Also
  • {@link es.usc.citius.hipster.examples.EightPuzzleProblemExample}

Summary

Public Constructors
SimpleEightPuzzleExample()
Public Methods
static void main(String[] args)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public SimpleEightPuzzleExample ()

Public Methods

public static void main (String[] args)