Exemplo n.º 1
0
        public IConstraints8LConstraintElement Create(
            IdIndexElement dIndexElement,
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Ir r,
            Ix x,
            Iz z)
        {
            IConstraints8LConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints8LConstraintElement(
                    dIndexElement,
                    sIndexElement,
                    tIndexElement,
                    r,
                    x,
                    z);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
Exemplo n.º 2
0
        // y is a variable
        public IConstraints10ConstraintElement Create(
            IrIndexElement rIndexElement,
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Ix x,
            Iy y)
        {
            IConstraints10ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints10ConstraintElement(
                    rIndexElement,
                    sIndexElement,
                    tIndexElement,
                    x,
                    y);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
Exemplo n.º 3
0
        public Constraints5LConstraintElement(
            IdIndexElement dIndexElement,
            IrIndexElement rIndexElement,
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            It t,
            IW W,
            Iδ1 δ1,
            Iδ4 δ4,
            Ix x)
        {
            int LHS = δ1.GetElementAtAsint(
                sIndexElement,
                rIndexElement,
                dIndexElement);

            OPTANO.Modeling.Optimization.Expression RHS = OPTANO.Modeling.Optimization.Expression.Sum(
                t.GetNthElementsAt(
                    tIndexElement.Key,
                    tIndexElement.Key
                    +
                    (δ4.GetElementAtAsint(
                         sIndexElement,
                         rIndexElement,
                         dIndexElement,
                         tIndexElement)
                     - 1)
                    *
                    W.Value.Value.Value,
                    W.Value.Value.Value)
                .Select(
                    y => x.Value[sIndexElement, rIndexElement, y]));

            this.Value = LHS <= RHS;
        }
 // These dependencies will be automatically resolved
 // (and in this case supplied to the constructor)
 public Program(IMapper mapper, Ix x)
 {
     // Use dependencies
     mapper.RegisterMappings();
     // Assign any relevant properties, etc.
     _x = x;
 }
Exemplo n.º 5
0
        public IConstraints1ConstraintElement Create(
            IdIndexElement dIndexElement,
            IrIndexElement rIndexElement,
            IsIndexElement sIndexElement,
            It t,
            IW W,
            Iβ β,
            Ix x)
        {
            IConstraints1ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints1ConstraintElement(
                    dIndexElement,
                    rIndexElement,
                    sIndexElement,
                    t,
                    W,
                    β,
                    x);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
        public Constraints8ConstraintElement(
            Id2IndexElement d2IndexElement,
            IrIndexElement rIndexElement,
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Id1 d1,
            It t,
            Ix x,
            IxHat xHat,
            Iα α)
        {
            Expression LHS = xHat.Value[
                sIndexElement,
                rIndexElement,
                t.GetElementAt(
                    tIndexElement.Key + d2IndexElement.Value.Value.Value)];

            Expression RHS = Expression.Sum(
                d1.Value
                .Select(
                    y => x.GetElementAtAsint(
                        sIndexElement,
                        rIndexElement,
                        t.GetElementAt(
                            tIndexElement.Key + y.Value.Value.Value))
                    *
                    α.Value[rIndexElement, y, d2IndexElement]));

            this.Value = LHS == RHS;
        }
Exemplo n.º 7
0
        // y is a parameter
        public IConstraints10ConstraintElement Create(
            IrIndexElement rIndexElement,
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Interfaces.Parameters.SurgeonOperatingRoomAssignments.Iy y,
            Ix x)
        {
            IConstraints10ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints10ConstraintElement(
                    rIndexElement,
                    sIndexElement,
                    tIndexElement,
                    y,
                    x);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
Exemplo n.º 8
0
        private void TauSigmaInertia()
        {
            double.TryParse(textBox1.Text, out a);
            double.TryParse(textBox9.Text, out b);
            double.TryParse(textBox8.Text, out c);
            double.TryParse(textBox7.Text, out d);
            if (a == 0 || b == 0 || c == 0 || d == 0)
            {
                MessageBox.Show("Invalid input");
            }
            if (d > b / 2)
            {
                MessageBox.Show("d<b/2 !");
            }
            if (c > a / 2)
            {
                MessageBox.Show("c<a/2 !");
            }
            Ix            = ((a * a * a * b) - ((b - d) * (b - d) * (b - d) * (a - c - c))) / 12;
            textBox4.Text = "Ix = " + Ix.ToString() + "mm4";

            Tau           = T1 / ((a * b) - (a - c - c) * (b - d));
            textBox5.Text = Tau.ToString();

            Sigma         = (M1 * a) / (Ix * 2);
            textBox6.Text = Sigma.ToString();
        }
        public IConstraints3ConstraintElement Create(
            IrIndexElement rIndexElement,
            ItIndexElement tIndexElement,
            Is s,
            Iγ γ,
            Ix x)
        {
            IConstraints3ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints3ConstraintElement(
                    rIndexElement,
                    tIndexElement,
                    s,
                    γ,
                    x);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
        public IConstraints9ConstraintElement Create(
            IrIndexElement rIndexElement,
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Ix x,
            IxHat xHat)
        {
            IConstraints9ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints9ConstraintElement(
                    rIndexElement,
                    sIndexElement,
                    tIndexElement,
                    x,
                    xHat);
            }
            catch (Exception exception)
            {
                this.Log.Error("Exception message: " + exception.Message + " and stacktrace " + exception.StackTrace);
            }

            return(constraintElement);
        }
 public IScenarioUtilizedTimesResultElement Calculate(
     IScenarioUtilizedTimesResultElementFactory scenarioUtilizedTimesResultElementFactory,
     IΛIndexElement ΛIndexElement,
     Isrt srt,
     Ih h,
     In n,
     Ix x)
 {
     return(scenarioUtilizedTimesResultElementFactory.Create(
                ΛIndexElement,
                srt.Value.Select(w =>
                                 x.GetElementAtAsint(
                                     w.sIndexElement,
                                     w.rIndexElement,
                                     w.tIndexElement)
                                 *
                                 n.GetElementAtAsint(
                                     w.sIndexElement,
                                     ΛIndexElement)
                                 *
                                 h.GetElementAtAsdecimal(
                                     w.sIndexElement,
                                     ΛIndexElement))
                .Sum()));
 }
 public ISurgicalSpecialtyNumberAssignedWeekdaysResultElement Calculate(
     ISurgicalSpecialtyNumberAssignedWeekdaysResultElementFactory surgicalSpecialtyNumberAssignedWeekdaysResultElementFactory,
     IΔParameterElement ΔParameterElement,
     Ix x)
 {
     return(surgicalSpecialtyNumberAssignedWeekdaysResultElementFactory.Create(
                ΔParameterElement.jIndexElement,
                ΔParameterElement.Value.SelectMany(a => x.Value.Where(i => i.sIndexElement == a && i.Value).Select(i => i.tIndexElement.Value.ToDateTimeOffset(TimeSpan.Zero).UtcDateTime.DayOfWeek)).Distinct().Count()));
 }
 public ISurgeonNumberAssignedWeekdaysResultElement Calculate(
     ISurgeonNumberAssignedWeekdaysResultElementFactory surgeonNumberAssignedWeekdaysResultElementFactory,
     IsIndexElement sIndexElement,
     Ix x)
 {
     return(surgeonNumberAssignedWeekdaysResultElementFactory.Create(
                sIndexElement,
                x.Value.Where(i => i.sIndexElement == sIndexElement && i.Value).Select(i => i.tIndexElement.Value.ToDateTimeOffset(TimeSpan.Zero).UtcDateTime.DayOfWeek).Distinct().Count()));
 }
 public ISurgeonNumberAssignedOperatingRoomsResultElement Calculate(
     ISurgeonNumberAssignedOperatingRoomsResultElementFactory surgeonNumberAssignedOperatingRoomsResultElementFactory,
     IsIndexElement sIndexElement,
     Ix x)
 {
     return(surgeonNumberAssignedOperatingRoomsResultElementFactory.Create(
                sIndexElement,
                x.Value.Where(i => i.sIndexElement == sIndexElement && i.Value).Select(i => i.rIndexElement).Distinct().Count()));
 }
 public ISurgicalSpecialtyNumberAssignedOperatingRoomsResultElement Calculate(
     ISurgicalSpecialtyNumberAssignedOperatingRoomsResultElementFactory surgicalSpecialtyNumberAssignedOperatingRoomsResultElementFactory,
     IΔParameterElement ΔParameterElement,
     Ix x)
 {
     return(surgicalSpecialtyNumberAssignedOperatingRoomsResultElementFactory.Create(
                ΔParameterElement.jIndexElement,
                ΔParameterElement.Value.SelectMany(a => x.Value.Where(i => i.sIndexElement == a && i.Value).Select(w => w.rIndexElement)).Distinct().Count()));
 }
Exemplo n.º 16
0
 public IS2 Calculate(
     IS2ParameterElementFactory S2ParameterElementFactory,
     IS2Factory S2Factory,
     Id1 d1,
     Id2 d2,
     Ir r,
     It t,
     Ird1d2 rd1d2,
     IW W,
     Ix x,
     IΔ Δ)
 {
     return(S2Factory.Create(
                rd1d2.Value
                .Where(i => i.d1IndexElement.Value.Value.Value != i.d2IndexElement.Value.Value.Value)
                // rd1d2t1
                .SelectMany(b => t.GetNthElementsAt(
                                b.d1IndexElement.Value.Value.Value,
                                t.GetT() - W.Value.Value.Value + b.d1IndexElement.Value.Value.Value,
                                W.Value.Value.Value),
                            (a, b) => Tuple.Create(a.rIndexElement, a.d1IndexElement, a.d2IndexElement, b))
                // rd1d2t1t2
                .SelectMany(b => t.GetNthElementsAt(
                                b.Item3.Value.Value.Value,
                                t.GetT() - W.Value.Value.Value + b.Item3.Value.Value.Value,
                                W.Value.Value.Value),
                            (a, b) => Tuple.Create(a.Item1, a.Item2, a.Item3, a.Item4, b))
                .Select(
                    i => Tuple.Create(
                        i.Item1,
                        i.Item2,
                        i.Item3,
                        i.Item4,
                        i.Item5,
                        // x(j, r, t)
                        x.Value
                        .Where(j => j.Value.Value.Value)
                        .Select(j => Tuple.Create(
                                    Δ.GetSurgicalSpecialtyOfSurgeon(j.sIndexElement),
                                    j.rIndexElement,
                                    j.tIndexElement))
                        .Where(j => j.Item2 == i.Item1)
                        .Select(j => j.Item1)
                        .Distinct()
                        .Count()))
                .Where(i => i.Item6 == 1)
                .Select(i => S2ParameterElementFactory
                        .Create(
                            i.Item1,
                            i.Item2,
                            i.Item3))
                .ToImmutableList()));
 }
Exemplo n.º 17
0
        // Constructor: y is a variable (xx1)
        public Constraints10ConstraintElement(
            IrIndexElement rIndexElement,
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Ix x,
            Iy y)
        {
            Expression LHS = x.Value[sIndexElement, rIndexElement, tIndexElement];

            Expression RHS = y.Value[sIndexElement, rIndexElement];

            this.Value = LHS <= RHS;
        }
 public ISurgicalSpecialtyNumberAssignedWeekdays Calculate(
     ISurgicalSpecialtyNumberAssignedWeekdaysResultElementFactory surgicalSpecialtyNumberAssignedWeekdaysResultElementFactory,
     ISurgicalSpecialtyNumberAssignedWeekdaysFactory surgicalSpecialtyNumberAssignedWeekdaysFactory,
     ISurgicalSpecialtyNumberAssignedWeekdaysResultElementCalculation surgicalSpecialtyNumberAssignedWeekdaysResultElementCalculation,
     IΔ Δ,
     Ix x)
 {
     return(surgicalSpecialtyNumberAssignedWeekdaysFactory.Create(
                Δ.Value
                .Select(i => surgicalSpecialtyNumberAssignedWeekdaysResultElementCalculation.Calculate(
                            surgicalSpecialtyNumberAssignedWeekdaysResultElementFactory,
                            i,
                            x))
                .ToImmutableList()));
 }
Exemplo n.º 19
0
        // Constructor: y is a parameter (xx0)
        public Constraints10ConstraintElement(
            IrIndexElement rIndexElement,
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Interfaces.Parameters.SurgeonOperatingRoomAssignments.Iy y,
            Ix x)
        {
            Expression LHS = x.Value[sIndexElement, rIndexElement, tIndexElement];

            int RHS = y.GetElementAtAsint(
                sIndexElement,
                rIndexElement);

            this.Value = LHS <= RHS;
        }
 public ISurgeonNumberAssignedOperatingRooms Calculate(
     ISurgeonNumberAssignedOperatingRoomsResultElementFactory surgeonNumberAssignedOperatingRoomsResultElementFactory,
     ISurgeonNumberAssignedOperatingRoomsFactory surgeonNumberAssignedOperatingRoomsFactory,
     ISurgeonNumberAssignedOperatingRoomsResultElementCalculation surgeonNumberAssignedOperatingRoomsResultElementCalculation,
     Is s,
     Ix x)
 {
     return(surgeonNumberAssignedOperatingRoomsFactory.Create(
                s.Value
                .Select(w => surgeonNumberAssignedOperatingRoomsResultElementCalculation.Calculate(
                            surgeonNumberAssignedOperatingRoomsResultElementFactory,
                            w,
                            x))
                .ToImmutableList()));
 }
Exemplo n.º 21
0
        public void PainDropDown <T>(List <T> List, FKMenuHelper.MenuStruct Item, bool Alone = false)
        {
            Border Border = new Border
            {
                Width           = 141,
                Height          = 32,
                Background      = Extensions.HexToBrush(Item.MouseEvent.Color.Reset.Color.ToString(), false),
                BorderBrush     = Extensions.HexToBrush("#e9e9e9", false),
                BorderThickness = new Thickness(0, 1, 0, 1),
                CornerRadius    = new CornerRadius(0),
                // Tag = new FKMethods.TagHelper { Transition = Item.MouseEvent.Color },
                ToolTip = new Label {
                    Content = Item.Title
                },
                Name = "DropDown"
            };

            Border.Background      = Extensions.HexToBrush(Item.MouseEvent.Color.Active.Color.ToString(), false);
            Border.BorderThickness = (Alone) ? new Thickness(1) : new Thickness(1, 1, 0, 1);
            Border.CornerRadius    = (Alone) ? new CornerRadius(4) : new CornerRadius(4, 0, 0, 4);
            ComboBox Box = new ComboBox {
                Width = 140, Height = 28, SelectedIndex = 0
            };

            foreach (T Ix in List)
            {
                if (Ix.Equals(List.First()))
                {
                    SelectedItem     = Ix;
                    xSubMenu.Content = ((HasName)Ix).Name;
                }

                ComboBoxItem Itemx = new ComboBoxItem {
                    Content = ((HasName)Ix).Name, Tag = Ix
                };
                Box.Items.Add(Itemx);
            }

            Box.SelectionChanged += (s, e) =>
            {
                SelectedItem     = Box.Items[Box.SelectedIndex].CastVisual <ComboBoxItem>().TagHelper <T>();
                xSubMenu.Content = Box.Items[Box.SelectedIndex].CastVisual <ComboBoxItem>().TagHelper <HasName>().Name;
                LoadPage(this.Page, null);
            };

            Border.Child = Box;
            IconMenu.Children.Add(Border);
        }
        public Constraints9ConstraintElement(
            IrIndexElement rIndexElement,
            ItIndexElement tIndexElement,
            Is s,
            Ix x,
            Iγ γ)
        {
            Expression LHS = Expression.Sum(
                s.Value
                .Select(
                    y => x.Value[y, rIndexElement, tIndexElement]));

            Expression RHS = γ.Value[rIndexElement, tIndexElement];

            this.Value = LHS == RHS;
        }
Exemplo n.º 23
0
        public Constraints9ConstraintElement(
            IrIndexElement rIndexElement,
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Ix x,
            IxHat xHat)
        {
            Expression LHS = xHat.Value[sIndexElement, rIndexElement, tIndexElement];

            int RHS = x.GetElementAtAsint(
                sIndexElement,
                rIndexElement,
                tIndexElement);

            this.Value = LHS == RHS;
        }
Exemplo n.º 24
0
        public Constraints2ConstraintElement(
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Ir r,
            Ix x,
            Iz z)
        {
            Expression LHS = Expression.Sum(
                r.Value
                .Select(
                    y => x.Value[sIndexElement, y, tIndexElement]));

            Expression RHS = z.Value[sIndexElement, tIndexElement];

            this.Value = LHS == RHS;
        }
Exemplo n.º 25
0
        public Ix Create(
            ImmutableList <IxParameterElement> value)
        {
            Ix parameter = null;

            try
            {
                parameter = new x(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error("Exception message: " + exception.Message + " and stacktrace " + exception.StackTrace);
            }

            return(parameter);
        }
 public IScenarioTotalTimesResultElement Calculate(
     IScenarioTotalTimesResultElementFactory scenarioTotalTimesResultElementFactory,
     IΛIndexElement ΛIndexElement,
     Isrt srt,
     IH H,
     Ix x)
 {
     return(scenarioTotalTimesResultElementFactory.Create(
                ΛIndexElement,
                srt.Value.Select(w =>
                                 x.GetElementAtAsint(
                                     w.sIndexElement,
                                     w.rIndexElement,
                                     w.tIndexElement)
                                 *
                                 H.Value.Value.Value)
                .Sum()));
 }
Exemplo n.º 27
0
        public Constraints3ConstraintElement(
            IrIndexElement rIndexElement,
            ItIndexElement tIndexElement,
            Is s,
            Iγ γ,
            Ix x)
        {
            Expression LHS = Expression.Sum(
                s.Value
                .Select(
                    y => x.Value[y, rIndexElement, tIndexElement]));

            int RHS = γ.GetElementAtAsint(
                rIndexElement,
                tIndexElement);

            this.Value = LHS == RHS;
        }
Exemplo n.º 28
0
        public Ix Create(
            VariableCollection <IsIndexElement, IrIndexElement, ItIndexElement> value)
        {
            Ix variable = null;

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

            return(variable);
        }
Exemplo n.º 29
0
        public Ix Create(
            ImmutableList <IxResultElement> value)
        {
            Ix result = null;

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

            return(result);
        }
 public IScenarioTotalTimes Calculate(
     IScenarioTotalTimesResultElementFactory scenarioTotalTimesResultElementFactory,
     IScenarioTotalTimesFactory scenarioTotalTimesFactory,
     IScenarioTotalTimesResultElementCalculation scenarioTotalTimesResultElementCalculation,
     IΛ Λ,
     Isrt srt,
     IH H,
     Ix x)
 {
     return(scenarioTotalTimesFactory.Create(
                Λ.Value
                .Select(w => scenarioTotalTimesResultElementCalculation.Calculate(
                            scenarioTotalTimesResultElementFactory,
                            w,
                            srt,
                            H,
                            x))
                .ToImmutableList()));
 }