public class

EightQueensProblemExample

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

Class Overview

Example using the N-Queens problem (size 8x8) solved using the Hill Climbing and Enforced Hill Climbing algorithms. This example is a search problem with no explicit actions, only using a transition function which generates from a state a set of successor states. The cost function in this case is constant, and we assume it has no cost to move a queen. As heuristic for this problem we use the number of attacked queens. These components are defined as the same time the problem is being built (using a ProblemBuilder. Once the problem is defined, in this example the Hill Climbing iterator is created, and the usage of the iterator is shown: we keep expanding new nodes (using next()) until a solution is found, considering a solution as a state where no queens are attacked. This is a problem where we do not know the goal states a-priori. In situations like this we might need more control on the search process and stop it according of our needs, as we show in the search loop.

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

Summary

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

Public Constructors

public EightQueensProblemExample ()

Public Methods

public static void main (String[] args)