anchor.diff:          c1.Genos <- second
           
       /// evolve the whole population 
  -    let Evolve (population:ChromosomeType list) selectionF crossoverF fitnessF crossoverRate mutationRate elitism = 
  +    let Evolve<'T,'S when 'S: comparison> ((population: ChromosomeType<'T,'S> list),
  +                                            selectionF: ChromosomeType<'T,'S> list -> ChromosomeType<'T,'S> seq,
  +                                            crossoverF, 
  +                                            crossoverRate, 
  +                                            mutationRate, 
  +                                            elitism) = 
           let populationSize = Seq.length population 
           let r() = randomF() % populationSize 
  -        let elites = selectionF population fitnessF |> Seq.toList
  +        let elites = selectionF population |> Seq.toList
           let seq0 = elites |> Seq.mapi (fun i element->(i,element)) |> Seq.filter (fun (i,_)->i%2=0) |> Seq.map (fun (_,b)->b)
           let seq1 = elites |> Seq.mapi (fun i element->(i,element)) |> Seq.filter (fun (i,_)->i%2<>0) |> Seq.map (fun (_,b)->b)
  -        let xoverAndMutate (a:ChromosomeType) (b:ChromosomeType) =
  +        let xoverAndMutate (a:ChromosomeType<'T,'S>) (b:ChromosomeType<'T,'S>) =
               if (randomFloatF() < crossoverRate) then 
                   crossoverF a b 
               if (randomFloatF() < mutationRate) then 
  
positive.code:     let compositeFunctions functions = 
           Seq.fold ( >> ) id functions
  
      let populationToMatrix (population: ChromosomeType list) = 
          [ for i in population do yield (i.ToRows()) ] 
          |> List.concat
  
  open EvolutionaryComputation
  
  let lociFunction() = box(random.Next(10))
  
  let fitnessF (items:obj list) = 
      items |> Seq.map (System.Convert.ToInt32) |> Seq.sum
  
  let populationSize = 20
  let chromosomeSize = 10
  let myPopulation = Population lociFunction populationSize chromosomeSize
  
  for i in myPopulation do printfn "%A" (i.ToRows())
  
  let elitism = true
  let myEvolve population = Evolve population RankSelection ShuffleCrossover fitnessF 0.9 0.1 elitism
  
  let result = composite myEvolve 75 myPopulation 
   
  printfn "%A" (maxFitness result fitnessF)
  System.Console.ReadKey() |> ignore
  
  
negative.code:             let F = 
                  match mutationF with
                      | Some(mutationF) -> mutationF
                      | None -> initialF
              let transform i v =
                  match i with
                      | _ when i=location -> F()
                      | _ -> v
              this.Genos <- List.mapi transform this.Genos 
  
          member this.ToRows() = [ this.Genos |> List.map toInt; this.Pheno |> List.map toInt ]
  
      /// generate a population for GAs
      let Population<'T,'S when 'S: comparison> randomF fitnessF toInt populationSize chromosomeSize = 
          [for i in 1..populationSize do yield (new ChromosomeType<'T,'S>(initialF=randomF,fitnessF=fitnessF,toInt=toInt,size=chromosomeSize))] 
  
      /// find the maximum fitness value from a population
      let maxFitness<'T,'S when 'S: comparison> population  = 
          let best = Seq.maxBy (fun (c:ChromosomeType<'T,'S>) -> c.Fitness()) population
          best.Fitness()
  
      /// find the fittest individual
      let bestChromosome<'T,'S when 'S: comparison> population = 
          let best = Seq.maxBy (fun (c:ChromosomeType<'T,'S>) -> c.Fitness()) population
          best
  
      /// rank selection method
      let RankSelection<'T,'S when 'S: comparison> (population:ChromosomeType<'T,'S> list) = 
          let populationSize = population.Length
          let r() = randomF() % populationSize
          let randomSelection() = 
              let c0 = population.[r()]
              let c1 = population.[r()]
              let result = if (c0.Fitness() > c1.Fitness()) then c0 else c1
              result.Clone();
          Seq.init populationSize (fun _ -> randomSelection())
  
      /// shuffle crossover
      let ShuffleCrossover<'T,'S when 'S: comparison> (c0:ChromosomeType<'T,'S>) (c1:ChromosomeType<'T,'S>) =
          let crossover c0 c1 =
              let isEven n = n%2 = 0
              let randomSwitch (x,y) = if isEven (randomF()) then (x,y) else (y,x) 
  