コード例 #1
0
ファイル: Colour.cs プロジェクト: kjinks/SVGWrapper
        public Palette(float hue, float degree, Variety variation)
        {
            this.genes = new DNA();
            this.hue = hue;
            this.hueLeft = hue - degree;
            this.hueRight = hue + degree;

            this.degree = degree;
            this.variation = variation;

            this.DefineColourPrimes();
        }
コード例 #2
0
 protected abstract DNA <T> Crossover(DNA <T> dna1, DNA <T> dna2);
コード例 #3
0
        protected virtual void ChooseParents(double[] summedFitness, ref DNA <T> parent1, ref DNA <T> parent2)
        {
            double summed = summedFitness[summedFitness.Length - 1];

            do
            {
                for (int j = 0; j < populationSize; j++)
                {
                    if (parent1 != null && parent2 != null)
                    {
                        return;
                    }

                    if (parent1 == null && parent2 != dna[j] && 1 - (dna[j].Fitness / summed) >= rand.NextDouble())
                    {
                        parent1 = dna[j];
                    }

                    if (parent2 == null && parent1 != dna[j] && 1 - (dna[j].Fitness / summed) >= rand.NextDouble())
                    {
                        parent2 = dna[j];
                    }
                }
            } while (parent1 == null || parent2 == null);
        }
コード例 #4
0
 protected abstract int CalculateFitness(DNA <T> dna);
コード例 #5
0
ファイル: Mandala.cs プロジェクト: kjinks/SVGWrapper
 public Mandala(int seed = 1)
 {
     this.genes = new DNA(seed : seed);
     this.Reset();
 }