Exemplo n.º 1
0
        public override Gene GenerateGene(int geneIndex)
        {
            var machineChromosome    = (MachineChromosome)GetGenes()[geneIndex].Value;
            var shuffled             = machineChromosome.GetGenes().AsShuffledEnumerable().ToArray();
            var newMachineChromosome = new MachineChromosome(shuffled);

            return(new Gene(newMachineChromosome));
        }
Exemplo n.º 2
0
        private ScheduleChromosome(JobShop jobShop, bool generateNew) : base(jobShop.MachinesCount)
        {
            this.JobShop = jobShop;

            if (generateNew)
            {
                // initialize genes
                for (int i = 0; i < jobShop.MachinesCount; i++)
                {
                    var machineChromosome = new MachineChromosome(jobShop.MachineOperations[i]
                                                                  .AsShuffledEnumerable()
                                                                  .ToArray());
                    ReplaceGene(i, new Gene(machineChromosome));
                }
            }
        }