コード例 #1
0
        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();
        }
コード例 #2
0
ファイル: UnorderedPopulation.cs プロジェクト: jarr-us/jarrus
        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();
        }
コード例 #3
0
ファイル: UnorderedPopulation.cs プロジェクト: jarr-us/jarrus
        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();
        }
コード例 #4
0
        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();
        }
コード例 #5
0
ファイル: Chromosome.cs プロジェクト: jarr-us/jarrus
        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);
        }