예제 #1
0
 protected override void Context()
 {
     base.Context();
     _distributionMetaData = new DistributionMetaData {
         Deviation = 2, Distribution = DistributionTypes.Normal, Mean = 5
     };
     _result = DistributionMetaData.From(_distributionMetaData);
 }
예제 #2
0
 public static DistributionMetaData From(IDistributionMetaData distributionMetaData)
 {
     return(new DistributionMetaData
     {
         Mean = distributionMetaData.Mean,
         Deviation = distributionMetaData.Deviation,
         Distribution = distributionMetaData.Distribution
     });
 }
예제 #3
0
 public IDistributionFormula CreateFor(IDistributionMetaData distribution, IDistributedParameter parameter)
 {
     foreach (var factory in _allDistributionFactory)
     {
         if (factory.IsSatisfiedBy(distribution))
         {
             return(factory.CreateFor(distribution, parameter));
         }
     }
     throw new DistributionNotFoundException(distribution);
 }
예제 #4
0
        public IDistributionFormula CreateFor(IDistributionMetaData distribution, IDistributedParameter parameter)
        {
            var minParameter         = parameter.Parameter(Constants.Distribution.MINIMUM);
            var maxParameter         = parameter.Parameter(Constants.Distribution.MAXIMUM);
            var distributionMetaData = distribution as ParameterDistributionMetaData;

            if (distributionMetaData != null)
            {
                minParameter.Value = distributionMetaData.MinValue.Value;
                maxParameter.Value = distributionMetaData.MaxValue.Value;
            }
            return(_distributionFormulaFactory.CreateUniformDistributionFormulaFor(parameter, minParameter, maxParameter));
        }
예제 #5
0
        public IDistribution MapFrom(IDistributionMetaData distributionMetaData)
        {
            if (distributionMetaData.Distribution == DistributionTypes.Normal)
            {
                return(new NormalDistribution(distributionMetaData.Mean, distributionMetaData.Deviation));
            }

            if (distributionMetaData.Distribution == DistributionTypes.LogNormal)
            {
                return(new LogNormalDistribution(Math.Log(distributionMetaData.Mean), distributionMetaData.Deviation));
            }

            if (distributionMetaData.Distribution == DistributionTypes.Discrete)
            {
                return(new NormalDistribution(distributionMetaData.Mean, 0));
            }

            throw new ArgumentException(string.Format("Cannot create distribution for meta data '{0}'", distributionMetaData.Distribution), "distributionMetaData");
        }
 public bool IsSatisfiedBy(IDistributionMetaData distribution)
 {
     return(distribution.Distribution == DistributionTypes.Uniform);
 }
 public IDistributionFormula CreateFor(IDistributionMetaData distribution, IDistributedParameter parameter)
 {
     return(_objectBaseFactory.Create <UnknownDistributionFormula>());
 }
예제 #8
0
 public DistributionNotFoundException(IDistributionMetaData distributionMetaData) :
     base(PKSimConstants.Error.DistributionUnknown(distributionMetaData.Distribution.Id))
 {
 }
예제 #9
0
 public bool IsSatisfiedBy(IDistributionMetaData distribution) => distribution.Distribution == DistributionTypes.LogNormal;
예제 #10
0
 public IDistributionFormula CreateFor(IDistributionMetaData distribution, IDistributedParameter parameter)
 {
     parameter.MeanParameter.Value      = distribution.Mean;
     parameter.DeviationParameter.Value = distribution.Deviation;
     return(_distributionFormulaFactory.CreateLogNormalDistributionFormulaFor(parameter, parameter.MeanParameter, parameter.DeviationParameter));
 }
 public bool IsSatisfiedBy(IDistributionMetaData distribution) => distribution.Distribution == DistributionTypes.Discrete;
예제 #12
0
 protected override void Context()
 {
     sut = new DistributionMetaDataToDistributionMapper();
     _distributionMetaData = new DistributionMetaData();
 }
 public void UpdateFrom(IDistributionMetaData distributionMetaData)
 {
     Mean         = distributionMetaData.Mean;
     Deviation    = distributionMetaData.Deviation;
     Distribution = distributionMetaData.Distribution;
 }