18 throw new ArgumentOutOfRangeException(nameof(
id));
21 if (
string.IsNullOrWhiteSpace(name))
23 throw new ArgumentException(
24 "A variable name is required.",
28 if (!
double.IsFinite(lowerBound) ||
29 (!
double.IsFinite(upperBound) &&
30 !
double.IsPositiveInfinity(upperBound)))
32 throw new ArgumentOutOfRangeException(
34 "Variable bounds must be finite, except for +infinity.");
37 if (lowerBound > upperBound)
39 throw new ArgumentException(
40 "The lower bound cannot exceed the upper bound.");
44 (lowerBound < 0.0 || upperBound > 1.0))
46 throw new ArgumentException(
47 "Binary-variable bounds must be contained in [0,1].");