public override void GlobalContext() { base.GlobalContext(); _optimizedParameterValue1 = new OptimizedParameterValue("P1", 10, 11, 5, 100, Scalings.Log); _optimizedParameterValue2 = new OptimizedParameterValue("P2", 20, 211, 5, 100, Scalings.Linear); _parameterIdentificationRunResult = new ParameterIdentificationRunResult(); _residualResults = new ResidualsResult(); _bestRunResult = new OptimizationRunResult { ResidualsResult = _residualResults }; _parameterIdentificationRunResult.BestResult = _bestRunResult; _parameterIdentificationRunResult.Duration = new TimeSpan(1, 2, 3, 4); _observedData1 = DomainHelperForSpecs.ObservedData("OBS1"); _observedData2 = DomainHelperForSpecs.ObservedData("OBS2"); _residualResults.AddOutputResiduals("OutputPath1", _observedData1, new[] { new Residual(1f, 2f, 1), new Residual(2f, 3f, 2) }); _residualResults.AddOutputResiduals("OutputPath2", _observedData2, new[] { new Residual(3f, 4f, 4) }); _bestRunResult.AddValue(_optimizedParameterValue1); _bestRunResult.AddValue(_optimizedParameterValue2); _bestRunResult.AddResult(DomainHelperForSpecs.IndividualSimulationDataRepositoryFor("S1")); _bestRunResult.AddResult(DomainHelperForSpecs.IndividualSimulationDataRepositoryFor("S2")); var workspace = IoC.Resolve <ICoreWorkspace>(); var project = IoC.Resolve <PKSimProject>(); workspace.Project = project; project.AddObservedData(_observedData1); project.AddObservedData(_observedData2); _deserializedParameterIdentificationRunResult = SerializeAndDeserialize(_parameterIdentificationRunResult); }
protected override void Context() { base.Context(); _optimizationRunResult = new OptimizationRunResult(); _runResult.BestResult = _optimizationRunResult; _optimizationRunResult.AddValue(new OptimizedParameterValue("P1", _identificationParameter1.MinValueParameter.Value * 1.005, 1)); _optimizationRunResult.AddValue(new OptimizedParameterValue("P2", _identificationParameter2.MaxValueParameter.Value * 0.995, 4)); }
protected override void Context() { base.Context(); _bestResult = new OptimizationRunResult(); _bestResult.AddValue(new OptimizedParameterValue("P1", 1, 1, 0, 10, Scalings.Linear)); _bestResult.AddValue(new OptimizedParameterValue("P2", 2, 2, 0, 10, Scalings.Linear)); _currentResult = new OptimizationRunResult(); _currentResult.AddValue(new OptimizedParameterValue("P1", 3, 4, 0, 10, Scalings.Linear)); _currentResult.AddValue(new OptimizedParameterValue("P2", 4, 4, 0, 10, Scalings.Linear)); _runState = A.Fake <ParameterIdentificationRunState>(); A.CallTo(() => _runState.Status).Returns(RunStatus.Running); A.CallTo(() => _runState.BestResult).Returns(_bestResult); A.CallTo(() => _runState.CurrentResult).Returns(_currentResult); }
protected override void Context() { _rangeImageCreator = A.Fake <IOptimizedParameterRangeImageCreator>(); sut = new ParameterIdentificationRunResultToRunResultDTOMapper(_rangeImageCreator); _parameterIdentification = new ParameterIdentification(); _runResult = A.Fake <ParameterIdentificationRunResult>().WithDescription("Desc"); _runResult.Index = 5; _optimizationRunResult = new OptimizationRunResult(); _runResult.BestResult = _optimizationRunResult; A.CallTo(() => _runResult.NumberOfEvaluations).Returns(10); A.CallTo(() => _runResult.TotalError).Returns(5); _identificationParameter1 = new IdentificationParameter().WithName("P1"); _identificationParameter1.Add(parameterNamed(1, Constants.Parameters.MIN_VALUE)); _identificationParameter1.Add(parameterNamed(2, Constants.Parameters.START_VALUE)); _identificationParameter1.Add(parameterNamed(3, Constants.Parameters.MAX_VALUE)); _identificationParameter2 = new IdentificationParameter().WithName("P2"); _identificationParameter2.Add(parameterNamed(4, Constants.Parameters.MIN_VALUE)); _identificationParameter2.Add(parameterNamed(5, Constants.Parameters.START_VALUE)); _identificationParameter2.Add(parameterNamed(6, Constants.Parameters.MAX_VALUE)); _identificationParameter3 = new IdentificationParameter().WithName("P3"); _identificationParameter3.Add(parameterNamed(7, Constants.Parameters.MIN_VALUE)); _identificationParameter3.Add(parameterNamed(8, Constants.Parameters.START_VALUE)); _identificationParameter3.Add(parameterNamed(9, Constants.Parameters.MAX_VALUE)); _identificationParameter3.IsFixed = true; _parameterIdentification.AddIdentificationParameter(_identificationParameter1); _parameterIdentification.AddIdentificationParameter(_identificationParameter2); _parameterIdentification.AddIdentificationParameter(_identificationParameter3); _optimizedParameterValue1 = new OptimizedParameterValue("P1", 2.5, 2.1); _optimizationRunResult.AddValue(_optimizedParameterValue1); _optimizedParameterValue2 = new OptimizedParameterValue("P2", 5.5, 5.2); _optimizationRunResult.AddValue(_optimizedParameterValue2); //does not exist in PI anymore _optimizationRunResult.AddValue(new OptimizedParameterValue("P DOES NOT EXIST", 50, 60)); A.CallTo(_rangeImageCreator).WithReturnType <Image>().Returns(ApplicationIcons.OK); }