Esempio n. 1
0
        public IConstraints6LConstraintElement Create(
            IpIndexElement pIndexElement,
            Ia a,
            ILB LB,
            ISPx x)
        {
            IConstraints6LConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints6LConstraintElement(
                    pIndexElement,
                    a,
                    LB,
                    x);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
Esempio n. 2
0
        public IConstraints3ConstraintElement Create(
            IdIndexElement dIndexElement,
            IwIndexElement wIndexElement,
            Ipa pa,
            IA A,
            IP P,
            ISPx x,
            ISPy y)
        {
            IConstraints3ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints3ConstraintElement(
                    dIndexElement,
                    wIndexElement,
                    pa,
                    A,
                    P,
                    x,
                    y);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
        public Constraints3ConstraintElement(
            IdIndexElement dIndexElement,
            IwIndexElement wIndexElement,
            Ipa pa,
            IA A,
            IP P,
            ISPx x,
            ISPy y)
        {
            Expression LHS = Expression.Sum(
                pa.Value
                .Where(
                    i =>
                    P.IsThereElementAt(
                        wIndexElement,
                        i.pIndexElement)
                    &&
                    A.IsThereElementAt(
                        i.pIndexElement,
                        dIndexElement,
                        i.aIndexElement))
                .Select(
                    i => x.Value[i.pIndexElement, i.aIndexElement]));

            Expression RHS = y.Value[wIndexElement];

            this.Value = LHS <= RHS;
        }
        public Constraints5ConstraintElement(
            IaIndexElement aIndexElement,
            IsIndexElement sIndexElement,
            Ip p,
            Idur dur,
            ILENGTH LENGTH,
            IP P,
            ISPx x,
            ISPz z)
        {
            Expression LHS = Expression.Sum(
                p.Value
                .Where(
                    i =>
                    P.IsThereElementAt(
                        sIndexElement,
                        i))
                .Select(
                    i =>
                    (double)dur.GetElementAtAsdecimal(
                        i)
                    *
                    x.Value[i, aIndexElement]));

            Expression RHS =
                z.Value[sIndexElement, aIndexElement]
                *
                (double)LENGTH.Value.Value.Value;

            this.Value = LHS <= RHS;
        }
        public IConstraints5ConstraintElement Create(
            IaIndexElement aIndexElement,
            IsIndexElement sIndexElement,
            Ip p,
            Idur dur,
            ILENGTH LENGTH,
            IP P,
            ISPx x,
            ISPz z)
        {
            IConstraints5ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints5ConstraintElement(
                    aIndexElement,
                    sIndexElement,
                    p,
                    dur,
                    LENGTH,
                    P,
                    x,
                    z);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
        public ISPObjectiveFunction Create(
            IObjectiveFactory objectiveFactory,
            Ipa pa,
            Ir r,
            ISPx x)
        {
            ISPObjectiveFunction objectiveFunction = null;

            try
            {
                objectiveFunction = new SPObjectiveFunction(
                    objectiveFactory,
                    pa,
                    r,
                    x);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(objectiveFunction);
        }
Esempio n. 7
0
        public Constraints6UConstraintElement(
            IpIndexElement pIndexElement,
            Ia a,
            IUB UB,
            ISPx x)
        {
            Expression LHS = Expression.Sum(
                a.Value
                .Select(
                    i => x.Value[pIndexElement, i]));

            int RHS = UB.GetElementAtAsint(
                pIndexElement);

            this.Value = LHS <= RHS;
        }
Esempio n. 8
0
        public Constraints6LConstraintElement(
            IpIndexElement pIndexElement,
            Ia a,
            ILB LB,
            ISPx x)
        {
            int LHS = LB.GetElementAtAsint(
                pIndexElement);

            Expression RHS = Expression.Sum(
                a.Value
                .Select(
                    i => x.Value[pIndexElement, i]));

            this.Value = LHS <= RHS;
        }
Esempio n. 9
0
 public ITotalFinancialContribution Calculate(
     ITotalFinancialContributionFactory totalFinancialContributionFactory,
     Ipa pa,
     Ir r,
     ISPx x)
 {
     return(totalFinancialContributionFactory.Create(
                pa.Value
                .Select(
                    i =>
                    r.GetElementAtAsdecimal(
                        i.pIndexElement)
                    *
                    (decimal)x.GetElementAt(
                        i.pIndexElement,
                        i.aIndexElement))
                .Sum()));
 }
Esempio n. 10
0
        public ISPx Create(
            VariableCollection <IpIndexElement, IaIndexElement> value)
        {
            ISPx variable = null;

            try
            {
                variable = new SPx(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(variable);
        }
Esempio n. 11
0
        public ISPx Create(
            ImmutableList <ISPxResultElement> value)
        {
            ISPx result = null;

            try
            {
                result = new SPx(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(result);
        }
        public SPObjectiveFunction(
            IObjectiveFactory objectiveFactory,
            Ipa pa,
            Ir r,
            ISPx x)
        {
            Expression expression = Expression.Sum(
                pa.Value
                .Select(
                    i =>
                    (double)r.GetElementAtAsdecimal(
                        i.pIndexElement)
                    *
                    x.Value[i.pIndexElement, i.aIndexElement]));

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

            this.Value = objective;
        }