LotSizingDataModel.Core 2.0.1
Core domain model, shared abstractions and XML-serializable entities.
Loading...
Searching...
No Matches
MaximumLotSize.cs
Go to the documentation of this file.
1using System;
2using System.Xml.Serialization;
5
7
8/// <summary>
9/// Represents the maximum production-lot size for each planning period.
10/// </summary>
11/// <remarks>
12/// Null at routing level means "not represented". A represented value of zero
13/// is active and forbids production in the corresponding period.
14/// </remarks>
15[Serializable]
16[XmlType(TypeName = "maximumLotSize")]
17public sealed class MaximumLotSize :
19{
21 {
22 }
23
24 public MaximumLotSize(int planningHorizon)
25 : base(planningHorizon, defaultValue: 0.0)
26 {
27 }
28
30 int planningHorizon,
31 double defaultMaximumLotSize)
32 : base(
33 planningHorizon,
34 defaultMaximumLotSize)
35 {
36 }
37
38 [XmlIgnore]
40 Values;
41
42 public double GetMaximumLotSize(int period) =>
43 GetValue(period);
44
45 public void SetMaximumLotSize(
46 int period,
47 double maximumLotSize) =>
48 SetValue(period, maximumLotSize);
49
50 protected override void ValidateValue(
51 double value,
52 string parameterName)
53 {
54 base.ValidateValue(value, parameterName);
55
56 if (value < 0.0)
57 {
58 throw new ArgumentOutOfRangeException(
59 parameterName,
60 value,
61 "A maximum lot size cannot be negative.");
62 }
63 }
64}
Represents a sequence of finite double values indexed by planning period.
override void ValidateValue(double value, string parameterName)
Validates one value before it is assigned to the parameter.
void SetMaximumLotSize(int period, double maximumLotSize)
MaximumLotSize(int planningHorizon, double defaultMaximumLotSize)
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.