protected OrderedPopulation(GAConfiguration configuration, Chromosome[] chromosomes, int generationNumber, Gene[] possibleValues, List <Chromosome> retired = null) { Chromosomes = chromosomes; Configuration = configuration; GenerationNumber = ++generationNumber; PossibleValues = possibleValues; Retired = retired; StandardConstructorLogic(); }
protected UnorderedPopulation(GAConfiguration configuration, Chromosome[] chromosomes, int generationNumber, Type geneType, List <Chromosome> retired = null) { Chromosomes = chromosomes; Configuration = configuration; GenerationNumber = ++generationNumber; GeneType = geneType; Retired = retired; StandardConstructorLogic(); }
public UnorderedPopulation(GAConfiguration configuration, Chromosome[] chromosomes, Type geneType) { if (configuration == null || chromosomes == null || chromosomes.Length <= 2 || geneType == null) { throw new ArgumentException("Invalid parameters passed to the Population"); } GeneType = geneType; Chromosomes = chromosomes; Configuration = configuration; StandardConstructorLogic(); }
public OrderedPopulation(GAConfiguration configuration, Chromosome[] chromosomes, params Gene[] possibleValues) { if (configuration == null || chromosomes == null || chromosomes.Length <= 2 || possibleValues == null || possibleValues.Length <= 2) { throw new ArgumentException("Invalid parameters passed to the Population"); } Chromosomes = chromosomes; Configuration = configuration; PossibleValues = possibleValues; StandardConstructorLogic(); }
public bool ShouldRetire(GAConfiguration config) { switch (config.RetirementStrategy) { case RetirementStrategy.None: return(false); case RetirementStrategy.MaxAge: return(Age >= config.MaxRetirement && config.MaxRetirement != 0); case RetirementStrategy.MaxChildren: return(Children >= config.MaxRetirement && config.MaxRetirement != 0); } return(false); }