예제 #1
0
        public SPOutputContext(
            ICalculationsAbstractFactory calculationsAbstractFactory,
            IDependenciesAbstractFactory dependenciesAbstractFactory,
            IResultElementsAbstractFactory resultElementsAbstractFactory,
            IResultsAbstractFactory resultsAbstractFactory,
            ISPModel SPModel,
            Solution solution)
        {
            // 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();

            // TotalFinancialContribution
            this.TotalFinancialContribution = calculationsAbstractFactory.CreateTotalFinancialContributionCalculationFactory().Create()
                                              .Calculate(
                resultsAbstractFactory.CreateTotalFinancialContributionFactory(),
                SPModel.pa,
                SPModel.r,
                SPModel.x)
                                              .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // x(p, a)
            this.PatientGroupActiveDayNumberPatientAssignments = SPModel.x.GetElementsAt(
                resultElementsAbstractFactory.CreateSPxResultElementFactory(),
                resultsAbstractFactory.CreateSPxFactory(),
                SPModel.pa)
                                                                 .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // y(w)
            this.WardNumberBedAssignments = SPModel.y.GetElementsAt(
                resultElementsAbstractFactory.CreateSPyResultElementFactory(),
                resultsAbstractFactory.CreateSPyFactory(),
                SPModel.w)
                                            .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());

            // z(s, a)
            this.SurgeonGroupActiveDayNumberBlockAssignments = SPModel.z.GetElementsAt(
                resultElementsAbstractFactory.CreateSPzResultElementFactory(),
                resultsAbstractFactory.CreateSPzFactory(),
                SPModel.sa)
                                                               .GetValueForOutputContext(
                dependenciesAbstractFactory.CreateNullableValueFactory());
        }