Пример #1
0
        public void TestCompParaPoolTable()
        {
            var compParaPool = TestData.Layers.CompParaPool;

            var compParaPoolScores =
                compParaPool.SorterOnSwitchableGroups.Select(
                    s =>
                    new Tuple <Guid, Guid, Tuple <bool, int> >(s.Sorter.Guid, s.SwitchableGroupGuid,
                                                               new Tuple <bool, int>(s.Success, s.SwitchUseCount)));

            var compParaPoolResults = compParaPoolScores.Select(
                s => new Tuple <ISorterGenome, ISwitchableGroupGenome, Tuple <bool, int> >
                (
                    TestData.Layers.SorterLayer().GetGenome(s.Item1),
                    TestData.Layers.SwitchableGroupLayer().GetGenome(s.Item2),
                    s.Item3
                ));

            var genomeTable = GenomeTable.Make(compParaPoolResults);

            System.Diagnostics.Debug.WriteLine(genomeTable.Print
                                               (
                                                   g => g.Guid.ToString(),
                                                   h => h.Guid.ToString(),
                                                   i => i.Item2.ToString())
                                               );
        }
        public void TrackItem(ISorterCompParaPoolWorkflow sorterCompParaPoolWorkflow)
        {
            //System.Diagnostics.Debug.WriteLine("tracking state: {0}", sorterCompParaPoolWorkflow.CompWorkflowState);
            switch (sorterCompParaPoolWorkflow.CompWorkflowState)
            {
            case CompWorkflowState.ReproGenomes:
                break;

            case CompWorkflowState.RunCompetition:
                break;

            case CompWorkflowState.EvaluateResults:
                break;

            case CompWorkflowState.UpdateGenomes:
                SorterPoolStats.AddGenomeEvals(
                    sorterCompParaPoolWorkflow.SorterLayerEval
                    .GenomeEvals
                    .OrderBy(t => t.Score),
                    SorterCompParaPoolWorkflowTracker.SorterRefScore
                    );
                SwitchablePoolStats.AddGenomeEvals(
                    sorterCompParaPoolWorkflow.SwitchableGroupLayerEval
                    .GenomeEvals
                    .OrderBy(t => t.Score),
                    SorterCompParaPoolWorkflowTracker.SwitchableGroupRefScore
                    );


                var compParaPool = sorterCompParaPoolWorkflow.CompParaPool;

                var compParaPoolScores =
                    compParaPool.SorterOnSwitchableGroups
                    .Where(
                        g => SorterPoolStats.GenomeStatses.Any(ps => ps.Guid == g.Sorter.Guid)
                        &&
                        SwitchablePoolStats.GenomeStatses.Any(ps => ps.Guid == g.SwitchableGroupGuid)
                        )
                    .Select(
                        s =>
                        new Tuple <Guid, Guid, Tuple <bool, int> >(s.Sorter.Guid, s.SwitchableGroupGuid,
                                                                   new Tuple <bool, int>(s.Success, s.SwitchUseCount)));

                var compParaPoolResults = compParaPoolScores.Select(
                    s => new Tuple <IGenomeStats <ISorterGenome>, IGenomeStats <ISwitchableGroupGenome>, Tuple <bool, int> >
                    (
                        SorterPoolStats.GenomeStatses.Single(g => g.Guid == s.Item1),
                        SwitchablePoolStats.GenomeStatses.Single(g => g.Guid == s.Item2),
                        s.Item3
                    ));

                var genomeTable = GenomeTable.Make(compParaPoolResults);

                _poolReport = genomeTable.Print
                              (
                    g => g.FirstGeneration.ToString() + "_" + g.ReferenceResult.Cast <ISorterEval>().SwitchUseCount,
                    h => h.FirstGeneration.ToString() + "_",
                    i => i.Item2.ToString()
                              );

                break;

            default:
                break;
            }
        }