public ITPObjectiveFunction Create(
            IObjectiveFactory objectiveFactory,
            Id d,
            Iw w,
            Iα α,
            Iβ β,
            Iγ γ,
            IδMinus δMinus,
            Interfaces.Variables.TP.WardSpareBeds.IδPlus δPlus_w,
            Interfaces.Variables.TP.WardBedOccupancyVariances.IVariance Variance_w)
        {
            ITPObjectiveFunction objectiveFunction = null;

            try
            {
                objectiveFunction = new TPObjectiveFunction(
                    objectiveFactory,
                    d,
                    w,
                    α,
                    β,
                    γ,
                    δMinus,
                    δPlus_w,
                    Variance_w);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(objectiveFunction);
        }
Ejemplo n.º 2
0
        public IConstraints14ConstraintElement Create(
            IdIndexElement dIndexElement,
            IwIndexElement wIndexElement,
            Interfaces.Variables.TP.WardBedOccupancyVariances.IVariance Variance_w,
            Interfaces.Variables.TP.WardDayBedRequirementVariances.IVariance Variance_wd)
        {
            IConstraints14ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints14ConstraintElement(
                    dIndexElement,
                    wIndexElement,
                    Variance_w,
                    Variance_wd);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
        public Constraints14ConstraintElement(
            IdIndexElement dIndexElement,
            IwIndexElement wIndexElement,
            Interfaces.Variables.TP.WardBedOccupancyVariances.IVariance Variance_w,
            Interfaces.Variables.TP.WardDayBedRequirementVariances.IVariance Variance_wd)
        {
            Expression LHS =
                Variance_wd.Value[wIndexElement, dIndexElement];

            Expression RHS =
                Variance_w.Value[wIndexElement];

            this.Value = LHS <= RHS;
        }
        public TPObjectiveFunction(
            IObjectiveFactory objectiveFactory,
            Id d,
            Iw w,
            Iα α,
            Iβ β,
            Iγ γ,
            IδMinus δMinus,
            Interfaces.Variables.TP.WardSpareBeds.IδPlus δPlus_w,
            Interfaces.Variables.TP.WardBedOccupancyVariances.IVariance Variance_w)
        {
            Expression expression = Expression.Sum(
                w.Value
                .Select(
                    i =>
                    (double)α.GetElementAtAsdecimal(
                        i)
                    *
                    Expression.Sum(
                        d.Value
                        .Select(
                            j =>
                            δMinus.Value[i, j]))
                    +
                    (double)β.GetElementAtAsdecimal(
                        i)
                    *
                    δPlus_w.Value[i]
                    +
                    (double)γ.GetElementAtAsdecimal(
                        i)
                    *
                    Variance_w.Value[i]));

            Objective objective = objectiveFactory.Create(
                expression,
                ObjectiveSense.Minimize);

            this.Value = objective;
        }