LotSizingDataModel.Core 2.0.1
Core domain model, shared abstractions and XML-serializable entities.
Loading...
Searching...
No Matches
ScheduledReceipt.cs
Go to the documentation of this file.
1using System;
2using System.Xml.Serialization;
5
7
8/// <summary>
9/// Represents quantities from production or purchase orders
10/// already in progress at the beginning of the planning horizon
11/// and expected to be received during that horizon.
12///
13/// Corresponds to the UML class "Reception Prevue".
14/// Its values correspond to QEnc[t] in the source model.
15/// </summary>
16[Serializable]
17[XmlType(TypeName = "scheduledReceipt")]
18public sealed class ScheduledReceipt :
20{
21 /// <summary>
22 /// Initializes an empty scheduled-receipt parameter.
23 ///
24 /// This public parameterless constructor is required
25 /// by <see cref="XmlSerializer"/>.
26 /// </summary>
28 {
29 }
30
31 /// <summary>
32 /// Initializes scheduled receipts for the specified
33 /// planning horizon.
34 ///
35 /// Every period is initially assigned a receipt quantity
36 /// of zero.
37 /// </summary>
38 /// <param name="planningHorizon">
39 /// Number of periods in the planning horizon.
40 /// </param>
41 public ScheduledReceipt(int planningHorizon)
42 : base(
43 planningHorizon,
44 defaultValue: 0.0) // Initialize all periods with zero scheduled receipts
45 {
46 }
47
48 /// <summary>
49 /// Initializes scheduled receipts for the specified
50 /// planning horizon and assigns the same quantity
51 /// to every period.
52 /// </summary>
53 /// <param name="planningHorizon">
54 /// Number of periods in the planning horizon.
55 /// </param>
56 /// <param name="defaultReceiptQuantity">
57 /// Receipt quantity initially assigned to every period.
58 /// </param>
60 int planningHorizon,
61 double defaultReceiptQuantity)
62 : base(
63 planningHorizon,
64 defaultReceiptQuantity) // Initialize all periods with the specified receipt quantity
65 {
66 }
67
68 /// <summary>
69 /// Gets the complete scheduled-receipt time series.
70 ///
71 /// This property is an alias for <see cref="LotSizingDataModel.Core.DecisionModel.DoubleTimeSeriesParameter.Values"/>
72 /// and is not serialized separately.
73 /// </summary>
74 [XmlIgnore]
76 Values;
77
78 /// <summary>
79 /// Gets the quantity expected to be received
80 /// during a planning period.
81 /// </summary>
82 /// <param name="period">
83 /// One-based planning-period number.
84 /// </param>
85 public double GetReceiptQuantity(int period)
86 {
87 return GetValue(period);
88 }
89
90 /// <summary>
91 /// Sets the quantity expected to be received
92 /// during a planning period.
93 /// </summary>
94 /// <param name="period">
95 /// One-based planning-period number.
96 /// </param>
97 /// <param name="quantity">
98 /// Non-negative finite receipt quantity.
99 /// </param>
101 int period,
102 double quantity)
103 {
104 SetValue(period, quantity);
105 }
106
107 /// <summary>
108 /// Validates a scheduled-receipt quantity.
109 /// </summary>
110 protected override void ValidateValue(
111 double value,
112 string parameterName)
113 {
114 // First validate that the value is finite (base class validation)
115 base.ValidateValue(value, parameterName);
116
117 // Then validate that the scheduled receipt quantity is non-negative
118 if (value < 0.0)
119 {
120 throw new ArgumentOutOfRangeException(
121 parameterName,
122 value,
123 "A scheduled-receipt quantity cannot be negative.");
124 }
125 }
126}
Represents a sequence of finite double values indexed by planning period.
void SetReceiptQuantity(int period, double quantity)
Sets the quantity expected to be received during a planning period.
ScheduledReceipt(int planningHorizon)
Initializes scheduled receipts for the specified planning horizon.
override void ValidateValue(double value, string parameterName)
Validates a scheduled-receipt quantity.
ScheduledReceipt()
Initializes an empty scheduled-receipt parameter.
ScheduledReceipt(int planningHorizon, double defaultReceiptQuantity)
Initializes scheduled receipts for the specified planning horizon and assigns the same quantity to ev...
double GetReceiptQuantity(int period)
Gets the quantity expected to be received during a planning period.
DoubleTimeSeries ReceiptQuantities
Gets the complete scheduled-receipt time series.
DoubleTimeSeriesParameter()
Initializes an empty period-dependent parameter.
double GetValue(int period)
Gets the parameter value for a planning period.
DoubleTimeSeries Values
Gets or sets the values of the parameter for all planning periods.
void SetValue(int period, double value)
Sets the parameter value for a planning period.