WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
options.hpp
Go to the documentation of this file.
1// Copyright (c) Sleipnir contributors
2
3#pragma once
4
5#include <chrono>
6#include <limits>
7
9
10namespace slp {
11
12/// Solver options.
14 /// The solver will stop once the error is below this tolerance.
15 double tolerance = 1e-8;
16
17 /// The maximum number of solver iterations before returning a solution.
18 int max_iterations = 5000;
19
20 /// The maximum elapsed wall clock time before returning a solution.
21 std::chrono::duration<double> timeout{
22 std::numeric_limits<double>::infinity()};
23
24 /// Enables the feasible interior-point method. When the inequality
25 /// constraints are all feasible, step sizes are reduced when necessary to
26 /// prevent them becoming infeasible again. This is useful when parts of the
27 /// problem are ill-conditioned in infeasible regions (e.g., square root of a
28 /// negative value). This can slow or prevent progress toward a solution
29 /// though, so only enable it if necessary.
30 bool feasible_ipm = false;
31
32 /// Enables diagnostic prints.
33 ///
34 /// <table>
35 /// <tr>
36 /// <th>Heading</th>
37 /// <th>Description</th>
38 /// </tr>
39 /// <tr>
40 /// <td>iter</td>
41 /// <td>Iteration number</td>
42 /// </tr>
43 /// <tr>
44 /// <td>type</td>
45 /// <td>Iteration type (normal, accepted second-order correction, rejected
46 /// second-order correction)</td>
47 /// </tr>
48 /// <tr>
49 /// <td>time (ms)</td>
50 /// <td>Duration of iteration in milliseconds</td>
51 /// </tr>
52 /// <tr>
53 /// <td>error</td>
54 /// <td>Error estimate</td>
55 /// </tr>
56 /// <tr>
57 /// <td>cost</td>
58 /// <td>Cost function value at current iterate</td>
59 /// </tr>
60 /// <tr>
61 /// <td>infeas.</td>
62 /// <td>Constraint infeasibility at current iterate</td>
63 /// </tr>
64 /// <tr>
65 /// <td>complement.</td>
66 /// <td>Complementary slackness at current iterate (sᵀz)</td>
67 /// </tr>
68 /// <tr>
69 /// <td>μ</td>
70 /// <td>Barrier parameter</td>
71 /// </tr>
72 /// <tr>
73 /// <td>reg</td>
74 /// <td>Iteration matrix regularization</td>
75 /// </tr>
76 /// <tr>
77 /// <td>primal α</td>
78 /// <td>Primal step size</td>
79 /// </tr>
80 /// <tr>
81 /// <td>dual α</td>
82 /// <td>Dual step size</td>
83 /// </tr>
84 /// <tr>
85 /// <td>↩</td>
86 /// <td>Number of line search backtracks</td>
87 /// </tr>
88 /// </table>
89 bool diagnostics = false;
90};
91
92} // namespace slp
Definition expression_graph.hpp:11
Solver options.
Definition options.hpp:13
int max_iterations
The maximum number of solver iterations before returning a solution.
Definition options.hpp:18
double tolerance
The solver will stop once the error is below this tolerance.
Definition options.hpp:15
bool diagnostics
Enables diagnostic prints.
Definition options.hpp:89
bool feasible_ipm
Enables the feasible interior-point method.
Definition options.hpp:30
std::chrono::duration< double > timeout
The maximum elapsed wall clock time before returning a solution.
Definition options.hpp:21
#define SLEIPNIR_DLLEXPORT
Definition symbol_exports.hpp:34