Orbital library

orbital.algorithm.template
Class EvaluativeAlgorithm.EvaluationComparator

java.lang.Object
  extended by orbital.algorithm.template.EvaluativeAlgorithm.EvaluationComparator
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator
Enclosing interface:
EvaluativeAlgorithm

public static class EvaluativeAlgorithm.EvaluationComparator
extends java.lang.Object
implements java.util.Comparator, java.io.Serializable

The canonical comparator induced by the evaluation function f(n).

For highest performance it might prove useful to cache most recent values of the evaluation function.

Author:
André Platzer
See Also:
Serialized Form

Constructor Summary
EvaluativeAlgorithm.EvaluationComparator(EvaluativeAlgorithm a)
          Create a new comparator for states compared by their evaluation values.
EvaluativeAlgorithm.EvaluationComparator(Function evaluation)
          Create a new comparator for states compared by their evaluation values.
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compares according to evaluation function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

EvaluativeAlgorithm.EvaluationComparator

public EvaluativeAlgorithm.EvaluationComparator(Function evaluation)
Create a new comparator for states compared by their evaluation values.

Parameters:
evaluation - the evaluation function used in order to compare two states.

EvaluativeAlgorithm.EvaluationComparator

public EvaluativeAlgorithm.EvaluationComparator(EvaluativeAlgorithm a)
Create a new comparator for states compared by their evaluation values.

Parameters:
a - the heuristic algorithm whose evaluation function used in order to compare two states.
Method Detail

compare

public final int compare(java.lang.Object o1,
                         java.lang.Object o2)
Compares according to evaluation function.

Specified by:
compare in interface java.util.Comparator
Returns:
f(o1).compareTo(f(o2))

Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.