示例#1
0
 // Constructor for manual calculation of WCET.
 EvolutionAlgo(Parameter param, finishedManual_delegate finishedManual, calculateFitness_delegate calculateFitness)
     : this()
 {
     this._param = param;
     this._finishedManual = finishedManual;
     this._calculateFitness = calculateFitness;
     this._automatic = false;
     _startSize = _aSettings.populationSize;
 }
示例#2
0
 public Generation(uint size, Parameter param, double mutateRate, uint maxCrossover, EvolutionAlgo ea)
 {
     this._blaram = param;
     this._size = size;
     this.mutateRate = mutateRate;
     this.maxCrossover = maxCrossover;
     this.createGenes(0);
     this._ea = ea;
 }
示例#3
0
 //Create Genom and Calucalte Fitness.
 public Genom(Parameter param, EvolutionAlgo ea)
 {
     this._param = param;
     this._ea = ea;
     if ((_param != null) && (ea != null))
     {
         calculateFitness();
     }
 }
示例#4
0
 // Constructor for automatic calculation of WCET.
 EvolutionAlgo(Parameter param, AlgoSettings aSettings, printResult_delegate printResult, finishedWCET_delegate finishedWCET,
     calculateFitness_delegate calculateFitness)
     : this()
 {
     this._param = param;
     this._aSettings = aSettings;
     this._printResult = printResult;
     this._finishedWCET = finishedWCET;
     this._calculateFitness = calculateFitness;
     this._automatic = true;
     _startSize = _aSettings.populationSize;
 }
示例#5
0
        private void createGenes(uint givenGenes)
        {
            Parameter genomParameter;
            Random ran;
            int countAnalog = _blaram.analog.Length;
            int countDigital = _blaram.digital.Length;
            int countEnums = _blaram.enums.Length;
            float[] analogVal = new float[countAnalog];
            bool[] digitalVal = new bool[countDigital];
            int[] enumVal = new int[countEnums];
            for (uint k = givenGenes; k < this._size; k++)
            {
                ran = new Random();
                for (int i = 0; i < countAnalog; i++) // Erzeugung Random Analogwerte
                {

                    analogVal[i] = (float)ran.NextDouble();
                }
                for (int i = 0; i < countDigital; i++) // Erzeugung Random Digitalwerte
                {
                    digitalVal[i] = rndBoolean();
                }
                for (int i = 0; i < countEnums; i++) // Erzeugung Random Enum werte
                {
                    enumVal[i] = ran.Next(10);
                }
                genomParameter = new Parameter(analogVal, digitalVal, enumVal); //Parameter und Genomerzeugung
                _genomArray[k] = new Genom(genomParameter,_ea);
                //Calculate Fittness.

            }
        }
示例#6
0
 public Genom(Parameter param)
 {
     this._param = param;
 }