Example #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);
        }
Example #2
0
        /// <summary>
        /// 获取本地主机的IPV4地址
        /// </summary>
        /// <returns></returns>
        public static string GetLocalIP4Address()
        {
            string Ip4Addr = string.Empty;

            foreach (IPAddress Ipa in Dns.GetHostAddresses(Environment.MachineName))
            {
                if (0 == string.CompareOrdinal(Ipa.AddressFamily.ToString(), "InterNetwork"))
                {
                    Ip4Addr = Ipa.ToString();
                    break;
                }
            }

            if (!string.IsNullOrEmpty(Ip4Addr))
            {
                return(Ip4Addr);
            }

            foreach (IPAddress Ipa in Dns.GetHostAddresses(Dns.GetHostName()))
            {
                if (0 == string.CompareOrdinal(Ipa.AddressFamily.ToString(), "InterNetwork"))
                {
                    Ip4Addr = Ipa.ToString();
                    break;
                }
            }
            return(Ip4Addr);
        }
Example #3
0
        public static List <string> GetLocalIP4AddressList()
        {
            List <string> lsResult = new List <string>();

            foreach (IPAddress Ipa in Dns.GetHostAddresses(Environment.MachineName))
            {
                if (0 == string.CompareOrdinal(Ipa.AddressFamily.ToString(), "InterNetwork"))
                {
                    lsResult.Add(Ipa.ToString());
                }
            }

            if (lsResult.Count > 0)
            {
                return(lsResult);
            }

            foreach (IPAddress Ipa in Dns.GetHostAddresses(Dns.GetHostName()))
            {
                if (0 == string.CompareOrdinal(Ipa.AddressFamily.ToString(), "InterNetwork"))
                {
                    lsResult.Add(Ipa.ToString());
                }
            }
            return(lsResult);
        }
Example #4
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 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);
        }
        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;
        }
Example #8
0
 public INumberPatients Calculate(
     INumberPatientsFactory numberPatientsFactory,
     Ipa pa,
     ITPx x)
 {
     return(numberPatientsFactory.Create(
                pa.Value
                .Select(
                    i =>
                    x.GetElementAtAsint(
                        i.pIndexElement,
                        i.aIndexElement))
                .Sum()));
 }
Example #9
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         double L, H, W, Ipa, Lpa, Kp;
         if (double.Parse(ValueL.Text) < 300 && double.Parse(ValueL.Text) > 0)
         {
             L           = 300;
             ValueL.Text = "300";
         }
         if (double.Parse(ValueL.Text) > 3000)
         {
             L           = 3000;
             ValueL.Text = "3000";
         }
         else
         {
             L = double.Parse(ValueL.Text);
         }
         if (double.Parse(ValueH.Text) < 300 && double.Parse(ValueH.Text) > 0)
         {
             H           = 300;
             ValueH.Text = "300";
         }
         if (double.Parse(ValueH.Text) > 3000)
         {
             H           = 3000;
             ValueH.Text = "3000";
         }
         else
         {
             H = double.Parse(ValueL.Text);
         }
         W             = double.Parse(ValueW.Text);
         Lpa           = ((H - 2 * W) * (L - 2 * W)) / 1000;
         Kp            = (H + H + L + L) / 1000;
         Ipa           = (H * L) / 1000;
         Ikkuna.Width  = L / 10;
         Ikkuna.Height = H / 10;
         txtLpa.Text   = Lpa.ToString("0.00") + "m²";
         txtKp.Text    = Kp.ToString("0.00") + "m²";
         txtIpa.Text   = Ipa.ToString("0.00") + "m";
     }
     catch (Exception)
     {
         ValueH.Text = "0";
         ValueL.Text = "0";
         ValueW.Text = "45";
     }
 }
Example #10
0
 public ISurgeonGroupNumberPatientsResultElement Calculate(
     ISurgeonGroupNumberPatientsResultElementFactory surgeonGroupNumberPatientsResultElementFactory,
     IsIndexElement sIndexElement,
     Ipa pa,
     IP P,
     ITPx x)
 {
     return(surgeonGroupNumberPatientsResultElementFactory.Create(
                sIndexElement,
                pa.Value
                .Where(w => P.IsThereElementAt(sIndexElement, w.pIndexElement))
                .Select(w => x.GetElementAtAsint(w.pIndexElement, w.aIndexElement))
                .Sum()));
 }
Example #11
0
 public Interfaces.Results.SP.PatientGroupActiveDayNumberPatientAssignments.ISPx GetElementsAt(
     ISPxResultElementFactory xResultElementFactory,
     ISPxFactory xFactory,
     Ipa pa)
 {
     return(xFactory.Create(
                pa.Value
                .Select(
                    i => xResultElementFactory.Create(
                        i.pIndexElement,
                        i.aIndexElement,
                        this.GetElementAt(
                            i.pIndexElement,
                            i.aIndexElement)))
                .ToImmutableList()));
 }
Example #12
0
 public IUtilizedTime Calculate(
     IUtilizedTimeFactory utilizedTimeFactory,
     Ipa pa,
     Idur dur,
     ITPx x)
 {
     return(utilizedTimeFactory.Create(
                pa.Value
                .Select(w =>
                        x.GetElementAtAsint(
                            w.pIndexElement,
                            w.aIndexElement)
                        *
                        dur.GetElementAtAsdecimal(
                            w.pIndexElement))
                .Sum()));
 }
Example #13
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()));
 }
Example #14
0
 public ISurgeonGroupNumberPatients Calculate(
     ISurgeonGroupNumberPatientsResultElementFactory surgeonGroupNumberPatientsResultElementFactory,
     ISurgeonGroupNumberPatientsFactory surgeonGroupNumberPatientsFactory,
     ISurgeonGroupNumberPatientsResultElementCalculation surgeonGroupNumberPatientsResultElementCalculation,
     Is s,
     Ipa pa,
     IP P,
     ITPx x)
 {
     return(surgeonGroupNumberPatientsFactory.Create(
                s.Value
                .Select(w => surgeonGroupNumberPatientsResultElementCalculation.Calculate(
                            surgeonGroupNumberPatientsResultElementFactory,
                            w,
                            pa,
                            P,
                            x))
                .ToImmutableList()));
 }
Example #15
0
        public Ipa Create(
            ImmutableList <IpaCrossJoinElement> value)
        {
            Ipa crossJoin = null;

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

            return(crossJoin);
        }
        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;
        }