Accord.Genetic.OptimizationFunction1D.Translate C# (CSharp) Method

Translate() public method

Translates genotype to phenotype.
The method returns double value, which represents function's input point encoded by the specified chromosome.
public Translate ( IChromosome chromosome ) : double
chromosome IChromosome Chromosome, which genoteype should be /// translated to phenotype.
return double
        public double Translate(IChromosome chromosome)
        {
            // get chromosome's value and max value
            double val = ((BinaryChromosome)chromosome).Value;
            double max = ((BinaryChromosome)chromosome).MaxValue;

            // translate to optimization's funtion space
            return val * range.Length / max + range.Min;
        }