public static FloatingPointChromosome2 Create(double[] minValue, double[] maxValue, int[] fractionDigits, double[] geneValues = null)
        {
            int[] bits = Enumerable.Range(0, minValue.Length).
                         Select(o => GeneticSharpUtil.GetChromosomeBits(GeneticSharpUtil.ToChromosome(minValue[o], maxValue[o]), fractionDigits[o])).
                         ToArray();

            return(new FloatingPointChromosome2(minValue, maxValue, fractionDigits, bits, geneValues));
        }
 /// <summary>
 /// Converts the chromosome to the floating points representation.
 /// </summary>
 /// <returns>The floating points.</returns>
 public double[] ToFloatingPoints()
 {
     return(BinaryStringRepresentation.ToDouble(ToString(), _totalBits, _fractionDigits).
            Select((o, i) =>
     {
         double r = GeneticSharpUtil.FromChromosome(_minValue[i], o);
         r = Math.Round(r, _fractionDigits[i]);          // because of the floating point arithmatic, something like 7.5 may end up 7.5000000000001, which wouldn't really cause errors but would be annoying when printing out results.  So rounding to force the desired digits
         r = EnsureMinMax(r, i);
         return r;
     }).
            ToArray());
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:GeneticSharp.Domain.Chromosomes.FloatingPointChromosome"/> class.
        /// </summary>
        /// <param name="minValue">Minimum value.</param>
        /// <param name="maxValue">Max value.</param>
        /// <param name="totalBits">Total bits.</param>
        /// <param name="fractionDigits">Fraction digits.</param>
        /// /// <param name="geneValues">Gene values.</param>
        private FloatingPointChromosome2(double[] minValue, double[] maxValue, int[] fractionDigits, int[] totalBits, double[] geneValues = null)
            : base(totalBits.Sum())
        {
            _minValue       = minValue;
            _maxValue       = maxValue;
            _totalBits      = totalBits;
            _fractionDigits = fractionDigits;

            if (geneValues == null)
            {
                // Values weren't supplied, create random values to start with
                geneValues = new double[minValue.Length];
                var rnd = RandomizationProvider.Current;

                for (int i = 0; i < geneValues.Length; i++)
                {
                    geneValues[i] = rnd.GetDouble(0, GeneticSharpUtil.ToChromosome(minValue[i], maxValue[i]));
                }
            }
            else
            {
                // Starter values were passed in, transform to local coords
                geneValues = geneValues.
                             Select((o, i) => GeneticSharpUtil.ToChromosome(minValue[i], o)).
                             ToArray();
            }

            _originalValueStringRepresentation = String.Join(
                "",
                BinaryStringRepresentation.ToRepresentation(
                    geneValues,
                    totalBits,
                    fractionDigits));

            CreateGenes();
        }