public void Evaluate(BinaryChromosome chromosome) { var binaryValues = chromosome.GetValues().Select(gene => Convert.ToInt64(gene.ToBinaryString(), 2)).ToArray(); var floatValues = binaryValues.Select( (i, index) => _lowerBounds[index] + i * (_upperBounds[index] - _lowerBounds[index]) / (Math.Pow(2, chromosome.GetValue(index).Length) - 1)) .ToArray(); chromosome.Fitness = _function.Value(floatValues); }
public BinaryChromosome(BinaryChromosome chromosome) : base(chromosome) { }