net.sourceforge.cilib.ec
Class EC

java.lang.Object
  extended by net.sourceforge.cilib.algorithm.Algorithm
      extended by net.sourceforge.cilib.algorithm.population.PopulationBasedAlgorithm
          extended by net.sourceforge.cilib.algorithm.population.SinglePopulationBasedAlgorithm
              extended by net.sourceforge.cilib.ec.EC
All Implemented Interfaces:
Serializable, Runnable, ParticipatingAlgorithm, Cloneable

public class EC
extends SinglePopulationBasedAlgorithm
implements ParticipatingAlgorithm

Generic EC skeleton algorithm. The algorithm is altered by defining the appropriate IterationStrategy.

Author:
Gary Pampara
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sourceforge.cilib.algorithm.population.SinglePopulationBasedAlgorithm
initialisationStrategy
 
Fields inherited from class net.sourceforge.cilib.algorithm.Algorithm
optimisationProblem
 
Constructor Summary
EC()
          Create a new instance of EC.
EC(EC copy)
          Copy constructor.
 
Method Summary
 void algorithmIteration()
          Perform the iteration within the algorithm.
 OptimisationSolution getBestSolution()
          Get the best current solution.
 EC getClone()
          Create a cloned copy of the current object and return it.
 Entity getContribution()
          Returns contribution to the solution for the co-operative optimisation algorithm.
 Fitness getContributionFitness()
          Returns the fitness of contribution to the solution.
 IterationStrategy<EC> getIterationStrategy()
          Get the IterationStrategy for the current EC.
 OptimisationProblem getOptimisationProblem()
          Get the specified OptimisationProblem.
 List<OptimisationSolution> getSolutions()
          Get the collection of best solutions.
 Topology<? extends Entity> getTopology()
          Get the current collection (population) of entities.
 void performInitialisation()
          Perform the needed initialisation required before the execution of the algorithm starts.
 void setIterationStrategy(IterationStrategy iterationStrategy)
          Set the current IterationStrategy.
 void setOptimisationProblem(OptimisationProblem problem)
          Set the optimisation problem to be solved.
 void setTopology(Topology topology)
          Set the Topology for the population-based algorithm.
 void updateContributionFitness(Fitness fitness)
          Updates the new fitness for the solution contribution.
 
Methods inherited from class net.sourceforge.cilib.algorithm.population.SinglePopulationBasedAlgorithm
accept, getInitialisationStrategy, setInitialisationStrategy
 
Methods inherited from class net.sourceforge.cilib.algorithm.Algorithm
addAlgorithmListener, addStoppingCondition, get, getAlgorithmList, getIterations, getPercentageComplete, getStoppingConditions, initialise, isFinished, performIteration, performUninitialisation, removeAlgorithmListener, removeStoppingCondition, reset, run, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EC

public EC()
Create a new instance of EC.


EC

public EC(EC copy)
Copy constructor. Create a copy of the provided instance.

Parameters:
copy - The instance to copy.
Method Detail

getClone

public EC getClone()
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface Cloneable
Specified by:
getClone in class SinglePopulationBasedAlgorithm
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

performInitialisation

public void performInitialisation()
Perform the needed initialisation required before the execution of the algorithm starts.

Overrides:
performInitialisation in class Algorithm

algorithmIteration

public void algorithmIteration()
Perform the iteration within the algorithm.

Specified by:
algorithmIteration in class SinglePopulationBasedAlgorithm

getTopology

public Topology<? extends Entity> getTopology()
Get the current collection (population) of entities.

Specified by:
getTopology in class SinglePopulationBasedAlgorithm
Returns:
The current population.

setTopology

public void setTopology(Topology topology)
Set the Topology for the population-based algorithm.

Specified by:
setTopology in class SinglePopulationBasedAlgorithm
Parameters:
topology - The Topology to be set.

setOptimisationProblem

public void setOptimisationProblem(OptimisationProblem problem)
Set the optimisation problem to be solved. By default, the problem is null. That is, it is necessary to set the optimisation problem before calling Algorithm.initialise().

Overrides:
setOptimisationProblem in class Algorithm
Parameters:
problem - An implementation of the OptimisationProblemAdapter interface.

getOptimisationProblem

public OptimisationProblem getOptimisationProblem()
Get the specified OptimisationProblem.

Overrides:
getOptimisationProblem in class Algorithm
Returns:
The specified OptimisationProblem.

getBestSolution

public OptimisationSolution getBestSolution()
Get the best current solution. This best solution is determined from the personal bests of the particles.

Specified by:
getBestSolution in class PopulationBasedAlgorithm
Returns:
The OptimisationSolution representing the best solution.

getIterationStrategy

public IterationStrategy<EC> getIterationStrategy()
Get the IterationStrategy for the current EC.

Returns:
The current IterationStrategy.

setIterationStrategy

public void setIterationStrategy(IterationStrategy iterationStrategy)
Set the current IterationStrategy.

Parameters:
iterationStrategy - The value to set.

getSolutions

public List<OptimisationSolution> getSolutions()
Get the collection of best solutions. This result does not actually make sense in the normal PSO algorithm, but rather in a MultiObjective optimization.

Specified by:
getSolutions in class PopulationBasedAlgorithm
Returns:
The Collection<OptimisationSolution> containing the solutions.

getContribution

public Entity getContribution()
Returns contribution to the solution for the co-operative optimisation algorithm.

Specified by:
getContribution in interface ParticipatingAlgorithm
Returns:
The algorithm's solution contribution.

getContributionFitness

public Fitness getContributionFitness()
Returns the fitness of contribution to the solution.

Specified by:
getContributionFitness in interface ParticipatingAlgorithm
Returns:
The fitness of the solution contribution.

updateContributionFitness

public void updateContributionFitness(Fitness fitness)
Updates the new fitness for the solution contribution.

Specified by:
updateContributionFitness in interface ParticipatingAlgorithm
Parameters:
fitness - The new fitness of the contribution.


Copyright © 2009 CIRG. All Rights Reserved.