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; }
public virtual void Initialize( MachineDescription machineDescription, InstructionGraph instructionGraph, SchedulingGenome initGenome) { InitializeBase(machineDescription, instructionGraph); InitializeDependencies(); population = new SchedulingGenomePopulation( PopulationSize, this, initGenome, 1); InitializePopulation(); InitializeGA(); bestObjectiveMonitor = new double[MonitoredGenerations]; if (Initialized != null) Initialized(this); }
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; }
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; }