![]() |
WPILibC++ 2027.0.0-alpha-4
|
Namespaces | |
| namespace | detail |
| namespace | slicing |
Classes | |
| class | scope_exit |
| scope_exit is a general-purpose scope guard intended to call its exit function when a scope is exited. More... | |
| class | IntrusiveSharedPtr |
| A custom intrusive shared pointer implementation without thread synchronization overhead. More... | |
| class | OCP |
| This class allows the user to pose and solve a constrained optimal control problem (OCP) in a variety of ways. More... | |
| class | VariableBlock |
| A submatrix of autodiff variables with reference semantics. More... | |
| class | VariableMatrix |
| A matrix of autodiff variables. More... | |
| class | Gradient |
| This class calculates the gradient of a variable with respect to a vector of variables. More... | |
| struct | InteriorPointMatrixCallbacks |
| Matrix callbacks for the interior-point method solver. More... | |
| struct | FilterEntry |
| Filter entry consisting of cost and constraint violation. More... | |
| class | Filter |
| Step filter. More... | |
| class | Jacobian |
| This class calculates the Jacobian of a vector of variables with respect to a vector of variables. More... | |
| class | RegularizedLDLT |
| Solves systems of linear equations using a regularized LDLT factorization. More... | |
| class | SetupProfiler |
| Records the number of profiler measurements (start/stop pairs) and the average duration between each start and stop call. More... | |
| class | Problem |
| This class allows the user to pose a constrained nonlinear optimization problem in natural mathematical notation and solve it. More... | |
| class | Inertia |
| Represents the inertia of a matrix (the number of positive, negative, and zero eigenvalues). More... | |
| struct | Options |
| Solver options. More... | |
| class | function_ref |
| class | function_ref< R(Args...)> |
| An implementation of std::function_ref, a lightweight non-owning reference to a callable. More... | |
| struct | IterationInfo |
| Solver iteration information exposed to an iteration callback. More... | |
| class | Hessian |
| This class calculates the Hessian of a variable with respect to a vector of variables. More... | |
| class | Variable |
| An autodiff variable pointing to an expression node. More... | |
| struct | EqualityConstraints |
| A vector of equality constraints of the form cₑ(x) = 0. More... | |
| struct | InequalityConstraints |
| A vector of inequality constraints of the form cᵢ(x) ≥ 0. More... | |
| class | Slice |
| Represents a sequence of elements in an iterable object. More... | |
| class | Spy |
| Writes the sparsity pattern of a sparse matrix to a file. More... | |
| struct | Bounds |
| Bound constraint metadata. More... | |
| class | PoolResource |
| This class implements a pool memory resource. More... | |
| class | PoolAllocator |
| This class is an allocator for the pool resource. More... | |
| class | SleipnirBase |
| Marker interface for concepts to determine whether a given scalar or matrix type belongs to Sleipnir. More... | |
| struct | NewtonMatrixCallbacks |
| Matrix callbacks for the Newton's method solver. More... | |
| struct | SQPMatrixCallbacks |
| Matrix callbacks for the Sequential Quadratic Programming (SQP) solver. More... | |
| class | ScopedProfiler |
| Starts a profiler in the constructor and stops it in the destructor. More... | |
| struct | MultistartResult |
| The result of a multistart solve. More... | |
| class | SolveProfiler |
| Records the number of profiler measurements (start/stop pairs) and the average duration between each start and stop call. More... | |
Concepts | |
| concept | SleipnirType |
| concept | MatrixLike |
| concept | ScalarLike |
| concept | EigenMatrixLike |
| concept | SleipnirMatrixLike |
| concept | SleipnirScalarLike |
Enumerations | |
| enum class | TimestepMethod : uint8_t { FIXED , VARIABLE , VARIABLE_SINGLE } |
| Enum describing the type of system timestep. More... | |
| enum class | TranscriptionMethod : uint8_t { DIRECT_TRANSCRIPTION , DIRECT_COLLOCATION , SINGLE_SHOOTING } |
| Enum describing an OCP transcription method. More... | |
| enum class | DynamicsType : uint8_t { EXPLICIT_ODE , DISCRETE } |
| Enum describing a type of system dynamics constraints. More... | |
| enum class | ExitStatus : int8_t { SUCCESS = 0 , CALLBACK_REQUESTED_STOP = 1 , TOO_FEW_DOFS = -1 , LOCALLY_INFEASIBLE = -2 , GLOBALLY_INFEASIBLE = -3 , FACTORIZATION_FAILED = -4 , LINE_SEARCH_FAILED = -5 , NONFINITE_INITIAL_COST_OR_CONSTRAINTS = -6 , DIVERGING_ITERATES = -7 , MAX_ITERATIONS_EXCEEDED = -8 , TIMEOUT = -9 } |
| Solver exit status. Negative values indicate failure. More... | |
| enum class | ExpressionType : uint8_t { NONE , CONSTANT , LINEAR , QUADRATIC , NONLINEAR } |
| Expression type. More... | |
| enum class | IterationType : uint8_t { NORMAL , ACCEPTED_SOC , REJECTED_SOC } |
| Iteration type. More... | |
Functions | |
| template<typename T, typename... Args> | |
| IntrusiveSharedPtr< T > | make_intrusive_shared (Args &&... args) |
| Constructs an object of type T and wraps it in an intrusive shared pointer using args as the parameter list for the constructor of T. | |
| template<typename T, typename Alloc, typename... Args> | |
| IntrusiveSharedPtr< T > | allocate_intrusive_shared (Alloc alloc, Args &&... args) |
| Constructs an object of type T and wraps it in an intrusive shared pointer using alloc as the storage allocator of T and args as the parameter list for the constructor of T. | |
| template class | EXPORT_TEMPLATE_DECLARE (SLEIPNIR_DLLEXPORT) OCP< double > |
| template<typename Derived> | |
| VariableMatrix (const Eigen::MatrixBase< Derived > &) -> VariableMatrix< typename Derived::Scalar > | |
| template<typename Derived> | |
| VariableMatrix (const Eigen::DiagonalBase< Derived > &) -> VariableMatrix< typename Derived::Scalar > | |
| template<typename Scalar> | |
| VariableMatrix< Scalar > | cwise_reduce (const VariableMatrix< Scalar > &lhs, const VariableMatrix< Scalar > &rhs, function_ref< Variable< Scalar >(const Variable< Scalar > &x, const Variable< Scalar > &y)> binary_op) |
| Applies a coefficient-wise reduce operation to two matrices. | |
| template<typename Scalar> | |
| VariableMatrix< Scalar > | block (std::initializer_list< std::initializer_list< VariableMatrix< Scalar > > > list) |
| Assemble a VariableMatrix from a nested list of blocks. | |
| template<typename Scalar> | |
| VariableMatrix< Scalar > | block (const std::vector< std::vector< VariableMatrix< Scalar > > > &list) |
| Assemble a VariableMatrix from a nested list of blocks. | |
| template<typename Scalar> | |
| VariableMatrix< Scalar > | solve (const VariableMatrix< Scalar > &A, const VariableMatrix< Scalar > &B) |
| Solves the VariableMatrix equation AX = B for X. | |
| template SLEIPNIR_DLLEXPORT VariableMatrix< double > | solve (const VariableMatrix< double > &A, const VariableMatrix< double > &B) |
| template<typename Scalar> | |
| Scalar | fraction_to_the_boundary_rule (const Eigen::Vector< Scalar, Eigen::Dynamic > &x, const Eigen::Vector< Scalar, Eigen::Dynamic > &p, Scalar τ) |
| Applies fraction-to-the-boundary rule to a variable and its iterate, then returns a fraction of the iterate step size within (0, 1]. | |
| template<typename R, typename... Args> | |
| constexpr void | swap (function_ref< R(Args...)> &lhs, function_ref< R(Args...)> &rhs) noexcept |
| Swaps the referred callables of lhs and rhs. | |
| template<typename R, typename... Args> | |
| function_ref (R(*)(Args...)) -> function_ref< R(Args...)> | |
| template<template< typename > typename T, typename Scalar> requires SleipnirMatrixLike<T<Scalar>, Scalar> | |
| Variable (T< Scalar >) -> Variable< Scalar > | |
| template<std::floating_point T> | |
| Variable (T) -> Variable< T > | |
| template<std::integral T> | |
| Variable (T) -> Variable< T > | |
| template<typename Scalar> | |
| Variable< Scalar > | abs (const Variable< Scalar > &x) |
| abs() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | acos (const Variable< Scalar > &x) |
| acos() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | asin (const Variable< Scalar > &x) |
| asin() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | atan (const Variable< Scalar > &x) |
| atan() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | atan2 (const ScalarLike auto &y, const Variable< Scalar > &x) |
| atan2() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | atan2 (const Variable< Scalar > &y, const ScalarLike auto &x) |
| atan2() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | atan2 (const Variable< Scalar > &y, const Variable< Scalar > &x) |
| atan2() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | cbrt (const Variable< Scalar > &x) |
| cbrt() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | cos (const Variable< Scalar > &x) |
| cos() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | cosh (const Variable< Scalar > &x) |
| cosh() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | erf (const Variable< Scalar > &x) |
| erf() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | exp (const Variable< Scalar > &x) |
| exp() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | hypot (const ScalarLike auto &x, const Variable< Scalar > &y) |
| hypot() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | hypot (const Variable< Scalar > &x, const ScalarLike auto &y) |
| hypot() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | hypot (const Variable< Scalar > &x, const Variable< Scalar > &y) |
| hypot() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | log (const Variable< Scalar > &x) |
| log() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | log10 (const Variable< Scalar > &x) |
| log10() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | pow (const ScalarLike auto &base, const Variable< Scalar > &power) |
| pow() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | pow (const Variable< Scalar > &base, const ScalarLike auto &power) |
| pow() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | pow (const Variable< Scalar > &base, const Variable< Scalar > &power) |
| pow() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | sign (const Variable< Scalar > &x) |
| sign() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | sin (const Variable< Scalar > &x) |
| sin() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | sinh (const Variable< Scalar > &x) |
| sinh() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | sqrt (const Variable< Scalar > &x) |
| sqrt() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | tan (const Variable< Scalar > &x) |
| tan() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | tanh (const Variable< Scalar > &x) |
| tanh() for Variables. | |
| template<typename Scalar> | |
| Variable< Scalar > | hypot (const Variable< Scalar > &x, const Variable< Scalar > &y, const Variable< Scalar > &z) |
| hypot() for Variables. | |
| template<typename Scalar, ScalarLike LHS, ScalarLike RHS> requires SleipnirScalarLike<LHS, Scalar> || SleipnirScalarLike<RHS, Scalar> | |
| auto | make_constraints (LHS &&lhs, RHS &&rhs) |
| template<typename Scalar, ScalarLike LHS, MatrixLike RHS> requires SleipnirScalarLike<LHS, Scalar> || SleipnirMatrixLike<RHS, Scalar> | |
| auto | make_constraints (LHS &&lhs, RHS &&rhs) |
| template<typename Scalar, MatrixLike LHS, ScalarLike RHS> requires SleipnirMatrixLike<LHS, Scalar> || SleipnirScalarLike<RHS, Scalar> | |
| auto | make_constraints (LHS &&lhs, RHS &&rhs) |
| template<typename Scalar, MatrixLike LHS, MatrixLike RHS> requires SleipnirMatrixLike<LHS, Scalar> || SleipnirMatrixLike<RHS, Scalar> | |
| auto | make_constraints (LHS &&lhs, RHS &&rhs) |
| template<typename LHS, typename RHS> requires (ScalarLike<LHS> || MatrixLike<LHS>) && SleipnirType<LHS> && (ScalarLike<RHS> || MatrixLike<RHS>) && (!SleipnirType<RHS>) | |
| auto | operator== (LHS &&lhs, RHS &&rhs) |
| Equality operator that returns an equality constraint for two Variables. | |
| template<typename LHS, typename RHS> requires (ScalarLike<LHS> || MatrixLike<LHS>) && (!SleipnirType<LHS>) && (ScalarLike<RHS> || MatrixLike<RHS>) && SleipnirType<RHS> | |
| auto | operator== (LHS &&lhs, RHS &&rhs) |
| Equality operator that returns an equality constraint for two Variables. | |
| template<typename LHS, typename RHS> requires (ScalarLike<LHS> || MatrixLike<LHS>) && SleipnirType<LHS> && (ScalarLike<RHS> || MatrixLike<RHS>) && SleipnirType<RHS> | |
| auto | operator== (LHS &&lhs, RHS &&rhs) |
| Equality operator that returns an equality constraint for two Variables. | |
| template<typename LHS, typename RHS> requires (ScalarLike<LHS> || MatrixLike<LHS>) && (ScalarLike<RHS> || MatrixLike<RHS>) && (SleipnirType<LHS> || SleipnirType<RHS>) | |
| auto | operator< (LHS &&lhs, RHS &&rhs) |
| Less-than comparison operator that returns an inequality constraint for two Variables. | |
| template<typename LHS, typename RHS> requires (ScalarLike<LHS> || MatrixLike<LHS>) && (ScalarLike<RHS> || MatrixLike<RHS>) && (SleipnirType<LHS> || SleipnirType<RHS>) | |
| auto | operator<= (LHS &&lhs, RHS &&rhs) |
| Less-than-or-equal-to comparison operator that returns an inequality constraint for two Variables. | |
| template<typename LHS, typename RHS> requires (ScalarLike<LHS> || MatrixLike<LHS>) && (ScalarLike<RHS> || MatrixLike<RHS>) && (SleipnirType<LHS> || SleipnirType<RHS>) | |
| auto | operator> (LHS &&lhs, RHS &&rhs) |
| Greater-than comparison operator that returns an inequality constraint for two Variables. | |
| template<typename LHS, typename RHS> requires (ScalarLike<LHS> || MatrixLike<LHS>) && SleipnirType<LHS> && (ScalarLike<RHS> || MatrixLike<RHS>) && (!SleipnirType<RHS>) | |
| auto | operator>= (LHS &&lhs, RHS &&rhs) |
| Greater-than-or-equal-to comparison operator that returns an inequality constraint for two Variables. | |
| template<typename LHS, typename RHS> requires (ScalarLike<LHS> || MatrixLike<LHS>) && (!SleipnirType<LHS>) && (ScalarLike<RHS> || MatrixLike<RHS>) && SleipnirType<RHS> | |
| auto | operator>= (LHS &&lhs, RHS &&rhs) |
| Greater-than-or-equal-to comparison operator that returns an inequality constraint for two Variables. | |
| template<typename LHS, typename RHS> requires (ScalarLike<LHS> || MatrixLike<LHS>) && SleipnirType<LHS> && (ScalarLike<RHS> || MatrixLike<RHS>) && SleipnirType<RHS> | |
| auto | operator>= (LHS &&lhs, RHS &&rhs) |
| Greater-than-or-equal-to comparison operator that returns an inequality constraint for two Variables. | |
| template<typename L, typename X, typename U> requires (ScalarLike<L> || MatrixLike<L>) && SleipnirType<X> && (ScalarLike<U> || MatrixLike<U>) | |
| auto | bounds (L &&l, X &&x, U &&u) |
| Helper function for creating bound constraints. | |
| template<typename Scalar> | |
| Bounds< Scalar > | get_bounds (std::span< Variable< Scalar > > decision_variables, std::span< Variable< Scalar > > inequality_constraints, const Eigen::SparseMatrix< Scalar, Eigen::RowMajor > &A_i) |
| A "bound constraint" is any linear constraint in one scalar variable. | |
| template<typename Derived> requires (static_cast<bool>(Eigen::DenseBase<Derived>::IsVectorAtCompileTime)) | |
| void | project_onto_bounds (Eigen::DenseBase< Derived > &x, std::span< const std::pair< typename Eigen::DenseBase< Derived >::Scalar, typename Eigen::DenseBase< Derived >::Scalar > > decision_variable_indices_to_bounds, const typename Eigen::DenseBase< Derived >::Scalar κ_1=typename Eigen::DenseBase< Derived >::Scalar(1e-2), const typename Eigen::DenseBase< Derived >::Scalar κ_2=typename Eigen::DenseBase< Derived >::Scalar(1e-2)) |
| Projects the decision variables onto the given bounds, while ensuring some configurable distance from the boundary if possible. | |
| SLEIPNIR_DLLEXPORT PoolResource & | global_pool_resource () |
| Returns a global pool memory resource. | |
| template<typename T> | |
| PoolAllocator< T > | global_pool_allocator () |
| Returns an allocator for a global pool memory resource. | |
| template<typename Scalar> | |
| Scalar | error_estimate (const Eigen::Vector< Scalar, Eigen::Dynamic > &g) |
| Returns the error estimate using the KKT conditions for Newton's method. | |
| template<typename Scalar> | |
| Scalar | error_estimate (const Eigen::Vector< Scalar, Eigen::Dynamic > &g, const Eigen::SparseMatrix< Scalar > &A_e, const Eigen::Vector< Scalar, Eigen::Dynamic > &c_e, const Eigen::Vector< Scalar, Eigen::Dynamic > &y) |
| Returns the error estimate using the KKT conditions for SQP. | |
| template<typename Scalar> | |
| Scalar | error_estimate (const Eigen::Vector< Scalar, Eigen::Dynamic > &g, const Eigen::SparseMatrix< Scalar > &A_e, const Eigen::Vector< Scalar, Eigen::Dynamic > &c_e, const Eigen::SparseMatrix< Scalar > &A_i, const Eigen::Vector< Scalar, Eigen::Dynamic > &c_i, const Eigen::Vector< Scalar, Eigen::Dynamic > &s, const Eigen::Vector< Scalar, Eigen::Dynamic > &y, const Eigen::Vector< Scalar, Eigen::Dynamic > &z, Scalar μ) |
| Returns the error estimate using the KKT conditions for the interior-point method. | |
| void | unreachable () |
| template<typename... T> | |
| void | print (fmt::format_string< T... > fmt, T &&... args) |
| Wrapper around fmt::print() that squelches write failure exceptions. | |
| template<typename... T> | |
| void | print (std::FILE *f, fmt::format_string< T... > fmt, T &&... args) |
| Wrapper around fmt::print() that squelches write failure exceptions. | |
| template<typename... T> | |
| void | println (fmt::format_string< T... > fmt, T &&... args) |
| Wrapper around fmt::println() that squelches write failure exceptions. | |
| template<typename... T> | |
| void | println (std::FILE *f, fmt::format_string< T... > fmt, T &&... args) |
| Wrapper around fmt::println() that squelches write failure exceptions. | |
| template<typename Scalar> | |
| bool | is_equality_locally_infeasible (const Eigen::SparseMatrix< Scalar > &A_e, const Eigen::Vector< Scalar, Eigen::Dynamic > &c_e) |
| Returns true if the problem's equality constraints are locally infeasible. | |
| template<typename Scalar> | |
| bool | is_inequality_locally_infeasible (const Eigen::SparseMatrix< Scalar > &A_i, const Eigen::Vector< Scalar, Eigen::Dynamic > &c_i) |
| Returns true if the problem's inequality constraints are locally infeasible. | |
| template<typename Scalar, typename DecisionVariables> | |
| MultistartResult< Scalar, DecisionVariables > | multistart (function_ref< MultistartResult< Scalar, DecisionVariables >(const DecisionVariables &initial_guess)> solve, std::span< const DecisionVariables > initial_guesses) |
| Solves an optimization problem from different starting points in parallel, then returns the solution with the lowest cost. | |
| template<typename Scalar> | |
| Scalar | kkt_error (const Eigen::Vector< Scalar, Eigen::Dynamic > &g) |
| Returns the KKT error for Newton's method. | |
| template<typename Scalar> | |
| Scalar | kkt_error (const Eigen::Vector< Scalar, Eigen::Dynamic > &g, const Eigen::SparseMatrix< Scalar > &A_e, const Eigen::Vector< Scalar, Eigen::Dynamic > &c_e, const Eigen::Vector< Scalar, Eigen::Dynamic > &y) |
| Returns the KKT error for Sequential Quadratic Programming. | |
| template<typename Scalar> | |
| Scalar | kkt_error (const Eigen::Vector< Scalar, Eigen::Dynamic > &g, const Eigen::SparseMatrix< Scalar > &A_e, const Eigen::Vector< Scalar, Eigen::Dynamic > &c_e, const Eigen::SparseMatrix< Scalar > &A_i, const Eigen::Vector< Scalar, Eigen::Dynamic > &c_i, const Eigen::Vector< Scalar, Eigen::Dynamic > &s, const Eigen::Vector< Scalar, Eigen::Dynamic > &y, const Eigen::Vector< Scalar, Eigen::Dynamic > &z, Scalar μ) |
| Returns the KKT error for the interior-point method. | |
| template<typename Rep, typename Period = std::ratio<1>> | |
| constexpr double | to_ms (const std::chrono::duration< Rep, Period > &duration) |
| Converts std::chrono::duration to a number of milliseconds rounded to three decimals. | |
| template<typename Scalar> | |
| std::string | power_of_10 (Scalar value) |
| Renders value as power of 10. | |
| template<typename Scalar> | |
| void | print_too_few_dofs_error (const Eigen::Vector< Scalar, Eigen::Dynamic > &c_e) |
| Prints error for too few degrees of freedom. | |
| template<typename Scalar> | |
| void | print_c_e_local_infeasibility_error (const Eigen::Vector< Scalar, Eigen::Dynamic > &c_e) |
| Prints equality constraint local infeasibility error. | |
| template<typename Scalar> | |
| void | print_c_i_local_infeasibility_error (const Eigen::Vector< Scalar, Eigen::Dynamic > &c_i) |
| Prints inequality constraint local infeasibility error. | |
| void | print_bound_constraint_global_infeasibility_error (const std::span< const std::pair< Eigen::Index, Eigen::Index > > conflicting_lower_upper_bound_indices) |
| template<typename Scalar, typename Rep, typename Period = std::ratio<1>> | |
| void | print_iteration_diagnostics (int iterations, IterationType type, const std::chrono::duration< Rep, Period > &time, Scalar error, Scalar cost, Scalar infeasibility, Scalar complementarity, Scalar μ, Scalar δ, Scalar primal_α, Scalar primal_α_max, Scalar α_reduction_factor, Scalar dual_α) |
| Prints diagnostics for the current iteration. | |
| void | print_bottom_iteration_diagnostics () |
| Prints bottom of iteration diagnostics table. | |
| template<int Width> requires (Width > 0) | |
| std::string | histogram (double value) |
| Renders histogram of the given normalized value. | |
| void | print_solver_diagnostics (const gch::small_vector< SolveProfiler > &solve_profilers) |
| Prints solver diagnostics. | |
| void | print_autodiff_diagnostics (const gch::small_vector< SetupProfiler > &setup_profilers) |
| Prints autodiff diagnostics. | |
|
strong |
|
strong |
Solver exit status. Negative values indicate failure.
|
strong |
Expression type.
Used for autodiff caching.
|
strong |
|
strong |
|
strong |
Enum describing an OCP transcription method.
| IntrusiveSharedPtr< T > slp::allocate_intrusive_shared | ( | Alloc | alloc, |
| Args &&... | args ) |
Constructs an object of type T and wraps it in an intrusive shared pointer using alloc as the storage allocator of T and args as the parameter list for the constructor of T.
| T | Type of object for intrusive shared pointer. |
| Alloc | Type of allocator for T. |
| Args | Types of constructor arguments. |
| alloc | The allocator for T. |
| args | Constructor arguments for T. |
| Variable< Scalar > slp::atan2 | ( | const ScalarLike auto & | y, |
| const Variable< Scalar > & | x ) |
atan2() for Variables.
| Scalar | Scalar type. |
| y | The y argument. |
| x | The x argument. |
| Variable< Scalar > slp::atan2 | ( | const Variable< Scalar > & | y, |
| const ScalarLike auto & | x ) |
atan2() for Variables.
| Scalar | Scalar type. |
| y | The y argument. |
| x | The x argument. |
| Variable< Scalar > slp::atan2 | ( | const Variable< Scalar > & | y, |
| const Variable< Scalar > & | x ) |
atan2() for Variables.
| Scalar | Scalar type. |
| y | The y argument. |
| x | The x argument. |
| VariableMatrix< Scalar > slp::block | ( | const std::vector< std::vector< VariableMatrix< Scalar > > > & | list | ) |
Assemble a VariableMatrix from a nested list of blocks.
Each row's blocks must have the same height, and the assembled block rows must have the same width. For example, for the block matrix [[A, B], [C]] to be constructible, the number of rows in A and B must match, and the number of columns in [A, B] and [C] must match.
This overload is for Python bindings only.
| Scalar | Scalar type. |
| list | The nested list of blocks. |
| VariableMatrix< Scalar > slp::block | ( | std::initializer_list< std::initializer_list< VariableMatrix< Scalar > > > | list | ) |
Assemble a VariableMatrix from a nested list of blocks.
Each row's blocks must have the same height, and the assembled block rows must have the same width. For example, for the block matrix [[A, B], [C]] to be constructible, the number of rows in A and B must match, and the number of columns in [A, B] and [C] must match.
| Scalar | Scalar type. |
| list | The nested list of blocks. |
| auto slp::bounds | ( | L && | l, |
| X && | x, | ||
| U && | u ) |
Helper function for creating bound constraints.
| l | Lower bound. |
| x | Variable to bound. |
| u | Upper bound. |
| VariableMatrix< Scalar > slp::cwise_reduce | ( | const VariableMatrix< Scalar > & | lhs, |
| const VariableMatrix< Scalar > & | rhs, | ||
| function_ref< Variable< Scalar >(const Variable< Scalar > &x, const Variable< Scalar > &y)> | binary_op ) |
Applies a coefficient-wise reduce operation to two matrices.
| Scalar | Scalar type. |
| lhs | The left-hand side of the binary operator. |
| rhs | The right-hand side of the binary operator. |
| binary_op | The binary operator to use for the reduce operation. |
| Scalar slp::error_estimate | ( | const Eigen::Vector< Scalar, Eigen::Dynamic > & | g | ) |
Returns the error estimate using the KKT conditions for Newton's method.
| Scalar | Scalar type. |
| g | Gradient of the cost function ∇f. |
| Scalar slp::error_estimate | ( | const Eigen::Vector< Scalar, Eigen::Dynamic > & | g, |
| const Eigen::SparseMatrix< Scalar > & | A_e, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | c_e, | ||
| const Eigen::SparseMatrix< Scalar > & | A_i, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | c_i, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | s, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | y, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | z, | ||
| Scalar | μ ) |
Returns the error estimate using the KKT conditions for the interior-point method.
| Scalar | Scalar type. |
| g | Gradient of the cost function ∇f. |
| A_e | The problem's equality constraint Jacobian Aₑ(x) evaluated at the current iterate. |
| c_e | The problem's equality constraints cₑ(x) evaluated at the current iterate. |
| A_i | The problem's inequality constraint Jacobian Aᵢ(x) evaluated at the current iterate. |
| c_i | The problem's inequality constraints cᵢ(x) evaluated at the current iterate. |
| s | Inequality constraint slack variables. |
| y | Equality constraint dual variables. |
| z | Inequality constraint dual variables. |
| μ | Barrier parameter. |
| Scalar slp::error_estimate | ( | const Eigen::Vector< Scalar, Eigen::Dynamic > & | g, |
| const Eigen::SparseMatrix< Scalar > & | A_e, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | c_e, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | y ) |
Returns the error estimate using the KKT conditions for SQP.
| Scalar | Scalar type. |
|
extern |
| Scalar slp::fraction_to_the_boundary_rule | ( | const Eigen::Vector< Scalar, Eigen::Dynamic > & | x, |
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | p, | ||
| Scalar | τ ) |
Applies fraction-to-the-boundary rule to a variable and its iterate, then returns a fraction of the iterate step size within (0, 1].
| Scalar | Scalar type. |
| x | The variable. |
| p | The iterate on the variable. |
| τ | Fraction-to-the-boundary rule scaling factor within (0, 1]. |
| slp::function_ref | ( | R(* | )(Args...) | ) | ->function_ref< R(Args...)> |
| Bounds< Scalar > slp::get_bounds | ( | std::span< Variable< Scalar > > | decision_variables, |
| std::span< Variable< Scalar > > | inequality_constraints, | ||
| const Eigen::SparseMatrix< Scalar, Eigen::RowMajor > & | A_i ) |
A "bound constraint" is any linear constraint in one scalar variable.
Computes which constraints, if any, are bound constraints, the tightest bounds on each decision variable, and whether or not they're feasible (given previously encountered bounds),
| Scalar | Scalar type. |
| decision_variables | Decision variables corresponding to each column of A_i. |
| inequality_constraints | Variables representing the left-hand side of cᵢ(decision_variables) ≥ 0. |
| A_i | The Jacobian of inequality_constraints wrt decision_variables, evaluated anywhere, in row-major storage; in practice, since we typically store Jacobians column-major, the user of this function must perform a transpose. |
| PoolAllocator< T > slp::global_pool_allocator | ( | ) |
Returns an allocator for a global pool memory resource.
| T | The type of object in the pool. |
| SLEIPNIR_DLLEXPORT PoolResource & slp::global_pool_resource | ( | ) |
Returns a global pool memory resource.
| std::string slp::histogram | ( | double | value | ) |
Renders histogram of the given normalized value.
| Width | Width of the histogram in characters. |
| value | Normalized value from 0 to 1. |
| Variable< Scalar > slp::hypot | ( | const ScalarLike auto & | x, |
| const Variable< Scalar > & | y ) |
hypot() for Variables.
| Scalar | Scalar type. |
| x | The x argument. |
| y | The y argument. |
| Variable< Scalar > slp::hypot | ( | const Variable< Scalar > & | x, |
| const ScalarLike auto & | y ) |
hypot() for Variables.
| Scalar | Scalar type. |
| x | The x argument. |
| y | The y argument. |
| Variable< Scalar > slp::hypot | ( | const Variable< Scalar > & | x, |
| const Variable< Scalar > & | y ) |
hypot() for Variables.
| Scalar | Scalar type. |
| x | The x argument. |
| y | The y argument. |
| Variable< Scalar > slp::hypot | ( | const Variable< Scalar > & | x, |
| const Variable< Scalar > & | y, | ||
| const Variable< Scalar > & | z ) |
hypot() for Variables.
| Scalar | Scalar type. |
| x | The x argument. |
| y | The y argument. |
| z | The z argument. |
| bool slp::is_equality_locally_infeasible | ( | const Eigen::SparseMatrix< Scalar > & | A_e, |
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | c_e ) |
Returns true if the problem's equality constraints are locally infeasible.
| Scalar | Scalar type. |
| A_e | The problem's equality constraint Jacobian Aₑ(x) evaluated at the current iterate. |
| c_e | The problem's equality constraints cₑ(x) evaluated at the current iterate. |
| bool slp::is_inequality_locally_infeasible | ( | const Eigen::SparseMatrix< Scalar > & | A_i, |
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | c_i ) |
Returns true if the problem's inequality constraints are locally infeasible.
| Scalar | Scalar type. |
| A_i | The problem's inequality constraint Jacobian Aᵢ(x) evaluated at the current iterate. |
| c_i | The problem's inequality constraints cᵢ(x) evaluated at the current iterate. |
| Scalar slp::kkt_error | ( | const Eigen::Vector< Scalar, Eigen::Dynamic > & | g | ) |
Returns the KKT error for Newton's method.
| Scalar | Scalar type. |
| g | Gradient of the cost function ∇f. |
| Scalar slp::kkt_error | ( | const Eigen::Vector< Scalar, Eigen::Dynamic > & | g, |
| const Eigen::SparseMatrix< Scalar > & | A_e, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | c_e, | ||
| const Eigen::SparseMatrix< Scalar > & | A_i, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | c_i, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | s, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | y, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | z, | ||
| Scalar | μ ) |
Returns the KKT error for the interior-point method.
| Scalar | Scalar type. |
| g | Gradient of the cost function ∇f. |
| A_e | The problem's equality constraint Jacobian Aₑ(x) evaluated at the current iterate. |
| c_e | The problem's equality constraints cₑ(x) evaluated at the current iterate. |
| A_i | The problem's inequality constraint Jacobian Aᵢ(x) evaluated at the current iterate. |
| c_i | The problem's inequality constraints cᵢ(x) evaluated at the current iterate. |
| s | Inequality constraint slack variables. |
| y | Equality constraint dual variables. |
| z | Inequality constraint dual variables. |
| μ | Barrier parameter. |
| Scalar slp::kkt_error | ( | const Eigen::Vector< Scalar, Eigen::Dynamic > & | g, |
| const Eigen::SparseMatrix< Scalar > & | A_e, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | c_e, | ||
| const Eigen::Vector< Scalar, Eigen::Dynamic > & | y ) |
Returns the KKT error for Sequential Quadratic Programming.
| Scalar | Scalar type. |
| auto slp::make_constraints | ( | LHS && | lhs, |
| RHS && | rhs ) |
| auto slp::make_constraints | ( | LHS && | lhs, |
| RHS && | rhs ) |
| auto slp::make_constraints | ( | LHS && | lhs, |
| RHS && | rhs ) |
| auto slp::make_constraints | ( | LHS && | lhs, |
| RHS && | rhs ) |
| IntrusiveSharedPtr< T > slp::make_intrusive_shared | ( | Args &&... | args | ) |
Constructs an object of type T and wraps it in an intrusive shared pointer using args as the parameter list for the constructor of T.
| T | Type of object for intrusive shared pointer. |
| Args | Types of constructor arguments. |
| args | Constructor arguments for T. |
| MultistartResult< Scalar, DecisionVariables > slp::multistart | ( | function_ref< MultistartResult< Scalar, DecisionVariables >(const DecisionVariables &initial_guess)> | solve, |
| std::span< const DecisionVariables > | initial_guesses ) |
Solves an optimization problem from different starting points in parallel, then returns the solution with the lowest cost.
Each solve is performed on a separate thread. Solutions from successful solves are always preferred over solutions from unsuccessful solves, and cost (lower is better) is the tiebreaker between successful solves.
| Scalar | Scalar type. |
| DecisionVariables | The type containing the decision variable initial guess. |
| solve | A user-provided function that takes a decision variable initial guess and returns a MultistartResult. |
| initial_guesses | A list of decision variable initial guesses to try. |
| auto slp::operator< | ( | LHS && | lhs, |
| RHS && | rhs ) |
Less-than comparison operator that returns an inequality constraint for two Variables.
| lhs | Left-hand side. |
| rhs | Left-hand side. |
| auto slp::operator<= | ( | LHS && | lhs, |
| RHS && | rhs ) |
Less-than-or-equal-to comparison operator that returns an inequality constraint for two Variables.
| lhs | Left-hand side. |
| rhs | Left-hand side. |
| auto slp::operator== | ( | LHS && | lhs, |
| RHS && | rhs ) |
Equality operator that returns an equality constraint for two Variables.
| lhs | Left-hand side. |
| rhs | Left-hand side. |
| auto slp::operator== | ( | LHS && | lhs, |
| RHS && | rhs ) |
Equality operator that returns an equality constraint for two Variables.
| lhs | Left-hand side. |
| rhs | Left-hand side. |
| auto slp::operator== | ( | LHS && | lhs, |
| RHS && | rhs ) |
Equality operator that returns an equality constraint for two Variables.
| lhs | Left-hand side. |
| rhs | Left-hand side. |
| auto slp::operator> | ( | LHS && | lhs, |
| RHS && | rhs ) |
Greater-than comparison operator that returns an inequality constraint for two Variables.
| lhs | Left-hand side. |
| rhs | Left-hand side. |
| auto slp::operator>= | ( | LHS && | lhs, |
| RHS && | rhs ) |
Greater-than-or-equal-to comparison operator that returns an inequality constraint for two Variables.
| lhs | Left-hand side. |
| rhs | Left-hand side. |
| auto slp::operator>= | ( | LHS && | lhs, |
| RHS && | rhs ) |
Greater-than-or-equal-to comparison operator that returns an inequality constraint for two Variables.
| lhs | Left-hand side. |
| rhs | Left-hand side. |
| auto slp::operator>= | ( | LHS && | lhs, |
| RHS && | rhs ) |
Greater-than-or-equal-to comparison operator that returns an inequality constraint for two Variables.
| lhs | Left-hand side. |
| rhs | Left-hand side. |
| Variable< Scalar > slp::pow | ( | const ScalarLike auto & | base, |
| const Variable< Scalar > & | power ) |
pow() for Variables.
| Scalar | Scalar type. |
| base | The base. |
| power | The power. |
| Variable< Scalar > slp::pow | ( | const Variable< Scalar > & | base, |
| const ScalarLike auto & | power ) |
pow() for Variables.
| Scalar | Scalar type. |
| base | The base. |
| power | The power. |
| Variable< Scalar > slp::pow | ( | const Variable< Scalar > & | base, |
| const Variable< Scalar > & | power ) |
pow() for Variables.
| Scalar | Scalar type. |
| base | The base. |
| power | The power. |
| std::string slp::power_of_10 | ( | Scalar | value | ) |
Renders value as power of 10.
| Scalar | Scalar type. |
| value | Value. |
| void slp::print | ( | fmt::format_string< T... > | fmt, |
| T &&... | args ) |
Wrapper around fmt::print() that squelches write failure exceptions.
| void slp::print | ( | std::FILE * | f, |
| fmt::format_string< T... > | fmt, | ||
| T &&... | args ) |
Wrapper around fmt::print() that squelches write failure exceptions.
|
inline |
Prints autodiff diagnostics.
| setup_profilers | Autodiff setup profilers. |
|
inline |
Prints bottom of iteration diagnostics table.
|
inline |
| void slp::print_c_e_local_infeasibility_error | ( | const Eigen::Vector< Scalar, Eigen::Dynamic > & | c_e | ) |
Prints equality constraint local infeasibility error.
| Scalar | Scalar type. |
| c_e | The problem's equality constraints cₑ(x) evaluated at the current iterate. |
| void slp::print_c_i_local_infeasibility_error | ( | const Eigen::Vector< Scalar, Eigen::Dynamic > & | c_i | ) |
Prints inequality constraint local infeasibility error.
| Scalar | Scalar type. |
| c_i | The problem's inequality constraints cᵢ(x) evaluated at the current iterate. |
| void slp::print_iteration_diagnostics | ( | int | iterations, |
| IterationType | type, | ||
| const std::chrono::duration< Rep, Period > & | time, | ||
| Scalar | error, | ||
| Scalar | cost, | ||
| Scalar | infeasibility, | ||
| Scalar | complementarity, | ||
| Scalar | μ, | ||
| Scalar | δ, | ||
| Scalar | primal_α, | ||
| Scalar | primal_α_max, | ||
| Scalar | α_reduction_factor, | ||
| Scalar | dual_α ) |
Prints diagnostics for the current iteration.
| Scalar | Scalar type. |
| iterations | Number of iterations. |
| type | The iteration's type. |
| time | The iteration duration. |
| error | The error. |
| cost | The cost. |
| infeasibility | The infeasibility. |
| complementarity | The complementarity. |
| μ | The barrier parameter. |
| δ | The Hessian regularization factor. |
| primal_α | The primal step size. |
| primal_α_max | The max primal step size. |
| α_reduction_factor | Factor by which primal_α is reduced during backtracking. |
| dual_α | The dual step size. |
|
inline |
Prints solver diagnostics.
| solve_profilers | Solve profilers. |
| void slp::print_too_few_dofs_error | ( | const Eigen::Vector< Scalar, Eigen::Dynamic > & | c_e | ) |
Prints error for too few degrees of freedom.
| Scalar | Scalar type. |
| c_e | The problem's equality constraints cₑ(x) evaluated at the current iterate. |
| void slp::println | ( | fmt::format_string< T... > | fmt, |
| T &&... | args ) |
Wrapper around fmt::println() that squelches write failure exceptions.
| void slp::println | ( | std::FILE * | f, |
| fmt::format_string< T... > | fmt, | ||
| T &&... | args ) |
Wrapper around fmt::println() that squelches write failure exceptions.
| void slp::project_onto_bounds | ( | Eigen::DenseBase< Derived > & | x, |
| std::span< const std::pair< typename Eigen::DenseBase< Derived >::Scalar, typename Eigen::DenseBase< Derived >::Scalar > > | decision_variable_indices_to_bounds, | ||
| const typename Eigen::DenseBase< Derived >::Scalar | κ_1 = typename Eigen::DenseBase<Derived>::Scalar(1e-2), | ||
| const typename Eigen::DenseBase< Derived >::Scalar | κ_2 = typename Eigen::DenseBase<Derived>::Scalar(1e-2) ) |
Projects the decision variables onto the given bounds, while ensuring some configurable distance from the boundary if possible.
This is designed to match the algorithm given in section 3.6 of [2].
| x | A vector of decision variables. |
| decision_variable_indices_to_bounds | An array of bounds (stored [lower, upper]) for each decision variable in x. |
| κ_1 | A constant controlling distance from the lower or upper bound when the difference between the upper and lower bound is small. |
| κ_2 | A constant controlling distance from the lower or upper bound when the difference between the upper and lower bound is large (including when one of the bounds is ±∞). |
|
extern |
| VariableMatrix< Scalar > slp::solve | ( | const VariableMatrix< Scalar > & | A, |
| const VariableMatrix< Scalar > & | B ) |
Solves the VariableMatrix equation AX = B for X.
| Scalar | Scalar type. |
| A | The left-hand side. |
| B | The right-hand side. |
|
constexprnoexcept |
Swaps the referred callables of lhs and rhs.
|
constexpr |
Converts std::chrono::duration to a number of milliseconds rounded to three decimals.
|
inline |
| slp::Variable | ( | T | ) | ->Variable< T > |
| slp::Variable | ( | T | ) | ->Variable< T > |
| slp::Variable | ( | T< Scalar > | ) | ->Variable< Scalar > |
| slp::VariableMatrix | ( | const Eigen::DiagonalBase< Derived > & | ) | ->VariableMatrix< typenameDerived::Scalar > |
| slp::VariableMatrix | ( | const Eigen::MatrixBase< Derived > & | ) | ->VariableMatrix< typenameDerived::Scalar > |