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

            TestHelperRiverSystem.getAPreconfiguredTestScenarioWithAWBM(3, out testProject,
                                                                        out testScenario);
            var testModel        = new AWBM( );
            var accessorInfoList = MetaParameterSet.KnownParameters(testModel);
            var metaParameterSet = new MetaParameterSet(testScenario);

            Assert.AreEqual(accessorInfoList.Count, metaParameterSet.AvailableParameters.Count);
        }
コード例 #2
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);
        }
コード例 #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 );
        }