コード例 #1
0
ファイル: GAInstructionSelector.cs プロジェクト: harnold/cobe
        public virtual void Initialize(
            MachineDescription machineDescription,
            ProgramGraph programGraph)
        {
            this.machineDescription = machineDescription;
            this.programGraph = programGraph;

            transferInstructions = machineDescription.GetTransferInstructions();
            operationNodes = programGraph.GetOperationNodes();
            valueNodes = programGraph.GetValueNodes();

            coveringDesc =
                programGraph.CreateCoveringDesc(machineDescription.Instructions);

            population = new SelectionGenomePopulation(PopulationSize, this);

            population.ScalingOperator   = new LinearScaling(ScalingFactor, true);
            population.SelectionOperator = new RouletteWheelSelection();
            population.MutationOperator  = new SelectionGenomeMutation();
            population.CrossoverOperator = new SelectionGenomeCrossover();
            population.GenomeEvaluator   = new SelectionGenomeEvaluator(scheduler);

            ga = new SimpleGA(population);

            ga.PMutation = configuration.PMutation;
            ga.PCrossover = configuration.PCrossover;

            ga.ComputeObjectiveStatistics =
                configuration.ComputeObjectiveStatistics;
            ga.ComputeFitnessStatistics =
                configuration.ComputeFitnessStatistics;
            ga.ComputeGenomeDiversity =
                configuration.ComputeGenomeDiversity;

            ga.GenerationComputed +=
                new SimpleGA.EventHandler(UpdateGAMonitor);

            bestObjectiveMonitor = new double[MonitoredGenerations];

            if (Initialized != null)
                Initialized(this);
        }
コード例 #2
0
ファイル: GAScheduler.cs プロジェクト: harnold/cobe
        protected virtual void InitializeBase(
            MachineDescription machineDescription,
            InstructionGraph instructionGraph)
        {
            this.machineDescription = machineDescription;
            this.instructionGraph = instructionGraph;

            instructionNodes = instructionGraph.GetInstructionNodes();

            instructionsOnExUnit =
                new IList[machineDescription.ExecutionUnits];

            for (int i = 0; i < machineDescription.ExecutionUnits; i++) {
                instructionsOnExUnit[i] =
                    instructionGraph.GetInstructionNodesOnExUnit(i);
            }

            valueNodes = instructionGraph.GetValueNodes();

            registerValues = new ArrayList();

            foreach (ValueNode vNode in valueNodes) {
                if (vNode is RegisterValueNode)
                    registerValues.Add(vNode);
            }
        }
コード例 #3
0
ファイル: GACodeGenerator.cs プロジェクト: harnold/cobe
 public virtual void Initialize(
     MachineDescription machineDescription,
     ProgramGraph programGraph)
 {
     selector.Initialize(machineDescription, programGraph);
 }
コード例 #4
0
ファイル: GAScheduler.cs プロジェクト: harnold/cobe
        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);
        }