$darkmode
DENOPTIM
|
A collection of candidates. More...
Classes | |
class | XoverSitesAmongCandidates |
A data structure collecting crossover-compatible sites. More... | |
Public Member Functions | |
Population (GAParameters settings) | |
boolean | add (Candidate c) |
void | add (int index, Candidate c) |
Candidate | set (int index, Candidate c) |
Candidate | remove (int index) |
boolean | remove (Object c) |
boolean | removeAll (Collection<?> c) |
void | clear () |
boolean | retainAll (Collection<?> c) |
int | getVersionID () |
Returns an integer that represent the current status of the population. More... | |
Population | clone () |
Does not clone the cross-over compatibility relations between each pairs of population members. More... | |
List< Candidate > | getXoverPartners (Candidate memberA, List< Candidate > eligibleParents, FragmentSpace fragSpace) |
Returns a list of population members that can do crossover with the specified member. More... | |
List< XoverSite > | getXoverSites (Candidate parentA, Candidate parentB) |
Returns a list of crossover sites between the two given parents. More... | |
void | trim (int populationSize) |
Removes all the elements exceeding the given size. More... | |
double | getMinFitness () |
Gets the minimum value of the fitness in this population. More... | |
Candidate | getMinFitnessMember () |
Gets the Candidate with minimum value of the fitness in this population. More... | |
double | getMaxFitness () |
Gets the maximum value of the fitness in this population. More... | |
boolean | isWithinPercentile (double value, double percentile) |
Checks if a given fitness value if within the given percentile of best candidates. More... | |
Candidate | getCandidateNamed (String name) |
Returns the candidate with the given name, if present, or null. More... | |
Private Attributes | |
AtomicInteger | populationUpdate = new AtomicInteger() |
An integer that changes every time we change the population. More... | |
XoverSitesAmongCandidates | xoverCompatibilities |
Crossover compatibility between members. More... | |
GAParameters | settings |
Parameters controlling the GA experiment. More... | |
Static Private Attributes | |
static final long | serialVersionUID = 1L |
Version UID. More... | |
A collection of candidates.
To speed-up operations such as the selection of parents for crossover, this class holds also compatibility relations between candidates. The latter are relevant when APClass compatibility rules are in use. Therefore, if FragmentSpace.useAPclassBasedApproach()
returns false
the population is just a list of candidates.
Definition at line 47 of file Population.java.
denoptim.ga.Population.Population | ( | GAParameters | settings | ) |
Definition at line 71 of file Population.java.
References denoptim.programs.RunTimeParameters.ParametersType.FS_PARAMS, denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.programs.RunTimeParameters.getParameters(), denoptim.ga.Population.settings, denoptim.fragspace.FragmentSpace.useAPclassBasedApproach(), and denoptim.ga.Population.xoverCompatibilities.
Referenced by denoptim.ga.Population.clone().
boolean denoptim.ga.Population.add | ( | Candidate | c | ) |
Definition at line 87 of file Population.java.
References denoptim.ga.Population.populationUpdate.
Referenced by denoptim.ga.OffspringEvaluationTask.call(), denoptim.ga.Population.clone(), denoptim.ga.EAUtilsTest.testAvoidRedundantXOver(), denoptim.ga.EAUtilsTest.testBuildByXOver_Embedded_FixedStructure(), denoptim.ga.EAUtilsTest.testBuildByXOver_Embedded_Free(), denoptim.ga.EAUtilsTest.testBuildByXOver_Embedded_FreeBackwards(), denoptim.ga.EAUtilsTest.testBuildByXOver_SubGraph(), denoptim.ga.PopulationTest.testClone(), denoptim.ga.PopulationTest.testGetMinMax(), denoptim.ga.PopulationTest.testIsInPercentile(), denoptim.ga.PopulationTest.testPopulationVersion(), denoptim.io.DenoptimIOTest.testReadGenerationFromSummary(), and denoptim.ga.PopulationTest.testXOverCompatibility().
void denoptim.ga.Population.add | ( | int | index, |
Candidate | c | ||
) |
Definition at line 98 of file Population.java.
References denoptim.ga.Population.populationUpdate.
void denoptim.ga.Population.clear | ( | ) |
Definition at line 147 of file Population.java.
References denoptim.ga.Population.populationUpdate.
Population denoptim.ga.Population.clone | ( | ) |
Does not clone the cross-over compatibility relations between each pairs of population members.
Definition at line 184 of file Population.java.
References denoptim.ga.Population.add(), denoptim.ga.Population.clone(), denoptim.ga.Population.XoverSitesAmongCandidates.clone(), denoptim.ga.Population.Population(), denoptim.ga.Population.settings, and denoptim.ga.Population.xoverCompatibilities.
Referenced by denoptim.ga.Population.clone(), and denoptim.ga.PopulationTest.testClone().
Candidate denoptim.ga.Population.getCandidateNamed | ( | String | name | ) |
Returns the candidate with the given name, if present, or null.
name | the name of the candidate to retrieve |
Definition at line 515 of file Population.java.
double denoptim.ga.Population.getMaxFitness | ( | ) |
Gets the maximum value of the fitness in this population.
Definition at line 477 of file Population.java.
References denoptim.graph.Candidate.getFitness().
Referenced by denoptim.ga.Population.isWithinPercentile(), and denoptim.ga.PopulationTest.testGetMinMax().
double denoptim.ga.Population.getMinFitness | ( | ) |
Gets the minimum value of the fitness in this population.
Double#MIN_VALUE
Definition at line 452 of file Population.java.
References denoptim.graph.Candidate.getFitness(), and denoptim.ga.Population.getMinFitnessMember().
Referenced by denoptim.ga.OffspringEvaluationTask.call(), denoptim.ga.Population.isWithinPercentile(), and denoptim.ga.PopulationTest.testGetMinMax().
Candidate denoptim.ga.Population.getMinFitnessMember | ( | ) |
Gets the Candidate
with minimum value of the fitness in this population.
Definition at line 464 of file Population.java.
References denoptim.graph.Candidate.getFitness().
Referenced by denoptim.ga.OffspringEvaluationTask.call(), and denoptim.ga.Population.getMinFitness().
int denoptim.ga.Population.getVersionID | ( | ) |
Returns an integer that represent the current status of the population.
Additions, removal or change of a population member triggers change of the returned value. The integer is a good way to check for population changes without looking at the actual population content.
Definition at line 173 of file Population.java.
References denoptim.ga.Population.populationUpdate.
Referenced by denoptim.ga.PopulationTest.testPopulationVersion().
List< Candidate > denoptim.ga.Population.getXoverPartners | ( | Candidate | memberA, |
List< Candidate > | eligibleParents, | ||
FragmentSpace | fragSpace | ||
) |
Returns a list of population members that can do crossover with the specified member.
memberA | a member that wants to do crossover and searches for a partner. |
the | subset of population members we can consider as eligible parents. |
Definition at line 370 of file Population.java.
References denoptim.ga.Population.XoverSitesAmongCandidates.contains(), denoptim.graph.Candidate.getGraph(), denoptim.programs.RunTimeParameters.getLogger(), denoptim.ga.Population.XoverSitesAmongCandidates.getMembersCompatibleWith(), denoptim.graph.Candidate.getName(), denoptim.ga.GraphOperations.locateCompatibleXOverPoints(), denoptim.programs.denovo.GAParameters.maxXOverableSubGraphSize, denoptim.ga.Population.XoverSitesAmongCandidates.put(), denoptim.graph.DGraph.sameAs(), denoptim.ga.Population.settings, and denoptim.ga.Population.xoverCompatibilities.
Referenced by denoptim.ga.EAUtils.performFBCC(), denoptim.ga.PopulationTest.testClone(), and denoptim.ga.PopulationTest.testXOverCompatibility().
Returns a list of crossover sites between the two given parents.
The crossover sites are given using the same order used to specify the parents. This method should always be run after the Population#getXoverPartners(Candidate, ArrayList)
, which populated the crossover compatibility data.
parentA | |
parentB |
Definition at line 423 of file Population.java.
References denoptim.ga.Population.XoverSitesAmongCandidates.get(), and denoptim.ga.Population.xoverCompatibilities.
Referenced by denoptim.ga.PopulationTest.compareSizeOfSites(), denoptim.ga.EAUtils.performFBCC(), and denoptim.ga.PopulationTest.testClone().
boolean denoptim.ga.Population.isWithinPercentile | ( | double | value, |
double | percentile | ||
) |
Checks if a given fitness value if within the given percentile of best candidates.
value | the value of fitness to compare with the population. |
percentile | number in 0-1 range defining the desired percentile. |
true
is the value is among the best percentile% values in the current population, i.e., is larger than min + (100-percentile% * (max-min)). Definition at line 496 of file Population.java.
References denoptim.ga.Population.getMaxFitness(), and denoptim.ga.Population.getMinFitness().
Referenced by denoptim.ga.OffspringEvaluationTask.call(), and denoptim.ga.PopulationTest.testIsInPercentile().
Candidate denoptim.ga.Population.remove | ( | int | index | ) |
Definition at line 116 of file Population.java.
References denoptim.ga.Population.populationUpdate.
Referenced by denoptim.ga.OffspringEvaluationTask.call(), and denoptim.ga.PopulationTest.testPopulationVersion().
boolean denoptim.ga.Population.remove | ( | Object | c | ) |
Definition at line 125 of file Population.java.
References denoptim.ga.Population.populationUpdate.
boolean denoptim.ga.Population.removeAll | ( | Collection<?> | c | ) |
Definition at line 136 of file Population.java.
References denoptim.ga.Population.populationUpdate.
boolean denoptim.ga.Population.retainAll | ( | Collection<?> | c | ) |
Definition at line 156 of file Population.java.
References denoptim.ga.Population.populationUpdate.
Definition at line 107 of file Population.java.
References denoptim.ga.Population.populationUpdate.
Referenced by denoptim.ga.PopulationTest.testPopulationVersion().
void denoptim.ga.Population.trim | ( | int | populationSize | ) |
Removes all the elements exceeding the given size.
Does not reorder the population prior to trimming!
populationSize | size to trim down to. |
Definition at line 435 of file Population.java.
References denoptim.programs.denovo.GAParameters.getPopulationSize(), denoptim.ga.Population.XoverSitesAmongCandidates.remove(), denoptim.ga.Population.settings, and denoptim.ga.Population.xoverCompatibilities.
Referenced by denoptim.ga.EvolutionaryAlgorithm.run().
|
private |
An integer that changes every time we change the population.
Definition at line 57 of file Population.java.
Referenced by denoptim.ga.Population.add(), denoptim.ga.Population.clear(), denoptim.ga.Population.getVersionID(), denoptim.ga.Population.remove(), denoptim.ga.Population.removeAll(), denoptim.ga.Population.retainAll(), and denoptim.ga.Population.set().
|
staticprivate |
Version UID.
Definition at line 52 of file Population.java.
|
private |
Parameters controlling the GA experiment.
Definition at line 67 of file Population.java.
Referenced by denoptim.ga.Population.clone(), denoptim.ga.Population.getXoverPartners(), denoptim.ga.Population.Population(), and denoptim.ga.Population.trim().
|
private |
Crossover compatibility between members.
Definition at line 62 of file Population.java.
Referenced by denoptim.ga.Population.clone(), denoptim.ga.Population.getXoverPartners(), denoptim.ga.Population.getXoverSites(), denoptim.ga.Population.Population(), and denoptim.ga.Population.trim().