WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
SolverConfig.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 sleipnir {
11
12/**
13 * Solver configuration.
14 */
16 /// The solver will stop once the error is below this tolerance.
17 double tolerance = 1e-8;
18
19 /// The maximum number of solver iterations before returning a solution.
20 int maxIterations = 5000;
21
22 /// The solver will stop once the error is below this tolerance for
23 /// `acceptableIterations` iterations. This is useful in cases where the
24 /// solver might not be able to achieve the desired level of accuracy due to
25 /// floating-point round-off.
26 double acceptableTolerance = 1e-6;
27
28 /// The solver will stop once the error is below `acceptableTolerance` for
29 /// this many iterations.
30 int maxAcceptableIterations = 15;
31
32 /// The maximum elapsed wall clock time before returning a solution.
33 std::chrono::duration<double> timeout{
34 std::numeric_limits<double>::infinity()};
35
36 /// Enables the feasible interior-point method. When the inequality
37 /// constraints are all feasible, step sizes are reduced when necessary to
38 /// prevent them becoming infeasible again. This is useful when parts of the
39 /// problem are ill-conditioned in infeasible regions (e.g., square root of a
40 /// negative value). This can slow or prevent progress toward a solution
41 /// though, so only enable it if necessary.
42 bool feasibleIPM = false;
43
44 /// Enables diagnostic prints.
45 bool diagnostics = false;
46
47 /// Enables writing sparsity patterns of H, Aₑ, and Aᵢ to files named H.spy,
48 /// A_e.spy, and A_i.spy respectively during solve.
49 ///
50 /// Use tools/spy.py to plot them.
51 bool spy = false;
52};
53
54} // namespace sleipnir
#define SLEIPNIR_DLLEXPORT
Definition SymbolExports.hpp:34
Definition Hessian.hpp:18
Solver configuration.
Definition SolverConfig.hpp:15