lio.search.local.greedy
Class GreedyConstruction

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

public class GreedyConstruction
extends LiOSearch

This class encapsulates the greedy construction to implement it as a search procedure. Thus, it is designed to construct solutions in problems in which the first valid solution can not be expanded such as TSP or Strip Packing. For simplicity, it uses the methods provided by lio.generators.GreedyConstructor instead of accessing the task methods directly.

See Also:
GreedyConstructor

Field Summary
 
Fields inherited from class lio.search.LiOSearch
listenerList, searchOutput, stopCondition, stopFlag
 
Constructor Summary
GreedyConstruction()
          Constructor
 
Method Summary
 LiOResourceDefinition getDefinition()
          Return a LiOResDescription object which holds the name and all parameters that describe the resource.
 int getNumCandidates()
          Getter for property numCandidates.
static void main(java.lang.String[] args)
          Main class that allows testing the class.
 void run()
          Main cycle
 void setNumCandidates(int numCandidates)
          Setter for property numCandidates.
protected  boolean stopCondition()
          Overloads stopCondition function of LiOSearch.
 boolean worksWith(LiOTask kindOfTask)
          Checks the compatibility of the algorithm with the task that is going to be solved.
 
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
 

Constructor Detail

GreedyConstruction

public GreedyConstruction()
Constructor

Method Detail

run

public void run()
Main cycle


stopCondition

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

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

worksWith

public boolean worksWith(LiOTask kindOfTask)
Checks the compatibility of the algorithm with the task that is going to be solved. In this case, only instances of LiOGreedyTask are allowed.

Specified by:
worksWith in class LiOSearch
Parameters:
LiOTask - task that the algorithm must work with.
Returns:
Whether the task is suitable for greedy construction.

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)
Main class that allows testing the class.

Parameters:
args - Arguments passed by command line

getNumCandidates

public int getNumCandidates()
Getter for property numCandidates.

Returns:
Value of property numCandidates.

setNumCandidates

public void setNumCandidates(int numCandidates)
Setter for property numCandidates.

Parameters:
numCandidates - New value of property numCandidates.