ULSAlgorithms 1.1.0-g3e5595996d
High-performance exact and heuristic algorithms for uncapacitated lot sizing
Loading...
Searching...
No Matches
LinearModelSolveOptions.cs
Go to the documentation of this file.
2
3/// <summary>
4/// Configures one solver-backed execution of a portable linear model.
5/// </summary>
6public sealed class LinearModelSolveOptions
7{
8 /// <summary>
9 /// Gets or sets the requested solver. The default is automatic selection.
10 /// </summary>
11 public SolverKind Solver { get; set; } =
12 SolverKind.Automatic;
13
14 /// <summary>
15 /// Gets or sets whether an explicitly requested solver may fall back to
16 /// another solver when unavailable.
17 /// </summary>
18 public bool AllowFallbackWhenExplicit { get; set; }
19
20 /// <summary>
21 /// Gets or sets the feasibility tolerance used by the independent solution
22 /// checker.
23 /// </summary>
24 public double FeasibilityTolerance { get; set; } =
25 1.0e-7;
26
27 /// <summary>
28 /// Gets or sets the tolerance used to identify numerical zero before
29 /// validation and objective reconstruction.
30 /// </summary>
31 public double ZeroTolerance { get; set; } =
33
34 /// <summary>
35 /// Gets or sets the integrality tolerance used both for normalization and
36 /// the independent solution checker.
37 /// </summary>
38 public double IntegralityTolerance { get; set; } =
40
41 /// <summary>
42 /// Gets or sets the tolerance used to clean continuous values that are
43 /// numerically indistinguishable from an integer.
44 /// </summary>
45 public double NearIntegerTolerance { get; set; } =
47
48 /// <summary>
49 /// Gets or sets whether a solver candidate rejected only after numerical
50 /// normalization may be recovered by fixing all integer decisions to their
51 /// normalized values and re-optimizing the remaining continuous model.
52 /// </summary>
53 /// <remarks>
54 /// Polishing never upgrades a tolerance-only MIP result to proven optimal.
55 /// The original solver-reported optimality status is preserved.
56 /// </remarks>
57 public bool EnableFixedIntegerPolishing { get; set; } = true;
58 /// <summary>
59 /// Gets or sets an optional path receiving the exact LP model submitted to
60 /// the selected solver.
61 /// </summary>
62 public string ExportModelPath { get; set; } =
63 string.Empty;
64
65 /// <summary>
66 /// Gets or sets whether temporary model/solution/log artifacts are retained.
67 /// </summary>
68 public bool KeepTemporaryFiles { get; set; }
69
70 /// <summary>
71 /// Gets or sets an optional parent directory for temporary solver artifacts.
72 /// </summary>
73 public string TemporaryRootPath { get; set; } =
74 string.Empty;
75
76 /// <summary>Validates this option set.</summary>
77 public void EnsureValid()
78 {
79 if (Solver == SolverKind.Unknown)
80 {
81 throw new InvalidOperationException(
82 "The requested solver cannot be Unknown.");
83 }
84
85 if (!double.IsFinite(FeasibilityTolerance) ||
87 {
88 throw new InvalidOperationException(
89 "FeasibilityTolerance must be finite and strictly positive.");
90 }
91
92 ValidateNonNegativeTolerance(
94 nameof(ZeroTolerance));
95
96 if (!double.IsFinite(IntegralityTolerance) ||
98 {
99 throw new InvalidOperationException(
100 "IntegralityTolerance must be finite and strictly positive.");
101 }
102
103 ValidateNonNegativeTolerance(
105 nameof(NearIntegerTolerance));
106 }
107
108 private static void ValidateNonNegativeTolerance(
109 double tolerance,
110 string name)
111 {
112 if (!double.IsFinite(tolerance) ||
113 tolerance < 0.0)
114 {
115 throw new InvalidOperationException(
116 $"{name} must be finite and non-negative.");
117 }
118 }
119}
120
Configures one solver-backed execution of a portable linear model.
string TemporaryRootPath
Gets or sets an optional parent directory for temporary solver artifacts.
SolverKind Solver
Gets or sets the requested solver. The default is automatic selection.
bool AllowFallbackWhenExplicit
Gets or sets whether an explicitly requested solver may fall back to another solver when unavailable.
double NearIntegerTolerance
Gets or sets the tolerance used to clean continuous values that are numerically indistinguishable fro...
double ZeroTolerance
Gets or sets the tolerance used to identify numerical zero before validation and objective reconstruc...
double IntegralityTolerance
Gets or sets the integrality tolerance used both for normalization and the independent solution check...
bool KeepTemporaryFiles
Gets or sets whether temporary model/solution/log artifacts are retained.
bool EnableFixedIntegerPolishing
Gets or sets whether a solver candidate rejected only after numerical normalization may be recovered ...
string ExportModelPath
Gets or sets an optional path receiving the exact LP model submitted to the selected solver.
double FeasibilityTolerance
Gets or sets the feasibility tolerance used by the independent solution checker.
Normalizes raw mathematical-variable values returned by optimization solvers before independent valid...
const double DefaultIntegralityTolerance
Historical public default absolute tolerance used for integer-domain variables.
const double DefaultNearIntegerTolerance
Default absolute tolerance used to clean continuous values that are numerically indistinguishable fro...
const double DefaultZeroTolerance
Default absolute tolerance used to identify numerical zero.
SolverKind
Identifies a mathematical optimization solver that can be used by solver-backed ULS algorithms.
Definition SolverKind.cs:15