Example #1
0
        /// <summary>
        /// Gets the stochastic model DEV parameters.
        /// </summary>
        /// <param name="baseModel">A base model.</param>
        /// <returns>
        /// A dictionary of DEV parameters and their tolerance value.
        /// </returns>
        public Dictionary <Parameter, ParameterRandomness> GetStochasticModelDevParameters(Model baseModel)
        {
            if (ModelsWithDev.ContainsKey(baseModel))
            {
                return(ModelsWithDev[baseModel]);
            }

            return(null);
        }
Example #2
0
        /// <summary>
        /// Registers that a model has a dev parameter.
        /// </summary>
        /// <param name="model">A model.</param>
        /// <param name="generator">A model generator.</param>
        /// <param name="parameter">A parameter.</param>
        /// <param name="tolerance">A tolerance (value of dev).</param>
        /// <param name="distributionName">Distribution name.</param>
        public void RegisterModelDev(
            Model model,
            Func <string, Model> generator,
            Parameter parameter,
            Parameter tolerance,
            string distributionName)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            if (generator == null)
            {
                throw new ArgumentNullException(nameof(generator));
            }

            if (parameter == null)
            {
                throw new ArgumentNullException(nameof(parameter));
            }

            if (tolerance == null)
            {
                throw new ArgumentNullException(nameof(tolerance));
            }

            if (!ModelsWithDev.ContainsKey(model))
            {
                ModelsWithDev[model] = new Dictionary <Parameter, ParameterRandomness>();
            }

            ModelsWithDev[model][parameter] = new ParameterRandomness
            {
                RandomDistributionName = distributionName,
                Tolerance = tolerance,
            };

            if (!ModelsGenerators.ContainsKey(model))
            {
                ModelsGenerators[model] = generator;
            }
        }