ULSAlgorithms 1.1.0-g3e5595996d
High-performance exact and heuristic algorithms for uncapacitated lot sizing
Loading...
Searching...
No Matches
CutCoefficient.cs
Go to the documentation of this file.
2
3/// <summary>
4/// Stores one nonzero coefficient of a generated linear inequality.
5/// </summary>
6public readonly record struct CutCoefficient
7{
8 /// <summary>Initializes a coefficient.</summary>
9 public CutCoefficient(string variableName, double coefficient)
10 {
11 if (string.IsNullOrWhiteSpace(variableName))
12 {
13 throw new ArgumentException(
14 "A variable name is required.",
15 nameof(variableName));
16 }
17
18 if (!double.IsFinite(coefficient))
19 {
20 throw new ArgumentOutOfRangeException(
21 nameof(coefficient),
22 "A cut coefficient must be finite.");
23 }
24
25 VariableName = variableName.Trim();
26 Coefficient = coefficient;
27 }
28
29 /// <summary>Gets the solver-independent variable identifier.</summary>
30 public string VariableName { get; }
31
32 /// <summary>Gets the coefficient value.</summary>
33 public double Coefficient { get; }
34}
double Coefficient
Gets the coefficient value.
string VariableName
Gets the solver-independent variable identifier.
CutCoefficient(string variableName, double coefficient)
Initializes a coefficient.