soplex_rs/
param.rs

1/// Represents the boolean parameters for some LP solver.
2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3pub enum BoolParam {
4    /// Should lifting be used to reduce range of nonzero matrix coefficients?
5    Lifting = 0,
6    /// Should LP be transformed to equality form before a rational solve?
7    EqTrans = 1,
8    /// Should dual infeasibility be tested in order to try to return a dual solution even if primal infeasible?
9    TestDualInf = 2,
10    /// Should a rational factorization be performed after iterative refinement?
11    RatFac = 3,
12    /// Should the decomposition based dual simplex be used to solve the LP?
13    /// Setting this to true forces the solve mode to SOLVEMODE_REAL and the basis representation to REPRESENTATION_ROW
14    UseDecompDualSimplex = 4,
15    /// Should the degeneracy be computed for each basis?
16    ComputeDegen = 5,
17    /// Should the dual of the complementary problem be used in the decomposition simplex?
18    UseCompDual = 6,
19    /// Should row and bound violations be computed explicitly in the update of reduced problem in the decomposition simplex
20    ExplicitViol = 7,
21    /// Should cycling solutions be accepted during iterative refinement?
22    AcceptCycling = 8,
23    /// Apply rational reconstruction after each iterative refinement?
24    RatRec = 9,
25    /// Round scaling factors for iterative refinement to powers of two?
26    PowerScaling = 10,
27    /// Continue iterative refinement with exact basic solution if not optimal?
28    RatFacJump = 11,
29    /// Use bound flipping also for row representation?
30    RowBoundFlips = 12,
31    /// Use persistent scaling?
32    PersistentScaling = 13,
33    /// Perturb the entire problem or only the relevant bounds of a single pivot?
34    FullPerturbation = 14,
35    /// Re-optimize the original problem to get a proof (ray) of infeasibility/unboundedness?
36    EnsureRay = 15,
37    /// Try to enforce that the optimal solution is a basic solution
38    ForceBasic = 16,
39    /// Enable presolver SingletonCols in PaPILO?
40    SimplifierSingletonCols = 17,
41    /// Enable presolver ConstraintPropagation in PaPILO?
42    SimplifierConstraintPropagation = 18,
43    /// Enable presolver ParallelRowDetection in PaPILO?
44    SimplifierParallelRowDetection = 19,
45    /// Enable presolver ParallelColDetection in PaPILO?
46    SimplifierParallelColDetection = 20,
47    /// Enable presolver SingletonStuffing in PaPILO?
48    SimplifierSingletonStuffing = 21,
49    /// Enable presolver DualFix in PaPILO?
50    SimplifierDualFix = 22,
51    /// Enable presolver FixContinuous in PaPILO?
52    SimplifierFixContinuous = 23,
53    /// Enable presolver DominatedCols in PaPILO?
54    SimplifierDominatedCols = 24,
55}
56
57pub(crate) const OBJSENSE_PARAM_ID: i32 = 0;
58pub(crate) const REPR_PARAM_ID: i32 = 1;
59pub(crate) const ALGORITHM_PARAM_ID: i32 = 2;
60pub(crate) const FACTOR_UPDATE_TYPE_PARAM_ID: i32 = 3;
61pub(crate) const VERBOSITY_PARAM_ID: i32 = 9;
62pub(crate) const SIMPLIFIER_PARAM_ID: i32 = 10;
63pub(crate) const SCALAR_PARAM_ID: i32 = 11;
64pub(crate) const STARTER_PARAM_ID: i32 = 12;
65pub(crate) const PRICER_PARAM_ID: i32 = 13;
66pub(crate) const RATIO_TESTER_PARAM_ID: i32 = 14;
67pub(crate) const SYNC_MODE_PARAM_ID: i32 = 15;
68pub(crate) const READ_MODE_PARAM_ID: i32 = 16;
69pub(crate) const SOLVE_MODE_PARAM_ID: i32 = 17;
70pub(crate) const CHECK_MODE_PARAM_ID: i32 = 18;
71pub(crate) const TIMER_PARAM_ID: i32 = 19;
72pub(crate) const HYPER_PRICING_PARAM_ID: i32 = 20;
73pub(crate) const SOLUTION_POLISHING_PARAM_ID: i32 = 23;
74pub(crate) const DECOMP_VERBOSITY_PARAM_ID: i32 = 27;
75pub(crate) const STAT_TIMER_PARAM_ID: i32 = 29;
76
77/// Enum representing the objective sense for optimization.
78#[derive(Debug, Clone, Copy, PartialEq, Eq)]
79pub enum ObjSense {
80    /// Minimize the objective function.
81    Minimize = -1,
82    /// Maximize the objective function.
83    Maximize = 1,
84}
85
86/// Enum representing the type of representation.
87#[derive(Debug, Clone, Copy, PartialEq, Eq)]
88pub enum Representation {
89    /// Automatically determine the representation type.
90    Auto = 0,
91    /// Column-based representation.
92    Column = 1,
93    /// Row-based representation.
94    Row = 2,
95}
96
97/// Enum representing the type of algorithm used.
98#[derive(Debug, Clone, Copy, PartialEq, Eq)]
99pub enum Algorithm {
100    /// Primal algorithm.
101    Primal = 0,
102    /// Dual algorithm.
103    Dual = 1,
104}
105
106/// Enum representing the factor update type.
107#[derive(Debug, Clone, Copy, PartialEq, Eq)]
108pub enum FactorUpdateType {
109    /// ETA update type.
110    Eta = 0,
111    /// FT update type.
112    Ft = 1,
113}
114
115/// Enum representing verbosity levels.
116#[derive(Debug, Clone, Copy, PartialEq, Eq)]
117pub enum Verbosity {
118    /// Only show errors.
119    Error = 0,
120    /// Show warnings and errors.
121    Warning = 1,
122    /// Show debug information.
123    Debug = 2,
124    /// Show normal information.
125    Normal = 3,
126    /// Show high-level information.
127    High = 4,
128    /// Show full details.
129    Full = 5,
130}
131
132/// Enum representing the simplifier type.
133#[derive(Debug, Clone, Copy, PartialEq, Eq)]
134pub enum Simplifier {
135    /// Simplification is turned off.
136    Off = 0,
137    /// Use internal simplifier.
138    Internal = 3,
139    /// Use Papilo simplifier.
140    Papilo = 2,
141    /// Automatically choose the simplifier.
142    Auto = 1,
143}
144
145/// Enum representing the scalar type.
146#[derive(Debug, Clone, Copy, PartialEq, Eq)]
147pub enum Scalar {
148    /// Scalar operation is turned off.
149    Off = 0,
150    /// Use uniequi scalar.
151    Uniequi = 1,
152    /// Use biequi scalar.
153    Biequi = 2,
154    /// GE01 scalar.
155    Ge01 = 3,
156    /// GE08 scalar.
157    Ge08 = 4,
158    /// Least squares scalar.
159    Leastsq = 5,
160    /// Geometric equivalence scalar.
161    Geoequi = 6,
162}
163
164/// Enum representing the starter type.
165#[derive(Debug, Clone, Copy, PartialEq, Eq)]
166pub enum Starter {
167    /// Starter is turned off.
168    Off = 0,
169    /// Use weight-based starter.
170    Weight = 1,
171    /// Use sum-based starter.
172    Sum = 2,
173    /// Use vector-based starter.
174    Vector = 3,
175}
176
177/// Enum representing the pricer type.
178#[derive(Debug, Clone, Copy, PartialEq, Eq)]
179pub enum Pricer {
180    /// Automatically choose the pricer.
181    Auto = 0,
182    /// Use Dantzig pricer.
183    Dantzig = 1,
184    /// Use parallel multiple pricer.
185    Parmult = 2,
186    /// Use Devex pricer.
187    Devex = 3,
188    /// Use quick steepest edge pricer.
189    Quicksteep = 4,
190    /// Use steepest edge pricer.
191    Steep = 5,
192}
193
194/// Enum representing the ratio tester type.
195#[derive(Debug, Clone, Copy, PartialEq, Eq)]
196pub enum RatioTester {
197    /// Use textbook ratio test.
198    Textbook = 0,
199    /// Use Harris ratio test.
200    Harris = 1,
201    /// Use fast ratio test.
202    Fast = 2,
203    /// Use bound flipping ratio test.
204    Boundflipping = 3,
205}
206
207/// Enum representing the synchronization mode.
208#[derive(Debug, Clone, Copy, PartialEq, Eq)]
209
210pub enum SyncMode {
211    /// Only sync real values.
212    Onlyreal = 0,
213    /// Automatically sync.
214    Auto = 1,
215    /// Manually sync.
216    Manual = 2,
217}
218
219/// Enum representing the read mode.
220#[derive(Debug, Clone, Copy, PartialEq, Eq)]
221pub enum ReadMode {
222    /// Read real values.
223    Real = 0,
224    /// Read rational values.
225    Rational = 1,
226}
227
228/// Enum representing the solve mode.
229#[derive(Debug, Clone, Copy, PartialEq, Eq)]
230
231pub enum SolveMode {
232    /// Solve with real values.
233    Real = 0,
234    /// Automatically determine the solve mode.
235    Auto = 1,
236    /// Solve with rational values.
237    Rational = 2,
238}
239
240/// Enum representing the check mode.
241#[derive(Debug, Clone, Copy, PartialEq, Eq)]
242
243pub enum CheckMode {
244    /// Check real values.
245    Real = 0,
246    /// Automatically determine the check mode.
247    Auto = 1,
248    /// Check rational values.
249    Rational = 2,
250}
251
252/// Enum representing the timer type.
253#[derive(Debug, Clone, Copy, PartialEq, Eq)]
254
255pub enum Timer {
256    /// Timer is turned off.
257    Off = 0,
258    /// Use CPU timer.
259    Cpu = 1,
260    /// Use wall clock timer.
261    Wallclock = 2,
262}
263
264/// Enum representing the hyperpricing mode.
265#[derive(Debug, Clone, Copy, PartialEq, Eq)]
266
267pub enum HyperPricing {
268    /// Hyperpricing is turned off.
269    Off = 0,
270    /// Automatically choose hyperpricing.
271    Auto = 1,
272    /// Hyperpricing is turned on.
273    On = 2,
274}
275
276/// Enum representing the solution polishing mode.
277#[derive(Debug, Clone, Copy, PartialEq, Eq)]
278
279pub enum SolutionPolishing {
280    /// Solution polishing is turned off.
281    Off = 0,
282    /// Polishing for integrality.
283    Integrality = 1,
284    /// Polishing for fractionality.
285    Fractionality = 2,
286}
287
288/// Represents the integer parameters for some LP solver.
289#[derive(Debug, Clone, Copy, PartialEq, Eq)]
290pub enum IntParam {
291    /// Maximum number of updates without fresh factorization
292    FactorUpdateMax = 4,
293    /// Iteration limit (-1 if unlimited)
294    IterLimit = 5,
295    /// Refinement limit (-1 if unlimited)
296    RefLimit = 6,
297    /// Stalling refinement limit (-1 if unlimited)
298    StallRefLimit = 7,
299    /// Display frequency
300    DisplayFreq = 8,
301    /// Minimum number of stalling refinements since last pivot to trigger rational factorization
302    RatFacMinStalls = 21,
303    /// Maximum number of conjugate gradient iterations in least square scaling
304    LeastSqMaxRounds = 22,
305    /// Number of iterations before the decomposition simplex initialization is terminated
306    DecompIterLimit = 24,
307    /// Maximum number of rows added in each iteration of the decomposition based simplex
308    DecompMaxAddedRows = 25,
309    /// Iteration frequency at which the decomposition solve output is displayed
310    DecompDisplayFreq = 26,
311    /// Print condition number during the solve
312    PrintBasisMetric = 28,
313}
314
315/// Represents the real number parameters for some LP solver.
316#[derive(Debug, Clone, Copy, PartialEq, Eq)]
317pub enum RealParam {
318    /// Primal feasibility tolerance
319    FeasTol = 0,
320    /// Dual feasibility tolerance
321    OptTol = 1,
322    /// General zero tolerance
323    EpsilonZero = 2,
324    /// Zero tolerance used in factorization
325    EpsilonFactorization = 3,
326    /// Zero tolerance used in update of the factorization
327    EpsilonUpdate = 4,
328    /// Pivot zero tolerance used in factorization
329    EpsilonPivot = 5,
330    /// Infinity threshold
331    Infty = 6,
332    /// Time limit in seconds (INFTY if unlimited)
333    TimeLimit = 7,
334    /// Lower limit on objective value
335    ObjLimitLower = 8,
336    /// Upper limit on objective value
337    ObjLimitUpper = 9,
338    /// Working tolerance for feasibility in floating-point solver during iterative refinement
339    FpFeasTol = 10,
340    /// Working tolerance for optimality in floating-point solver during iterative refinement
341    FpOptTol = 11,
342    /// Maximum increase of scaling factors between refinements
343    MaxScaleIncr = 12,
344    /// Lower threshold in lifting (nonzero matrix coefficients with smaller absolute value will be reformulated)
345    LiftMinVal = 13,
346    /// Upper threshold in lifting (nonzero matrix coefficients with larger absolute value will be reformulated)
347    LiftMaxVal = 14,
348    /// Sparse pricing threshold (#violations < dimension * SPARSITY_THRESHOLD activates sparse pricing)
349    SparsityThreshold = 15,
350    /// Threshold on number of rows vs. number of columns for switching from column to row representations in auto mode
351    RepresentationSwitch = 16,
352    /// Geometric frequency at which to apply rational reconstruction
353    RatRecFreq = 17,
354    /// Minimal reduction (sum of removed rows/cols) to continue simplification
355    MinRed = 18,
356    /// Refactor threshold for nonzeros in last factorized basis matrix compared to updated basis matrix
357    RefacBasisNnz = 19,
358    /// Refactor threshold for fill-in in current factor update compared to fill-in in last factorization
359    RefacUpdateFill = 20,
360    /// Refactor threshold for memory growth in factorization since last refactorization
361    RefacMemFactor = 21,
362    /// Accuracy of conjugate gradient method in least squares scaling (higher value leads to more iterations)
363    LeastSqAcrcy = 22,
364    /// Objective offset
365    ObjOffset = 23,
366    /// Minimal Markowitz threshold to control sparsity/stability in LU factorization
367    MinMarkowitz = 24,
368    /// Minimal modification threshold to apply presolve reductions
369    SimplifierModifyRowFac = 25,
370}
371
372macro_rules! impl_from_int_param {
373    ($($param:ident),*) => {
374        $(
375            impl From<$param> for i32 {
376                fn from(param: $param) -> i32 {
377                    param as i32
378                }
379            }
380        )*
381    };
382}
383
384impl From<i32> for ObjSense {
385    fn from(value: i32) -> Self {
386        match value {
387            -1 => ObjSense::Minimize,
388            1 => ObjSense::Maximize,
389            _ => panic!("Invalid value for ObjSense: {}", value),
390        }
391    }
392}
393
394impl_from_int_param!(
395    BoolParam,
396    IntParam,
397    RealParam,
398    ObjSense,
399    Representation,
400    Algorithm,
401    FactorUpdateType,
402    Verbosity,
403    Simplifier,
404    Scalar,
405    Starter,
406    Pricer,
407    RatioTester,
408    SyncMode,
409    SolveMode,
410    CheckMode,
411    Timer,
412    HyperPricing,
413    SolutionPolishing,
414    ReadMode
415);