Example #1
0
        public void ConstantTest()
        {
            var in1 = new ModelInput("in1")
            {
                Distribution = Distribution.InitGaussian(10, 0.31)
            };
            var op1 = new ModelFormula("op1")
            {
                Formula = "in1 * 3"
            };

            var model = new Model();

            model.Add(in1, op1);
            model.Solve();

            Utils.AssertIsInRange(op1.Output.GetMean(), 30, 0.5);
        }
Example #2
0
        public static void Main(string[] args)
        {
            var in1 = new ModelInput("in1")
            {
                Distribution = Distribution.InitGaussian(10, 0.31)
            };
            var in2 = new ModelInput("in2")
            {
                Distribution = Distribution.InitGaussian(3, 0.31)
            };
            var in3 = new ModelInput("in3")
            {
                Distribution = Distribution.InitGaussian(5, 0.61)
            };
            var in4 = new ModelInput("c")
            {
                Distribution = Distribution.InitConstant(10)
            };
            var op1 = new ModelFormula("op1")
            {
                Formula = "in1 * in2"
            };
            var op2 = new ModelFormula("op2")
            {
                Formula = "op1 * in3 * c"
            };

            var model = new Model();

            model.Add(in1, in2, op1, in3, in4, op2);
            model.Solve();


            Console.WriteLine("Result: mean: {0} stddev: {1}", op2.Output.GetMean(), op2.Output.GetStdDeviation());
            Console.WriteLine("Result histogram:");
            PrintDistroChart(op2.Output.RawItems);
        }