Package org.opt4j.optimizer.mopso
Class Particle
- java.lang.Object
-
- org.opt4j.core.Individual
-
- org.opt4j.optimizer.mopso.Particle
-
public class Particle extends Individual
TheParticleextends theIndividualby an id, a velocityGenotype, a personal bestGenotypeand the corresponding bestObjectives.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opt4j.core.Individual
Individual.State
-
-
Field Summary
Fields Modifier and Type Field Description protected Genotypebestprotected intidprotected ObjectivesobjectivesBestprotected Genotypevelocity-
Fields inherited from class org.opt4j.core.Individual
genotype, individualStateListeners, objectives, phenotype, state
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GenotypegetBest()Returns the best position.ObjectivesgetBestObjectives()Returns the best objectives.intgetId()Returns the id.GenotypegetVelocity()Returns the velocity.voidsetBest(Genotype best, Objectives objectives)Sets the best position.voidsetId(int id)Sets the id.voidsetVelocity(Genotype velocity)Sets the velocity.-
Methods inherited from class org.opt4j.core.Individual
getGenotype, getObjectives, getPhenotype, getState, isDecoded, isEvaluated, setGenotype, setIndividualStatusListeners, setObjectives, setPhenotype, setState
-
-
-
-
Field Detail
-
id
protected int id
-
velocity
protected Genotype velocity
-
best
protected Genotype best
-
objectivesBest
protected Objectives objectivesBest
-
-
Constructor Detail
-
Particle
@Inject public Particle()
Constructs aParticle.
-
-
Method Detail
-
getVelocity
public Genotype getVelocity()
Returns the velocity.- Returns:
- the velocity
- See Also:
setVelocity(org.opt4j.core.Genotype)
-
setVelocity
public void setVelocity(Genotype velocity)
Sets the velocity.- Parameters:
velocity- the velocity to set- See Also:
getVelocity()
-
getBest
public Genotype getBest()
Returns the best position.- Returns:
- the best
- See Also:
setBest(org.opt4j.core.Genotype, org.opt4j.core.Objectives)
-
getBestObjectives
public Objectives getBestObjectives()
Returns the best objectives.- Returns:
- the best objectives
- See Also:
setBest(org.opt4j.core.Genotype, org.opt4j.core.Objectives)
-
setBest
public void setBest(Genotype best, Objectives objectives)
Sets the best position.- Parameters:
best- the best to setobjectives- the corresponding best objectives- See Also:
getBest()
-
getId
public int getId()
Returns the id.- Returns:
- the id
- See Also:
setId(int)
-
setId
public void setId(int id)
Sets the id.- Parameters:
id- the id to set- See Also:
getId()
-
-