protected virtual void AddMainTest( ITestsConfig testsConfig, IScenario scenario, List <ParallelOptimizationTest> tests) { var testFactory = testsConfig.CreateTestFactory(scenario, testsConfig.NumSimulations, testsConfig.NumSamples); this.mainTest.OptimizationTestFactory = testFactory; tests.Add(this.mainTest); }
protected virtual void AddFinalTest( ITestsConfig testsConfig, IScenario scenario, List <ParallelOptimizationTest> tests) { if (this.finalTest == null) { return; } var testFactory = testsConfig.CreateTestFactory( scenario, testsConfig.NumSimulations, testsConfig.NumTimeSteps); this.finalTest.OptimizationTestFactory = testFactory; tests.Add(this.finalTest); }
protected override void AddMainTest(ITestsConfig testsConfig, IScenario scenario, List <ParallelOptimizationTest> tests) { base.AddMainTest(testsConfig, scenario, tests); if (!(testsConfig is IGPTestsConfig)) { return; } //adds a select best test var multipleTestFactory = testsConfig.CreateTestFactory(scenario, this._numSelectBestSimulations, testsConfig.NumSamples); tests.Add(new SelectBestFitnessTest(multipleTestFactory, ((IGPTestsConfig)testsConfig).StdDevTimes)); }
protected virtual void AddTopTests( ITestsConfig testsConfig, IScenario scenario, List <ParallelOptimizationTest> tests) { if (this.topTestsScheme == null) { return; } for (var i = 0; i < this.topTestsScheme.Count; i++) { var topTestScheme = this.topTestsScheme[i]; //in last test always make 1 sample-per-step var testFactory = testsConfig.CreateTestFactory( scenario, topTestScheme.NumSimulations, i == this.topTestsScheme.Count - 1 ? testsConfig.NumTimeSteps : testsConfig.NumSamples); tests.Add(new SelectTopFitnessTest(testFactory, topTestScheme.NumTests, true)); } }
private static List <ITestsConfig> GetTestsConfig(ITestsConfig baseTestsConfig, uint testType) { //gets all test parameters for the type of test var testParamsSet = new HashSet <ITestParameters>(GetTestParameters(baseTestsConfig, testType)); //removes possible unnecessary test parameters baseTestsConfig = baseTestsConfig.CloneJson(); baseTestsConfig.Init(); var testProfile = baseTestsConfig.ScenarioProfiles[testType]; if (File.Exists(testProfile.TestMeasuresFilePath)) { var testFactory = baseTestsConfig.CreateTestFactory(testProfile); var testMeasures = testFactory.CreateTestMeasureList(); testMeasures.ReadFromFile(testProfile.TestMeasuresFilePath); testParamsSet.RemoveWhere(testMeasures.Contains); } //adds a new config for each specific test params return(testParamsSet.Select(testParameters => CreateNewTestsConfig(baseTestsConfig, testType, testParameters)).ToList()); }