Beispiel #1
0
 public Task <IHM3BOutputContext> Solve(
     IAbstractFactory abstractFactory,
     IHM3BConfiguration HM3BConfiguration,
     IHM3BInputContext HM3BInputContext,
     ISolverConfiguration solverConfiguration,
     HM3BEncodingEnum HM3BEncodingEnum)
 {
     return(abstractFactory.CreateSolutionsAbstractFactory().CreateHM3BSolutionFactory().Create().Solve(
                abstractFactory.CreateCalculationsAbstractFactory(),
                abstractFactory.CreateConstraintElementsAbstractFactory(),
                abstractFactory.CreateConstraintsAbstractFactory(),
                abstractFactory.CreateContextsAbstractFactory(),
                abstractFactory.CreateCrossJoinElementsAbstractFactory(),
                abstractFactory.CreateCrossJoinsAbstractFactory(),
                abstractFactory.CreateDependenciesAbstractFactory(),
                abstractFactory.CreateIndexElementsAbstractFactory(),
                abstractFactory.CreateIndicesAbstractFactory(),
                abstractFactory.CreateModelsAbstractFactory(),
                abstractFactory.CreateObjectiveFunctionsAbstractFactory(),
                abstractFactory.CreateParameterElementsAbstractFactory(),
                abstractFactory.CreateParametersAbstractFactory(),
                abstractFactory.CreateResultElementsAbstractFactory(),
                abstractFactory.CreateResultsAbstractFactory(),
                abstractFactory.CreateVariablesAbstractFactory(),
                HM3BConfiguration,
                HM3BInputContext,
                solverConfiguration,
                HM3BEncodingEnum));
 }
