net.sourceforge.cilib.problem.mappingproblem
Class LinearDistanceMetric

java.lang.Object
  extended by net.sourceforge.cilib.problem.mappingproblem.LinearDistanceMetric
All Implemented Interfaces:
DistanceMetric

public class LinearDistanceMetric
extends Object
implements DistanceMetric

Represents a method for calculating the structure distance between two vectors in a MappingProblem. This specific one simply assumes that we are looking at some "linear" structure and that all input vectors logically follows on one another. This can sometimes be the case, but I don't see many situations where this will make a hell of a lot of sense...

Author:
jkroon

Constructor Summary
LinearDistanceMetric()
           
 
Method Summary
 double getDistance(int i, int j)
          Gets called by CurvilinearDistEvaluator to request the distance between two vectors to be returned.
 boolean getLoopStatus()
          Retrieves the looping status.
 void setLoopStatus(boolean loopstatus)
          Sets the looping status.
 void setMappingProblem(MappingProblem prob)
          Gets called by CurvilinearDistEvaluator to indicate the precice problem to make use of.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearDistanceMetric

public LinearDistanceMetric()
Method Detail

setMappingProblem

public void setMappingProblem(MappingProblem prob)
Gets called by CurvilinearDistEvaluator to indicate the precice problem to make use of. It is recommended that the results of the distances be calculated and placed into some kind of matrix at this point to allow for faster execution.

Specified by:
setMappingProblem in interface DistanceMetric
Parameters:
prob - The underlying MappingProblem.

getDistance

public double getDistance(int i,
                          int j)
Gets called by CurvilinearDistEvaluator to request the distance between two vectors to be returned.

Specified by:
getDistance in interface DistanceMetric
Parameters:
i - The index of the "from" vector.
j - The index of the "to" vector.
Returns:
The distance between to two vectors.

setLoopStatus

public void setLoopStatus(boolean loopstatus)
Sets the looping status. If the looping status is active it is assumed that we are working with some looping structure, ie, the last point goes back to the first. In this case there are two possible directions from one vector to another, the shortest one is returned.

Parameters:
loopstatus - What the loopstatus should be (true/false).

getLoopStatus

public boolean getLoopStatus()
Retrieves the looping status. setLoopStatus

Returns:
The current loop status.


Copyright © 2009 CIRG. All Rights Reserved.