Exemplo n.º 1
0
 public SchedulingGenomePopulation(
     int size, GAScheduler scheduler, SchedulingGenome initGenome,
     int nInit)
     : base(size)
 {
     this.scheduler = scheduler;
     this.initGenome = initGenome;
     this.nInit = nInit;
 }
Exemplo n.º 2
0
        public GACodeGenerator(
            GAInstructionSelectorConfiguration selectorConfiguration,
            GASchedulerConfiguration schedulerConfiguration)
        {
            this.selectorConfiguration = selectorConfiguration;
            this.schedulerConfiguration = schedulerConfiguration;

            selector = new GAInstructionSelector(this);
            scheduler = selector.Scheduler;
        }
Exemplo n.º 3
0
        public SchedulingGenome(SchedulingGenomePopulation population)
        {
            this.population = population;
            this.scheduler = population.Scheduler;

            int maxSchedulingSteps = InstructionNodes.Count;

            schedule = new InstructionNode[
                maxSchedulingSteps, MachineDescription.ExecutionUnits];

            instructionInfos = new Hashtable(InstructionNodes.Count);

            foreach (InstructionNode iNode in InstructionNodes)
                instructionInfos[iNode] = new InstructionInfo();

            valueInfos = new Hashtable(RegisterValues.Count);

            foreach (ValueNode vNode in RegisterValues)
                valueInfos[vNode] = new ValueInfo();

            isValid = false;

            generationOfBirth = population.GA.Generation;
        }
Exemplo n.º 4
0
 public GAInstructionSelector(GACodeGenerator codeGenerator)
 {
     this.codeGenerator = codeGenerator;
     configuration = codeGenerator.SelectorConfiguration;
     scheduler = new GAScheduler(codeGenerator);
 }
Exemplo n.º 5
0
 public SelectionGenomeEvaluator(GAScheduler scheduler)
 {
     this.scheduler = scheduler;
 }
Exemplo n.º 6
0
 public SchedulingGenomePopulation(int size, GAScheduler scheduler)
     : base(size)
 {
     this.scheduler = scheduler;
 }
Exemplo n.º 7
0
        public virtual void Copy(
            SchedulingGenome other,
            IDictionary instructionMap,
            IDictionary valueMap)
        {
            population = other.population;
            scheduler = other.scheduler;

            schedule = new InstructionNode[
                other.schedule.GetLength(0),
                other.schedule.GetLength(1)];

            for (int i = 0; i < schedule.GetLength(0); i++) {
                for (int j = 0; j < schedule.GetLength(1); j++) {

                    InstructionNode iNode = other.schedule[i, j];

                    if (iNode != null) {
                        schedule[i, j] =
                            (InstructionNode) instructionMap[other.schedule[i, j]];
                    } else {
                        schedule[i, j] = null;
                    }
                }
            }

            valueInfos = new Hashtable();

            foreach (ValueNode vNode in other.ValueInfos.Keys) {

                ValueInfo info = new ValueInfo();
                ValueInfo otherInfo = other.GetValueInfo(vNode);

                info.Register = otherInfo.Register;
                info.Production = otherInfo.Production;
                info.LastUsage = otherInfo.LastUsage;
                valueInfos[valueMap[vNode]] = info;
            }

            instructionInfos = new Hashtable();

            foreach (InstructionNode iNode in other.InstructionInfos.Keys) {

                InstructionInfo info = new InstructionInfo();
                InstructionInfo otherInfo = other.GetInstructionInfo(iNode);

                info.SchedulingStep = otherInfo.SchedulingStep;
                instructionInfos[instructionMap[iNode]] = info;
            }

            isValid = other.isValid;
            scheduleLength = other.scheduleLength;
            violatedSchedulingConstraints = other.violatedSchedulingConstraints;
            violatedRegisterConstraints = other.violatedRegisterConstraints;
            generationOfBirth = other.generationOfBirth;
        }
Exemplo n.º 8
0
        public virtual void Copy(IGenome otherGenome)
        {
            SchedulingGenome other = (SchedulingGenome) otherGenome;

            population = other.population;
            scheduler = other.scheduler;

            schedule = new InstructionNode[
                other.schedule.GetLength(0),
                other.schedule.GetLength(1)];

            for (int i = 0; i < schedule.GetLength(0); i++)
                for (int j = 0; j < schedule.GetLength(1); j++)
                    schedule[i, j] = other.schedule[i, j];

            valueInfos = new Hashtable();

            foreach (ValueNode vNode in other.ValueInfos.Keys) {

                ValueInfo info = new ValueInfo();
                ValueInfo otherInfo = other.GetValueInfo(vNode);

                info.Register = otherInfo.Register;
                info.Production = otherInfo.Production;
                info.LastUsage = otherInfo.LastUsage;
                valueInfos[vNode] = info;
            }

            instructionInfos = new Hashtable();

            foreach (InstructionNode iNode in other.InstructionInfos.Keys) {

                InstructionInfo info = new InstructionInfo();
                InstructionInfo otherInfo = other.GetInstructionInfo(iNode);

                info.SchedulingStep = otherInfo.SchedulingStep;
                instructionInfos[iNode] = info;
            }

            isValid = other.isValid;
            scheduleLength = other.scheduleLength;
            violatedSchedulingConstraints = other.violatedSchedulingConstraints;
            violatedRegisterConstraints = other.violatedRegisterConstraints;
            generationOfBirth = other.generationOfBirth;
        }