Beispiel #2
0
        public IHM3BOutputContext Create(
            ICalculationsAbstractFactory calculationsAbstractFactory,
            IDependenciesAbstractFactory dependenciesAbstractFactory,
            IResultElementsAbstractFactory resultElementsAbstractFactory,
            IResultsAbstractFactory resultsAbstractFactory,
            IHM3BModel HM3BModel,
            Solution solution,
            HM3BEncodingEnum HM3BEncodingEnum)
        {
            IHM3BOutputContext context = null;

            try
            {
                context = new HM3BOutputContext(
                    calculationsAbstractFactory,
                    dependenciesAbstractFactory,
                    resultElementsAbstractFactory,
                    resultsAbstractFactory,
                    HM3BModel,
                    solution,
                    HM3BEncodingEnum);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(context);
        }
        public Task <IHM3BOutputContext> Solve(
            ICalculationsAbstractFactory calculationsAbstractFactory,
            IConstraintElementsAbstractFactory constraintElementsAbstractFactory,
            IConstraintsAbstractFactory constraintsAbstractFactory,
            IContextsAbstractFactory contextsAbstractFactory,
            ICrossJoinElementsAbstractFactory crossJoinElementsAbstractFactory,
            ICrossJoinsAbstractFactory crossJoinsAbstractFactory,
            IDependenciesAbstractFactory dependenciesAbstractFactory,
            IIndexElementsAbstractFactory indexElementsAbstractFactory,
            IIndicesAbstractFactory indicesAbstractFactory,
            IModelsAbstractFactory modelsAbstractFactory,
            IObjectiveFunctionsAbstractFactory objectiveFunctionsAbstractFactory,
            IParameterElementsAbstractFactory parameterElementsAbstractFactory,
            IParametersAbstractFactory parametersAbstractFactory,
            IResultElementsAbstractFactory resultElementsAbstractFactory,
            IResultsAbstractFactory resultsAbstractFactory,
            IVariablesAbstractFactory variablesAbstractFactory,
            IHM3BConfiguration HM3BConfiguration,
            IHM3BInputContext HM3BInputContext,
            ISolverConfiguration solverConfiguration,
            HM3BEncodingEnum HM3BEncodingEnum)
        {
            IHM3BOutputContext HM3BOutputContext = null;

            return(Task.Run(() =>
            {
                using (ModelScope modelScope = dependenciesAbstractFactory.CreateModelScopeFactory().Create(HM3BConfiguration.Value))
                {
                    IHM3BModel model = modelsAbstractFactory.CreateHM3BModelFactory().Create(
                        constraintElementsAbstractFactory,
                        constraintsAbstractFactory,
                        crossJoinElementsAbstractFactory,
                        crossJoinsAbstractFactory,
                        dependenciesAbstractFactory,
                        indexElementsAbstractFactory,
                        indicesAbstractFactory,
                        objectiveFunctionsAbstractFactory,
                        parameterElementsAbstractFactory,
                        parametersAbstractFactory,
                        variablesAbstractFactory,
                        HM3BInputContext,
                        HM3BEncodingEnum);

                    using (ISolver solver = dependenciesAbstractFactory.CreateSolverFactory().Create(solverConfiguration))
                    {
                        Solution solution = solver?.Solve(model?.Model);

                        if (solution.ModelStatus == OPTANO.Modeling.Optimization.Solver.ModelStatus.Feasible)
                        {
                            model.Model.VariableCollections.ForEach(vc => vc.SetVariableValues(solution.VariableValues));

                            HM3BOutputContext = contextsAbstractFactory.CreateHM3BOutputContextFactory().Create(
                                calculationsAbstractFactory,
                                dependenciesAbstractFactory,
                                resultElementsAbstractFactory,
                                resultsAbstractFactory,
                                model,
                                solution,
                                HM3BEncodingEnum);
                        }
                    }
                }

                return HM3BOutputContext;
            }));
        }
        public IHM3BModel Create(
            IConstraintElementsAbstractFactory constraintElementsAbstractFactory,
            IConstraintsAbstractFactory constraintsAbstractFactory,
            ICrossJoinElementsAbstractFactory crossJoinElementsAbstractFactory,
            ICrossJoinsAbstractFactory crossJoinsAbstractFactory,
            IDependenciesAbstractFactory dependenciesAbstractFactory,
            IIndexElementsAbstractFactory indexElementsAbstractFactory,
            IIndicesAbstractFactory indicesAbstractFactory,
            IObjectiveFunctionsAbstractFactory objectiveFunctionsAbstractFactory,
            IParameterElementsAbstractFactory parameterElementsAbstractFactory,
            IParametersAbstractFactory parametersAbstractFactory,
            IVariablesAbstractFactory variablesAbstractFactory,
            IHM3BInputContext HM3BInputContext,
            HM3BEncodingEnum HM3BEncodingEnum)
        {
            IHM3BModel model = null;

            try
            {
                model = HM3BEncodingEnum switch
                {
                    HM3BEncodingEnum.E000 => new HM3B000Model(
                        constraintElementsAbstractFactory,
                        constraintsAbstractFactory,
                        crossJoinElementsAbstractFactory,
                        crossJoinsAbstractFactory,
                        dependenciesAbstractFactory,
                        indexElementsAbstractFactory,
                        indicesAbstractFactory,
                        objectiveFunctionsAbstractFactory,
                        parameterElementsAbstractFactory,
                        parametersAbstractFactory,
                        variablesAbstractFactory,
                        HM3BInputContext),

                    HM3BEncodingEnum.E001 => new HM3B001Model(
                        constraintElementsAbstractFactory,
                        constraintsAbstractFactory,
                        crossJoinElementsAbstractFactory,
                        crossJoinsAbstractFactory,
                        dependenciesAbstractFactory,
                        indexElementsAbstractFactory,
                        indicesAbstractFactory,
                        objectiveFunctionsAbstractFactory,
                        parameterElementsAbstractFactory,
                        parametersAbstractFactory,
                        variablesAbstractFactory,
                        HM3BInputContext),

                    HM3BEncodingEnum.E010 => new HM3B010Model(
                        constraintElementsAbstractFactory,
                        constraintsAbstractFactory,
                        crossJoinElementsAbstractFactory,
                        crossJoinsAbstractFactory,
                        dependenciesAbstractFactory,
                        indexElementsAbstractFactory,
                        indicesAbstractFactory,
                        objectiveFunctionsAbstractFactory,
                        parameterElementsAbstractFactory,
                        parametersAbstractFactory,
                        variablesAbstractFactory,
                        HM3BInputContext),

                    HM3BEncodingEnum.E011 => new HM3B011Model(
                        constraintElementsAbstractFactory,
                        constraintsAbstractFactory,
                        crossJoinElementsAbstractFactory,
                        crossJoinsAbstractFactory,
                        dependenciesAbstractFactory,
                        indexElementsAbstractFactory,
                        indicesAbstractFactory,
                        objectiveFunctionsAbstractFactory,
                        parameterElementsAbstractFactory,
                        parametersAbstractFactory,
                        variablesAbstractFactory,
                        HM3BInputContext),

                    HM3BEncodingEnum.E100 => new HM3B100Model(
                        constraintElementsAbstractFactory,
                        constraintsAbstractFactory,
                        crossJoinElementsAbstractFactory,
                        crossJoinsAbstractFactory,
                        dependenciesAbstractFactory,
                        indexElementsAbstractFactory,
                        indicesAbstractFactory,
                        objectiveFunctionsAbstractFactory,
                        parameterElementsAbstractFactory,
                        parametersAbstractFactory,
                        variablesAbstractFactory,
                        HM3BInputContext),

                    HM3BEncodingEnum.E101 => new HM3B101Model(
                        constraintElementsAbstractFactory,
                        constraintsAbstractFactory,
                        crossJoinElementsAbstractFactory,
                        crossJoinsAbstractFactory,
                        dependenciesAbstractFactory,
                        indexElementsAbstractFactory,
                        indicesAbstractFactory,
                        objectiveFunctionsAbstractFactory,
                        parameterElementsAbstractFactory,
                        parametersAbstractFactory,
                        variablesAbstractFactory,
                        HM3BInputContext),

                    HM3BEncodingEnum.E110 => new HM3B110Model(
                        constraintElementsAbstractFactory,
                        constraintsAbstractFactory,
                        crossJoinElementsAbstractFactory,
                        crossJoinsAbstractFactory,
                        dependenciesAbstractFactory,
                        indexElementsAbstractFactory,
                        indicesAbstractFactory,
                        objectiveFunctionsAbstractFactory,
                        parameterElementsAbstractFactory,
                        parametersAbstractFactory,
                        variablesAbstractFactory,
                        HM3BInputContext),

                    HM3BEncodingEnum.E111 => new HM3B111Model(
                        constraintElementsAbstractFactory,
                        constraintsAbstractFactory,
                        crossJoinElementsAbstractFactory,
                        crossJoinsAbstractFactory,
                        dependenciesAbstractFactory,
                        indexElementsAbstractFactory,
                        indicesAbstractFactory,
                        objectiveFunctionsAbstractFactory,
                        parameterElementsAbstractFactory,
                        parametersAbstractFactory,
                        variablesAbstractFactory,
                        HM3BInputContext),

                    { } => throw new ArgumentException(nameof(HM3BEncodingEnum)),
                };
        public HM3BOutputContext(
            ICalculationsAbstractFactory calculationsAbstractFactory,
            IDependenciesAbstractFactory dependenciesAbstractFactory,
            IResultElementsAbstractFactory resultElementsAbstractFactory,
            IResultsAbstractFactory resultsAbstractFactory,
            IHM3BModel HM3BModel,
            Solution solution,
            HM3BEncodingEnum HM3BEncodingEnum)
        {
            // BestBound
            this.BestBound = resultsAbstractFactory.CreateBestBoundFactory().Create(
                (decimal)solution.BestBound)
                             .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // Gap
            this.Gap = resultsAbstractFactory.CreateGapFactory().Create(
                (decimal)solution.Gap)
                       .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // NumberOfExploredNodes
            this.NumberOfExploredNodes = resultsAbstractFactory.CreateNumberOfExploredNodesFactory().Create(
                solution.NumberOfExploredNodes)
                                         .GetValueForOutputContext();

            // ObjectiveValue
            this.ObjectiveValue = resultsAbstractFactory.CreateObjectiveValueFactory().Create(
                (decimal)solution.ObjectiveValues.SingleOrDefault().Value)
                                  .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // OverallWallTime
            this.OverallWallTime = resultsAbstractFactory.CreateOverallWallTimeFactory().Create(
                solution.OverallWallTime)
                                   .GetValueForOutputContext();

            // x(s, r, t)
            Ix x = HM3BModel.x.GetElementsAt(
                resultElementsAbstractFactory.CreatexResultElementFactory(),
                resultsAbstractFactory.CreatexFactory(),
                HM3BModel.srt);

            this.SurgeonOperatingRoomDayAssignments = x
                                                      .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // SurgeonNumberAssignedOperatingRooms
            this.SurgeonNumberAssignedOperatingRooms = calculationsAbstractFactory.CreateSurgeonNumberAssignedOperatingRoomsCalculationFactory().Create().Calculate(
                resultElementsAbstractFactory.CreateSurgeonNumberAssignedOperatingRoomsResultElementFactory(),
                resultsAbstractFactory.CreateSurgeonNumberAssignedOperatingRoomsFactory(),
                calculationsAbstractFactory.CreateSurgeonNumberAssignedOperatingRoomsResultElementCalculationFactory().Create(),
                HM3BModel.s,
                x)
                                                       .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // SurgeonNumberAssignedWeekdays
            this.SurgeonNumberAssignedWeekdays = calculationsAbstractFactory.CreateSurgeonNumberAssignedWeekdaysCalculationFactory().Create().Calculate(
                resultElementsAbstractFactory.CreateSurgeonNumberAssignedWeekdaysResultElementFactory(),
                resultsAbstractFactory.CreateSurgeonNumberAssignedWeekdaysFactory(),
                calculationsAbstractFactory.CreateSurgeonNumberAssignedWeekdaysResultElementCalculationFactory().Create(),
                HM3BModel.s,
                x)
                                                 .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // SurgeonScenarioNumberPatients
            ISurgeonScenarioNumberPatients surgeonScenarioNumberPatients = calculationsAbstractFactory.CreateSurgeonScenarioNumberPatientsCalculationFactory().Create().Calculate(
                resultElementsAbstractFactory.CreateSurgeonScenarioNumberPatientsResultElementFactory(),
                resultsAbstractFactory.CreateSurgeonScenarioNumberPatientsFactory(),
                calculationsAbstractFactory.CreateSurgeonScenarioNumberPatientsResultElementCalculationFactory().Create(),
                HM3BModel.rt,
                HM3BModel.sΛ,
                HM3BModel.n,
                x);

            this.SurgeonScenarioNumberPatients = surgeonScenarioNumberPatients.GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // SurgicalSpecialtyNumberAssignedOperatingRooms
            this.SurgicalSpecialtyNumberAssignedOperatingRooms = calculationsAbstractFactory.CreateSurgicalSpecialtyNumberAssignedOperatingRoomsCalculationFactory().Create().Calculate(
                resultElementsAbstractFactory.CreateSurgicalSpecialtyNumberAssignedOperatingRoomsResultElementFactory(),
                resultsAbstractFactory.CreateSurgicalSpecialtyNumberAssignedOperatingRoomsFactory(),
                calculationsAbstractFactory.CreateSurgicalSpecialtyNumberAssignedOperatingRoomsResultElementCalculationFactory().Create(),
                HM3BModel.Δ,
                x)
                                                                 .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // SurgicalSpecialtyNumberAssignedWeekdays
            this.SurgicalSpecialtyNumberAssignedWeekdays = calculationsAbstractFactory.CreateSurgicalSpecialtyNumberAssignedWeekdaysCalculationFactory().Create().Calculate(
                resultElementsAbstractFactory.CreateSurgicalSpecialtyNumberAssignedWeekdaysResultElementFactory(),
                resultsAbstractFactory.CreateSurgicalSpecialtyNumberAssignedWeekdaysFactory(),
                calculationsAbstractFactory.CreateSurgicalSpecialtyNumberAssignedWeekdaysResultElementCalculationFactory().Create(),
                HM3BModel.Δ,
                x)
                                                           .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // y(s, r)
            Iy y = HM3BEncodingEnum switch
            {
                HM3BEncodingEnum.E001 => ((IHM3B001Model)HM3BModel).y.GetElementsAt(
                    resultElementsAbstractFactory.CreateyResultElementFactory(),
                    resultsAbstractFactory.CreateyFactory(),
                    ((IHM3B001Model)HM3BModel).sr),

                HM3BEncodingEnum.E011 => ((IHM3B011Model)HM3BModel).y.GetElementsAt(
                    resultElementsAbstractFactory.CreateyResultElementFactory(),
                    resultsAbstractFactory.CreateyFactory(),
                    ((IHM3B011Model)HM3BModel).sr),

                HM3BEncodingEnum.E101 => ((IHM3B101Model)HM3BModel).y.GetElementsAt(
                    resultElementsAbstractFactory.CreateyResultElementFactory(),
                    resultsAbstractFactory.CreateyFactory(),
                    ((IHM3B101Model)HM3BModel).sr),

                HM3BEncodingEnum.E111 => ((IHM3B111Model)HM3BModel).y.GetElementsAt(
                    resultElementsAbstractFactory.CreateyResultElementFactory(),
                    resultsAbstractFactory.CreateyFactory(),
                    ((IHM3B111Model)HM3BModel).sr),

                _ => null
            };

            if (y != null)
            {
                this.SurgeonOperatingRoomAssignments = y
                                                       .GetValueForOutputContext(
                    dependenciesAbstractFactory.CreateNullableValueFactory());
            }

            // z(s, t)
            Iz z = HM3BModel.z.GetElementsAt(
                resultElementsAbstractFactory.CreatezResultElementFactory(),
                resultsAbstractFactory.CreatezFactory(),
                HM3BModel.st);

            this.SurgeonDayAssignments = z
                                         .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // β(s, r, d)
            this.SurgeonOperatingRoomDayNumberAssignedTimeBlocks = HM3BModel.β.GetElementsAt(
                resultElementsAbstractFactory.CreateβResultElementFactory(),
                resultsAbstractFactory.CreateβFactory(),
                HM3BModel.srd)
                                                                   .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // γ(r, t)
            this.OperatingRoomDayAssignedAvailabilities = HM3BModel.γ.GetElementsAt(
                resultElementsAbstractFactory.CreateγResultElementFactory(),
                resultsAbstractFactory.CreateγFactory(),
                HM3BModel.rt)
                                                          .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // ScenarioNumberPatients(Λ)
            this.ScenarioNumberPatients = calculationsAbstractFactory.CreateScenarioNumberPatientsCalculationFactory().Create()
                                          .Calculate(
                resultElementsAbstractFactory.CreateScenarioNumberPatientsResultElementFactory(),
                resultsAbstractFactory.CreateScenarioNumberPatientsFactory(),
                calculationsAbstractFactory.CreateScenarioNumberPatientsResultElementCalculationFactory().Create(),
                HM3BModel.Λ,
                surgeonScenarioNumberPatients)
                                          .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // ExpectedValueΦ(s, l, Λ)
            IExpectedValueΦ expectedValueΦ = calculationsAbstractFactory.CreateExpectedValueΦCalculationFactory().Create()
                                             .Calculate(
                resultElementsAbstractFactory.CreateExpectedValueΦResultElementFactory(),
                resultsAbstractFactory.CreateExpectedValueΦFactory(),
                calculationsAbstractFactory.CreateExpectedValueΦResultElementCalculationFactory().Create(),
                HM3BModel.l,
                HM3BModel.t,
                HM3BModel.slΛ,
                HM3BModel.L,
                HM3BModel.p,
                HM3BModel.μ);

            // VarianceΦ(s, l, Λ)
            IVarianceΦ varianceΦ = calculationsAbstractFactory.CreateVarianceΦCalculationFactory().Create()
                                   .Calculate(
                resultElementsAbstractFactory.CreateVarianceΦResultElementFactory(),
                resultsAbstractFactory.CreateVarianceΦFactory(),
                calculationsAbstractFactory.CreateVarianceΦResultElementCalculationFactory().Create(),
                HM3BModel.l,
                HM3BModel.t,
                HM3BModel.slΛ,
                HM3BModel.L,
                HM3BModel.p,
                HM3BModel.μ,
                HM3BModel.σ);

            // ExpectedValueI(t, Λ)
            Interfaces.Results.DayScenarioRecoveryWardUtilizations.IExpectedValueI expectedValueI = calculationsAbstractFactory.CreateExpectedValueICalculationFactory().Create()
                                                                                                    .Calculate(
                resultElementsAbstractFactory.CreateExpectedValueIResultElementFactory(),
                resultsAbstractFactory.CreateExpectedValueIFactory(),
                calculationsAbstractFactory.CreateExpectedValueIResultElementCalculationFactory().Create(),
                HM3BModel.l,
                HM3BModel.t,
                HM3BModel.st,
                HM3BModel.tΛ,
                expectedValueΦ,
                z);

            this.DayScenarioRecoveryWardUtilizationExpectedValues = expectedValueI
                                                                    .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // VarianceI(t, Λ)
            IVarianceI varianceI = calculationsAbstractFactory.CreateVarianceICalculationFactory().Create()
                                   .Calculate(
                resultElementsAbstractFactory.CreateVarianceIResultElementFactory(),
                resultsAbstractFactory.CreateVarianceIFactory(),
                calculationsAbstractFactory.CreateVarianceIResultElementCalculationFactory().Create(),
                HM3BModel.l,
                HM3BModel.t,
                HM3BModel.st,
                HM3BModel.tΛ,
                varianceΦ,
                z);

            this.DayScenarioRecoveryWardUtilizationVariances = varianceI
                                                               .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // EBS(t, Λ)
            IEBS EBS = calculationsAbstractFactory.CreateEBSCalculationFactory().Create()
                       .Calculate(
                resultElementsAbstractFactory.CreateEBSResultElementFactory(),
                resultsAbstractFactory.CreateEBSFactory(),
                calculationsAbstractFactory.CreateEBSResultElementCalculationFactory().Create(),
                HM3BModel.tΛ,
                HM3BModel.Ω,
                expectedValueI,
                varianceI);

            this.DayScenarioExpectedBedShortages = EBS
                                                   .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // TEBS(Λ)
            Interfaces.Results.ScenarioTotalExpectedBedShortages.ITEBS TEBS_Λ = calculationsAbstractFactory.CreateTEBSΛCalculationFactory().Create()
                                                                                .Calculate(
                resultElementsAbstractFactory.CreateTEBSΛResultElementFactory(),
                resultsAbstractFactory.CreateTEBSΛFactory(),
                calculationsAbstractFactory.CreateTEBSΛResultElementCalculationFactory().Create(),
                HM3BModel.t,
                HM3BModel.Λ,
                EBS);

            this.ScenarioTotalExpectedBedShortages = TEBS_Λ
                                                     .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // TEBS
            this.TotalExpectedBedShortage = calculationsAbstractFactory.CreateTEBSCalculationFactory().Create()
                                            .Calculate(
                resultsAbstractFactory.CreateTEBSFactory(),
                HM3BModel.Λ,
                HM3BModel.Ρ,
                TEBS_Λ)
                                            .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // ScenarioTotalTimes(Λ)
            IScenarioTotalTimes scenarioTotalTimes = calculationsAbstractFactory.CreateScenarioTotalTimesCalculationFactory().Create()
                                                     .Calculate(
                resultElementsAbstractFactory.CreateScenarioTotalTimesResultElementFactory(),
                resultsAbstractFactory.CreateScenarioTotalTimesFactory(),
                calculationsAbstractFactory.CreateScenarioTotalTimesResultElementCalculationFactory().Create(),
                HM3BModel.Λ,
                HM3BModel.srt,
                HM3BModel.H,
                x);

            this.ScenarioTotalTimes = scenarioTotalTimes.GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // ScenarioUtilizedTimes(Λ)
            IScenarioUtilizedTimes scenarioUtilizedTimes = calculationsAbstractFactory.CreateScenarioUtilizedTimesCalculationFactory().Create()
                                                           .Calculate(
                resultElementsAbstractFactory.CreateScenarioUtilizedTimesResultElementFactory(),
                resultsAbstractFactory.CreateScenarioUtilizedTimesFactory(),
                calculationsAbstractFactory.CreateScenarioUtilizedTimesResultElementCalculationFactory().Create(),
                HM3BModel.Λ,
                HM3BModel.srt,
                HM3BModel.h,
                HM3BModel.n,
                x);

            this.ScenarioUtilizedTimes = scenarioUtilizedTimes.GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // ScenarioUnutilizedTimes(Λ)
            IScenarioUnutilizedTimes scenarioUnutilizedTimes = calculationsAbstractFactory.CreateScenarioUnutilizedTimesCalculationFactory().Create()
                                                               .Calculate(
                resultElementsAbstractFactory.CreateScenarioUnutilizedTimesResultElementFactory(),
                resultsAbstractFactory.CreateScenarioUnutilizedTimesFactory(),
                calculationsAbstractFactory.CreateScenarioUnutilizedTimesResultElementCalculationFactory().Create(),
                HM3BModel.Λ,
                scenarioTotalTimes,
                scenarioUtilizedTimes);

            this.ScenarioUnutilizedTimes = scenarioUnutilizedTimes.GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // ScenarioUnderutilizations(Λ)
            this.ScenarioUnderutilizations = calculationsAbstractFactory.CreateScenarioUnderutilizationsCalculationFactory().Create()
                                             .Calculate(
                resultElementsAbstractFactory.CreateScenarioUnderutilizationsResultElementFactory(),
                resultsAbstractFactory.CreateScenarioUnderutilizationsFactory(),
                calculationsAbstractFactory.CreateScenarioUnderutilizationsResultElementCalculationFactory().Create(),
                HM3BModel.Λ,
                scenarioTotalTimes,
                scenarioUnutilizedTimes)
                                             .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // ΦHat(s, l, Λ)
            this.SurgeonDayScenarioCumulativeNumberPatients = calculationsAbstractFactory.CreateΦHatCalculationFactory().Create()
                                                              .Calculate(
                calculationsAbstractFactory.CreateExpectedValueIResultElementCalculationFactory(),
                calculationsAbstractFactory.CreateExpectedValueΦResultElementCalculationFactory(),
                calculationsAbstractFactory.CreateVarianceIResultElementCalculationFactory(),
                calculationsAbstractFactory.CreateVarianceΦResultElementCalculationFactory(),
                calculationsAbstractFactory.CreateVHatResultElementCalculationFactory(),
                calculationsAbstractFactory.Createυ2ResultElementCalculationFactory(),
                calculationsAbstractFactory.CreateΦHatResultElementCalculationFactory(),
                calculationsAbstractFactory.CreateExpectedValueICalculationFactory(),
                calculationsAbstractFactory.CreateExpectedValueΦCalculationFactory(),
                calculationsAbstractFactory.CreateMRNBCalculationFactory(),
                calculationsAbstractFactory.CreateRNBCalculationFactory(),
                calculationsAbstractFactory.CreatetStarCalculationFactory(),
                calculationsAbstractFactory.CreateVarianceICalculationFactory(),
                calculationsAbstractFactory.CreateVarianceΦCalculationFactory(),
                calculationsAbstractFactory.CreateVHatCalculationFactory(),
                calculationsAbstractFactory.Createυ2CalculationFactory(),
                dependenciesAbstractFactory.CreateNormalFactory(),
                resultElementsAbstractFactory.CreateExpectedValueIResultElementFactory(),
                resultElementsAbstractFactory.CreateExpectedValueΦResultElementFactory(),
                resultElementsAbstractFactory.CreateVarianceIResultElementFactory(),
                resultElementsAbstractFactory.CreateVarianceΦResultElementFactory(),
                resultElementsAbstractFactory.CreateVHatResultElementFactory(),
                resultElementsAbstractFactory.Createυ2ResultElementFactory(),
                resultElementsAbstractFactory.CreateΦHatResultElementFactory(),
                resultsAbstractFactory.CreateExpectedValueIFactory(),
                resultsAbstractFactory.CreateExpectedValueΦFactory(),
                resultsAbstractFactory.CreateVarianceIFactory(),
                resultsAbstractFactory.CreateVarianceΦFactory(),
                resultsAbstractFactory.CreateVHatFactory(),
                resultsAbstractFactory.Createυ2Factory(),
                resultsAbstractFactory.CreateΦHatFactory(),
                HM3BModel.l,
                HM3BModel.t,
                HM3BModel.Λ,
                HM3BModel.slΛ,
                HM3BModel.st,
                HM3BModel.tΛ,
                HM3BModel.L,
                HM3BModel.p,
                HM3BModel.μ,
                HM3BModel.σ,
                HM3BModel.Ω,
                z)
                                                              .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());
        }