lio.search.local.greedy
Class GRASP

java.lang.Object
  extended by lio.search.LiOSearch
      extended by lio.search.local.greedy.GRASP
All Implemented Interfaces:
java.lang.Runnable, LiOResource

public class GRASP
extends LiOSearch

This class implements the Greedy Randomized Adaptative Search Procedure. Tasks must implement LiOGreedyTask in order to be solved with this algorithm. The algorithm makes use of the object GreedyConstructor, so it only allows working with problems in which the first complete solution can not be expanded. That is the case of TSP or Strip Packing problems.

See Also:
GreedyConstructor

Field Summary
(package private)  Individual currentIndividual
           
 
Fields inherited from class lio.search.LiOSearch
listenerList, searchOutput, stopCondition, stopFlag
 
Constructor Summary
GRASP()
          Creates a new instance of HillClimbing
 
Method Summary
 LiOResourceDefinition getDefinition()
          Return a LiOResDescription object which holds the name and all parameters that describe the resource.
 GreedyConstructor getGreedyConstructor()
          Getter for property greedyConstructor.
 HillClimbing getHillClimbing()
          Getter for property hillClimbing.
 int getNumIterations()
          Getter for property numIterations.
static void main(java.lang.String[] args)
           
 void run()
           
 void setGreedyConstructor(GreedyConstructor greedyConstructor)
          Setter for property greedyConstructor.
 void setHillClimbing(HillClimbing hillClimbing)
          Setter for property hillClimbing.
 void setNumIterations(int numIterations)
          Setter for property numIterations.
protected  boolean stopCondition()
          Extends the stopCondition method from LiOSearch.
 boolean worksWith(LiOTask kindOfTask)
          Overloads stopCondition function of LiOSearch.
 
Methods inherited from class lio.search.LiOSearch
addLiOEventListener, build, cleanExecution, execute, fireFinishEvent, getSearchOutput, getStopCondition, initialize, initialize, loadSearchOutput, loadStatistics, loadStopCondition, removeLiOEventListener, setOptions, setSearchOutput, setStopCondition, setTask, showOptions, stopSearching, updateTaskDependentResources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentIndividual

Individual currentIndividual
Constructor Detail

GRASP

public GRASP()
Creates a new instance of HillClimbing

Method Detail

run

public void run()

stopCondition

protected boolean stopCondition()
Extends the stopCondition method from LiOSearch. The algorithm will consider some starting points as stopping criteria. This could be done by setting the maximum number of iterations in the stopping criterion but we have fixed startingPoints as a parameter for clearlyness.

Overrides:
stopCondition in class LiOSearch
Returns:
true if search progress must be halted.

worksWith

public boolean worksWith(LiOTask kindOfTask)
Overloads stopCondition function of LiOSearch. In this case, there is only a critery of stop which is met when a valid solution is found.

Specified by:
worksWith in class LiOSearch
Returns:
true if the search algorithm can deal with this kind of task and the corresponding data-type

getDefinition

public LiOResourceDefinition getDefinition()
Return a LiOResDescription object which holds the name and all parameters that describe the resource.

Returns:
A definition of the resource.

main

public static void main(java.lang.String[] args)

getNumIterations

public int getNumIterations()
Getter for property numIterations.

Returns:
Value of property numIterations.

setNumIterations

public void setNumIterations(int numIterations)
Setter for property numIterations.

Parameters:
numIterations - New value of property numIterations.

getHillClimbing

public HillClimbing getHillClimbing()
Getter for property hillClimbing.

Returns:
Value of property hillClimbing.

setHillClimbing

public void setHillClimbing(HillClimbing hillClimbing)
Setter for property hillClimbing.

Parameters:
hillClimbing - New value of property hillClimbing.

getGreedyConstructor

public GreedyConstructor getGreedyConstructor()
Getter for property greedyConstructor.

Returns:
Value of property greedyConstructor.

setGreedyConstructor

public void setGreedyConstructor(GreedyConstructor greedyConstructor)
Setter for property greedyConstructor.

Parameters:
greedyConstructor - New value of property greedyConstructor.