13 IEnumerable<LinearTerm> terms,
17 if (
string.IsNullOrWhiteSpace(name))
19 throw new ArgumentException(
20 "A constraint name is required.",
24 ArgumentNullException.ThrowIfNull(terms);
26 if (!
double.IsFinite(rightHandSide))
28 throw new ArgumentOutOfRangeException(
29 nameof(rightHandSide),
30 "The right-hand side must be finite.");
36 term.Coefficient != 0.0)
47 throw new ArgumentException(
48 "A constraint cannot contain duplicate variable identifiers.",
58 public string Name {
get; }
61 public IReadOnlyList<LinearTerm>
Terms => _terms;
LinearConstraintSense Sense
Gets the constraint sense.
IReadOnlyList< LinearTerm > Terms
Gets the nonzero terms.
string Name
Gets the constraint name.
double RightHandSide
Gets the right-hand side.
LinearConstraint(string name, IEnumerable< LinearTerm > terms, LinearConstraintSense sense, double rightHandSide)
Initializes a linear constraint.
LinearConstraintSense
Identifies the sense of a portable linear constraint.
Stores one coefficient of a portable linear expression.