コード例 #1
0
        public void Execute( )
        {
            RiverSystemScenario testScenario;
            RiverSystemProject  testProject;

            TestHelperRiverSystem.getAPreconfiguredTestScenarioWithAWBM(3, out testProject,
                                                                        out testScenario);

            IObjectiveEvaluator <MetaParameterSet> evaluator        = buildNewEvaluator(testScenario);
            ICandidateFactory <MetaParameterSet>   candidateFactory = new LumpedAWBMFactory(testScenario, new BasicRngFactory(123));

            int pSetNumber = 5;

            IObjectiveScores[]     scores = new IObjectiveScores[pSetNumber];
            ISystemConfiguration[] pSets  = new ISystemConfiguration[pSetNumber];


            int k = 0;

            foreach (Catchment c in testScenario.Network.catchmentList)
            {
                foreach (StandardFunctionalUnit fu in c.FunctionalUnits)
                {
                    var list = AccessorMemberInfo.GetFieldsAndPropertiesList(fu.rainfallRunoffModel.GetType(), typeof(double), typeof(ParameterAttribute));
                    foreach (MemberInfo m in list)
                    {
                        string metaParameterName = "$tag" + k++;
                        UpdateFunctionBuilder.CreateMetaParameter(testScenario, metaParameterName);
                        UpdateFunctionBuilder.CreateUpdateFunctionWithLinkToMetaParameter(testScenario, metaParameterName, m, fu.rainfallRunoffModel);
                    }
                }
            }

            for (int i = 0; i < scores.Length; i++)
            {
                pSets[i] = candidateFactory.CreateRandomCandidate();

                //Do we need to reset the model states??
                scores[i] = evaluator.EvaluateScore((MetaParameterSet)pSets[i]);

                //print Params after each iteration
                LumpedAWBMFactory.printPrams(testScenario, pSets[i]);
            }
            IObjectiveScores[] paretoScores = ParetoRanking <IObjectiveScores> .GetParetoFront(scores);


            SourceUtility.PrintObjScores(scores);
            Console.WriteLine("----------------------------------------");
            SourceUtility.PrintObjScores(paretoScores);
        }
コード例 #2
0
        public void Execute(string modelRunDefnFile, string modelOutputName, string runoffToMatchFile)
        {
            setRandSeed( );
            var evaluator        = ProblemDefinitionHelper.BuildEvaluator(modelRunDefnFile, modelOutputName, runoffToMatchFile);
            var candidateFactory = buildCandidateFactory(ProblemDefinitionHelper.BuildSystem(modelRunDefnFile, "runoff").Model);

            var scores = new IObjectiveScores[1000];
            var pSets  = new ICloneableSystemConfiguration[1000];

            for (int i = 0; i < scores.Length; i++)
            {
                pSets[i]  = candidateFactory.CreateRandomCandidate( );
                scores[i] = evaluator.EvaluateScore(pSets[i]);
            }
            IObjectiveScores[] paretoScores = ParetoRanking <IObjectiveScores> .GetParetoFront(scores);

            printSummary(scores);
            Console.ReadLine( );
        }
コード例 #3
0
        public void Execute( )
        {
            RiverSystemScenario testScenario;
            RiverSystemProject testProject;
            TestHelperRiverSystem.getAPreconfiguredTestScenarioWithAWBM( 3, out testProject,
                                                                         out testScenario );
            
            IObjectiveEvaluator<MetaParameterSet> evaluator = buildNewEvaluator( testScenario );
            //ICandidateFactory<MetaParameterSet> candidateFactory = new LumpedAWBMFactory( testScenario, new BasicRngFactory(123) );

            var evolutionEngine = new CSIRO.Metaheuristics.Optimization.ShuffledComplexEvolution<MetaParameterSet>( );

            
            IObjectiveScores[] paretoScores = ParetoRanking<IObjectiveScores>.GetParetoFront( scores );
           

            SourceUtility.PrintObjScores( scores );
            Console.WriteLine("----------------------------------------");
            SourceUtility.PrintObjScores( paretoScores );
        }