LotSizingDataModel.Core 2.1.0
Core domain model, shared abstractions and XML-serializable entities.
Loading...
Searching...
No Matches
ResourceCapacitySeries.cs
Go to the documentation of this file.
1using System;
2using System.Linq;
3using System.Xml.Serialization;
4
6
7/// <summary>XML capacity series for work centers and warehouses, with INF for unbounded periods.</summary>
8public sealed class ResourceCapacitySeries
9{
10 /// <summary>Capacity values in planning-period order.</summary>
11 [XmlElement("values")]
12 public double[] Values { get; set; } = [];
13
15 constraint is null ? null : new ResourceCapacitySeries { Values = constraint.Values.ToArray() };
16
18 {
19 var constraint = new CapacityConstraint(Values.Length);
20 for (int index = 0; index < Values.Length; index++)
21 {
22 double maximum = Values[index];
23 if (double.IsPositiveInfinity(maximum))
24 constraint.Values.SetUnboundedCapacityPeriod(index + 1);
25 else
26 constraint.SetMaximumCapacity(index + 1, maximum);
27 }
28 return constraint;
29 }
30}
Represents a maximum-capacity constraint defined for each planning period.
XML capacity series for work centers and warehouses, with INF for unbounded periods.
static ? ResourceCapacitySeries FromConstraint(CapacityConstraint? constraint)
DoubleTimeSeries Values
Gets or sets the values of the parameter for all planning periods.