public static ICompPool TrimEvalsToTheseIds(this ICompPool compPool, IEnumerable <Guid> sorterIds) { var idDict = sorterIds.ToDictionary(id => id); return(new CompPoolImpl( sorterEvals: compPool.SorterEvals.Where(ev => idDict.ContainsKey(ev.Sorter.Guid)), keyCount: compPool.KeyCount )); }
//public static ICompPool ToCompPoolParallel( // this IEnumerable<ISorter> sorters //) //{ // var sortersList = sorters.ToList(); // var keyCount = sortersList[0].KeyCount; // KeyPairSwitchSet.Make<uint>(keyCount); // var switchables = Switchable.AllSwitchablesForKeyCount(keyCount).ToSwitchableGroup // ( // guid: SwitchableGroup.GuidOfAllSwitchableGroupsForKeyCount(keyCount), // keyCount: keyCount // ); // return new CompPoolImpl( // sorterEvals: sortersList.AsParallel().Select(s => s.Sort(switchables)), // keyCount: keyCount // ); //} public static ICompPool AddSorterEvalsParallel(this ICompPool compPool, IEnumerable <ISorter> sorters) { KeyPairSwitchSet.Make <uint>(compPool.KeyCount); var switchables = Switchable.AllSwitchablesForKeyCount(compPool.KeyCount).ToSwitchableGroup ( guid: SwitchableGroup.GuidOfAllSwitchableGroupsForKeyCount(compPool.KeyCount), keyCount: compPool.KeyCount ); return(new CompPoolImpl( sorterEvals: compPool.SorterEvals.Concat(sorters.AsParallel().Select(s => s.Sort(switchables))), keyCount: compPool.KeyCount )); }
private ScpWorkflowImpl ( CompWorkflowState compWorkflowState, ILayer <ISorterGenome> sorterLayer0, ILayer <ISorterGenome> sorterLayer1, ICompPool compPool, ILayerEval <ISorterGenome, IGenomeEval <ISorterGenome> > sorterLayerEval, IScpParams scpParams, int generation, string report ) { _compWorkflowState = compWorkflowState; _sorterLayer0 = sorterLayer0; _sorterLayerEval = sorterLayerEval; _scpParams = scpParams; _generation = generation; _report = report; _sorterLayer1 = sorterLayer1; _compPool = compPool; }