MCScheduling 1.0
Set of Algorithms for Solving Mixed-Criticality Scheduling
|
A population consist of a individual chromosomes that forms potential solutions to a problem. More...
Classes | |
class | FittestChromosomeEnumerator |
FittestChromosomeEnumerator may be used to enumerate fittest chromosomes of a population in memory efficient way. More... | |
Public Member Functions | |
CPopulation (CConfiguration configuration) | |
Creates a new empty population. | |
CPopulation (CConfiguration configuration, IChromosome[] chromosomes) | |
Creates a new population from the specified list of chromosomes. | |
CPopulation (CConfiguration configuration, IChromosome chromosome) | |
Creates a new population formed by the specified chromosome. | |
CPopulation (CConfiguration configuration, int size) | |
Creates a new empty population. | |
CConfiguration | getConfiguration () |
Returns the configuration of the genetic algorithm used to evolve this population. | |
void | addChromosome (IChromosome chromosome) |
Adds a chromosome to this Population. | |
void | addChromosomes (CPopulation population) |
Adds 'all' the chromosomes in the specified population, if the population has size maximum set, then some of the chromosomes will be ommited. | |
void | setChromosomes (IEnumerable< IChromosome > chromosomes) |
Replaces all chromosomes in the population with the specified list of chromosomes. | |
void | setChromosome (int index, IChromosome chromosome) |
Replaces the chromosome at the specified index with the specified chromosome. | |
IChromosome | getChromosome (int index) |
Returns the chromosome at the specified position. | |
void | removeChromosome (int index) |
Removes a chromosome at the specified index in the population. | |
IList< IChromosome > | getChromosomes () |
Returns the unmodifiable list of chromosomes forming this population. | |
int | getSize () |
Returns the population size. | |
void | clear () |
Removes all the chromosomes from the population. | |
IChromosome[] | toChromosomes () |
Returns the population of the chromosomes in an array. | |
IChromosome | getFittestChromosome () |
Returns the fittest chromosome in the population. | |
IChromosome | getWorstFitChromosome () |
Returns the worst fit chromosome in the population. | |
bool | isChanged () |
Returns true if the population has been changed, otherwise it returns false. | |
bool | isSorted () |
Returns true if the population is sorted, false otherwise. | |
bool | hasMaximumSize () |
Returns true if the maximum capacity of the population is set; otherwise, it returns false. | |
void | setMaximumSize (int maximumSize) |
Sets the maximum size of the population. | |
bool | contains (IChromosome chromosome) |
Determines whether the specified chromosome is present in this population. | |
IEnumerator< IChromosome > | getFittestChromosomes (int count) |
Sorts the chromosomes in the population according to their fitness value using this.sortByfitness(), and then returns the specified number of best fit chromosomes. | |
void | sortByFitness () |
Sorts the chromosomes in the population according to their fitness value using the IFitnessComparer set in the configuration. | |
override bool | Equals (Object population) |
Determines whether the specified object is equal to this population. | |
override int | GetHashCode () |
Returns the hashcode of this population. | |
object | Clone () |
Creates a deep copy of this population. | |
Protected Member Functions | |
void | setChanged (bool changed) |
Informs the population that its fittest chromosome may have changed. | |
void | setSorted (bool sorted) |
Marks the population as sorted. | |
Properties | |
IChromosome | this[int index] [get, set] |
Gets or sets the chromosome at the specified index. |
A population consist of a individual chromosomes that forms potential solutions to a problem.
MCScheduling.GeneticAlgorithm.CPopulation.CPopulation | ( | CConfiguration | configuration | ) |
Creates a new empty population.
configuration | The configuration of the genetic algorithm used to evolve this population. |
MCScheduling.GeneticAlgorithm.CPopulation.CPopulation | ( | CConfiguration | configuration, |
IChromosome[] | chromosomes | ||
) |
Creates a new population from the specified list of chromosomes.
Note: Individual chromosomes are not cloned! This means that the structure of the specified chromosomes may be changed during the evolution!
configuration | The configuration of the genetic algorithm used to evolve this population. |
chromosomes | The list of chromosomes forming the new population. |
MCScheduling.GeneticAlgorithm.CPopulation.CPopulation | ( | CConfiguration | configuration, |
IChromosome | chromosome | ||
) |
Creates a new population formed by the specified chromosome.
Note: Individual chromosomes are not cloned! This means that the structure of the specified chromosomes may be changed during the evolution!
configuration | The configuration of the genetic algorithm used to evolve this population. |
chromosome | The single chromosome forming the new population. |
MCScheduling.GeneticAlgorithm.CPopulation.CPopulation | ( | CConfiguration | configuration, |
int | size | ||
) |
Creates a new empty population.
The size argument is used for optimalization reason (lesser memory reallocation).
configuration | The configuration of the genetic algorithm used to evolve this population. |
size | The number of preallocated slots for the individuals of the initial population. |
void MCScheduling.GeneticAlgorithm.CPopulation.addChromosome | ( | IChromosome | chromosome | ) |
Adds a chromosome to this Population.
chromosome | The chromosome to be added. |
void MCScheduling.GeneticAlgorithm.CPopulation.addChromosomes | ( | CPopulation | population | ) |
Adds 'all' the chromosomes in the specified population, if the population has size maximum set, then some of the chromosomes will be ommited.
population | The population of chromosomes to be added. |
object MCScheduling.GeneticAlgorithm.CPopulation.Clone | ( | ) |
Creates a deep copy of this population.
bool MCScheduling.GeneticAlgorithm.CPopulation.contains | ( | IChromosome | chromosome | ) |
Determines whether the specified chromosome is present in this population.
chromosome | The chromosome to be checked. |
override bool MCScheduling.GeneticAlgorithm.CPopulation.Equals | ( | Object | population | ) |
Determines whether the specified object is equal to this population.
population | The object to be compared. |
IChromosome MCScheduling.GeneticAlgorithm.CPopulation.getChromosome | ( | int | index | ) |
Returns the chromosome at the specified position.
index | The index of the chromosome to be returned. |
IList<IChromosome> MCScheduling.GeneticAlgorithm.CPopulation.getChromosomes | ( | ) |
Returns the unmodifiable list of chromosomes forming this population.
CConfiguration MCScheduling.GeneticAlgorithm.CPopulation.getConfiguration | ( | ) |
Returns the configuration of the genetic algorithm used to evolve this population.
IChromosome MCScheduling.GeneticAlgorithm.CPopulation.getFittestChromosome | ( | ) |
Returns the fittest chromosome in the population.
The comparison of the fitness is made by the IFitnessComparer set in the configuration.
IEnumerator<IChromosome> MCScheduling.GeneticAlgorithm.CPopulation.getFittestChromosomes | ( | int | count | ) |
Sorts the chromosomes in the population according to their fitness value using this.sortByfitness(), and then returns the specified number of best fit chromosomes.
count | The number of best fit chromosomes in the population to be returned. |
override int MCScheduling.GeneticAlgorithm.CPopulation.GetHashCode | ( | ) |
Returns the hashcode of this population.
int MCScheduling.GeneticAlgorithm.CPopulation.getSize | ( | ) |
Returns the population size.
IChromosome MCScheduling.GeneticAlgorithm.CPopulation.getWorstFitChromosome | ( | ) |
Returns the worst fit chromosome in the population.
The comparison of the fitness is made by the IFitnessComparer set in the configuration.
bool MCScheduling.GeneticAlgorithm.CPopulation.isChanged | ( | ) |
Returns true if the population has been changed, otherwise it returns false.
void MCScheduling.GeneticAlgorithm.CPopulation.removeChromosome | ( | int | index | ) |
Removes a chromosome at the specified index in the population.
index | The index of the chromosome to be removed. |
void MCScheduling.GeneticAlgorithm.CPopulation.setChanged | ( | bool | changed | ) | [protected] |
Informs the population that its fittest chromosome may have changed.
changed | If true, the population's fittest chromosome may have changed, if false, the current fittest chromosome is still valid. |
void MCScheduling.GeneticAlgorithm.CPopulation.setChromosome | ( | int | index, |
IChromosome | chromosome | ||
) |
Replaces the chromosome at the specified index with the specified chromosome.
If the index is greater or equal to the population size the chromosome is added to the population.
index | The position of the chromosome to be replaced. |
chromosome | The chromosome to be set. |
void MCScheduling.GeneticAlgorithm.CPopulation.setChromosomes | ( | IEnumerable< IChromosome > | chromosomes | ) |
Replaces all chromosomes in the population with the specified list of chromosomes.
chromosomes | The chromosomes forming the population. |
void MCScheduling.GeneticAlgorithm.CPopulation.setMaximumSize | ( | int | maximumSize | ) |
Sets the maximum size of the population.
Any chromosome added to the population that would make it larger then this value is ignored.
maximumSize | The maximum size of the population. |
void MCScheduling.GeneticAlgorithm.CPopulation.setSorted | ( | bool | sorted | ) | [protected] |
Marks the population as sorted.
sorted | If true the population is sorted. |
void MCScheduling.GeneticAlgorithm.CPopulation.sortByFitness | ( | ) |
Sorts the chromosomes in the population according to their fitness value using the IFitnessComparer set in the configuration.
The chromosomes are sorted from the fittest to the worst fit, which results in the fittest chromosome being positioned at index 0.
IChromosome [] MCScheduling.GeneticAlgorithm.CPopulation.toChromosomes | ( | ) |
Returns the population of the chromosomes in an array.
IChromosome MCScheduling.GeneticAlgorithm.CPopulation.this[int index] [get, set] |
Gets or sets the chromosome at the specified index.
index | The zero-based index of the chromosome to get or set. |
ArgumentOutOfRangeException | If the index is less then 0 or greater-or-equal to this.size(). |