private ISorterCompParaPoolWorkflow EvaluateResultsStep(int seed) { var sorterLayerEval = CompParaPool.SorterOnSwitchableGroupSets.Select( t => GenomeEval.Make( genome: SorterLayer.GetGenome(t.Sorter.Guid), score: t.SwitchesUsed, generation: Generation, success: t.SorterOnSwitchableGroups.All(sg => sg.Success) ) ).Make <ISorterGenome, IGenomeEval <ISorterGenome> >(); var switchableGroupLayerEval = CompParaPool.SorterOnSwitchableGroups.GroupBy(t => t.SwitchableGroupGuid).Select( g => GenomeEval.Make( genome: SwitchableGroupLayer.GetGenome(g.Key), score: g.Sum(s => - s.SwitchUseCount), generation: Generation, success: g.All(m => m.Success) ) ).Make <ISwitchableGroupGenome, IGenomeEval <ISwitchableGroupGenome> >(); return(new SorterCompParaPoolWorkflowImpl ( compWorkflowState: CompWorkflowState.UpdateGenomes, sorterLayer: SorterLayer, switchableGroupLayer: SwitchableGroupLayer, compParaPool: CompParaPool, sorterLayerEval: sorterLayerEval, switchableGroupLayerEval: switchableGroupLayerEval, sorterCompParaPoolParams: SorterCompParaPoolParams, generation: Generation )); }
private ISorterCompParaPoolWorkflow ReproStep(int seed) { var randy = Rando.Fast(seed); var sorterLayer = SorterLayer.ReproducePreserveParents(seed: randy.NextInt(), newGenomeCount: SorterCompParaPoolParams.ChildCount, mutationRate: SorterCompParaPoolParams.SorterMutationRate, insertionRate: SorterCompParaPoolParams.SorterMutationRate, deletionRate: SorterCompParaPoolParams.SorterDeletionRate); var switchableGroupLayer = SwitchableGroupLayer.Reproduce(seed: randy.NextInt(), newGenomeCount: SorterCompParaPoolParams.SwitchableLayerExpandedGenomeCount, mutationRate: SorterCompParaPoolParams.SwitchableLayerExpandedGenomeCount, insertionRate: SorterCompParaPoolParams.SwitchableGroupInsertionRate, deletionRate: SorterCompParaPoolParams.SwitchableGroupDeletionRate); return(new SorterCompParaPoolWorkflowImpl ( compWorkflowState: CompWorkflowState.RunCompetition, sorterLayer: sorterLayer, switchableGroupLayer: switchableGroupLayer, compParaPool: null, sorterLayerEval: null, switchableGroupLayerEval: null, sorterCompParaPoolParams: SorterCompParaPoolParams, generation: Generation )); }