示例#1
0
        public IConstraints13UConstraintElement Create(
            IdIndexElement dIndexElement,
            IwIndexElement wIndexElement,
            Interfaces.Variables.TP.WardSpareBeds.IδPlus δPlus_w,
            Interfaces.Variables.TP.WardDayBedAvailabilityDeviations.IδPlus δPlus_wd)
        {
            IConstraints13UConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints13UConstraintElement(
                    dIndexElement,
                    wIndexElement,
                    δPlus_w,
                    δPlus_wd);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
        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);
        }
        public Constraints13UConstraintElement(
            IdIndexElement dIndexElement,
            IwIndexElement wIndexElement,
            Interfaces.Variables.TP.WardSpareBeds.IδPlus δPlus_w,
            Interfaces.Variables.TP.WardDayBedAvailabilityDeviations.IδPlus δPlus_wd)
        {
            Expression LHS = δPlus_wd.Value[wIndexElement, dIndexElement];

            Expression RHS = δPlus_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;
        }