ULSAlgorithms 1.1.0-g3e5595996d
High-performance exact and heuristic algorithms for uncapacitated lot sizing
Loading...
Searching...
No Matches
LinearTerm.cs
Go to the documentation of this file.
2
3/// <summary>
4/// Stores one coefficient of a portable linear expression.
5/// </summary>
6public readonly record struct LinearTerm
7{
8 /// <summary>Initializes a linear term.</summary>
9 public LinearTerm(
10 int variableId,
11 double coefficient)
12 {
13 if (variableId < 0)
14 {
15 throw new ArgumentOutOfRangeException(
16 nameof(variableId));
17 }
18
19 if (!double.IsFinite(coefficient))
20 {
21 throw new ArgumentOutOfRangeException(
22 nameof(coefficient),
23 "A coefficient must be finite.");
24 }
25
26 VariableId = variableId;
27 Coefficient = coefficient;
28 }
29
30 /// <summary>Gets the referenced variable identifier.</summary>
31 public int VariableId { get; }
32
33 /// <summary>Gets the coefficient.</summary>
34 public double Coefficient { get; }
35}
LinearTerm(int variableId, double coefficient)
Initializes a linear term.
Definition LinearTerm.cs:9
int VariableId
Gets the referenced variable identifier.
Definition LinearTerm.cs:31
double Coefficient
Gets the coefficient.
Definition LinearTerm.cs:34