コード例 #1
0
        public IConstraints12ConstraintElement Create(
            IdIndexElement dIndexElement,
            IwIndexElement wIndexElement,
            Id d,
            Il l,
            Ipa pa,
            IP P,
            Iprob prob,
            ITPx x,
            IVariance Variance)
        {
            IConstraints12ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints12ConstraintElement(
                    dIndexElement,
                    wIndexElement,
                    d,
                    l,
                    pa,
                    P,
                    prob,
                    x,
                    Variance);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
コード例 #2
0
        public Constraints11ConstraintElement(
            IdIndexElement dIndexElement,
            IwIndexElement wIndexElement,
            Id d,
            Il l,
            Ipa pa,
            IP P,
            Iprob prob,
            ITPx x,
            Iμ μ)
        {
            Expression LHS = μ.Value[wIndexElement, dIndexElement];

            ImmutableList <Tuple <IpIndexElement, IaIndexElement, double> > .Builder builder = ImmutableList.CreateBuilder <Tuple <IpIndexElement, IaIndexElement, double> >();

            foreach (IpIndexElement pIndexElement in pa.Value.Where(i => P.IsThereElementAt(wIndexElement, i.pIndexElement)).Select(w => w.pIndexElement).Distinct())
            {
                foreach (IaIndexElement aIndexElement in pa.Value.Select(w => w.aIndexElement).Distinct())
                {
                    int dLowerBound = aIndexElement.Key <= dIndexElement.Key ? dIndexElement.Key - aIndexElement.Key : d.GetMaximumKey() + dIndexElement.Key - aIndexElement.Key;

                    double RHSSum = 0;

                    for (int w = dLowerBound;
                         w <= l.GetMaximumLengthOfStay();
                         w = w + 1)
                    {
                        RHSSum +=
                            (double)prob.GetElementAtAsdecimal(
                                pIndexElement,
                                l.GetElementAt(
                                    w));
                    }

                    builder.Add(
                        Tuple.Create(
                            pIndexElement,
                            aIndexElement,
                            RHSSum));
                }
            }

            ImmutableList <Tuple <IpIndexElement, IaIndexElement, double> > RHSSums = builder.ToImmutableList();

            Expression RHS = Expression.Sum(
                pa.Value
                .Where(i => P.IsThereElementAt(wIndexElement, i.pIndexElement))
                .Select(
                    y =>
                    RHSSums.Where(w => w.Item1 == y.pIndexElement && w.Item2 == y.aIndexElement).Select(w => w.Item3).SingleOrDefault()
                    *
                    x.Value[
                        y.pIndexElement,
                        y.aIndexElement]));

            this.Value = LHS == RHS;
        }
コード例 #3
0
        public Iprob Create(
            ImmutableList <IprobParameterElement> value)
        {
            Iprob parameter = null;

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

            return(parameter);
        }