Exemplo n.º 1
0
        public double GetFitness(double[] weights)
        {
            // Get the resulting Brainfuck program.
            Program = CommonManager.ConvertDoubleArrayToBF(weights);

            // Get the fitness.
            double fitness = GetFitnessMethod(Program);

            // Get the output.
            if (_output.Length > 0)
            {
                Output = _output.ToString().TrimEnd(',');
            }

            return(fitness);
        }
Exemplo n.º 2
0
        public double GetFitness(double[] weights)
        {
            // Get the resulting Brainfuck program.
            MainProgram = Program = CommonManager.ConvertDoubleArrayToBF(weights);

            // Append any functions to the program.
            if (_appendFunctions != null)
            {
                Program += "@" + _appendFunctions;
            }

            // Get the fitness.
            double fitness = GetFitnessMethod(Program);

            // Get the output.
            if (_output.Length > 0)
            {
                Output = _output.ToString().TrimEnd(',');
            }

            return(fitness);
        }