WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
slp Namespace Reference

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 PoolResourceglobal_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.

Enumeration Type Documentation

◆ DynamicsType

enum class slp::DynamicsType : uint8_t
strong

Enum describing a type of system dynamics constraints.

Enumerator
EXPLICIT_ODE 

The dynamics are a function in the form dx/dt = f(t, x, u).

DISCRETE 

The dynamics are a function in the form xₖ₊₁ = f(t, xₖ, uₖ).

◆ ExitStatus

enum class slp::ExitStatus : int8_t
strong

Solver exit status. Negative values indicate failure.

Enumerator
SUCCESS 

Solved the problem to the desired tolerance.

CALLBACK_REQUESTED_STOP 

The solver returned its solution so far after the user requested a stop.

TOO_FEW_DOFS 

The solver determined the problem to be overconstrained and gave up.

LOCALLY_INFEASIBLE 

The solver determined the problem to be locally infeasible and gave up.

GLOBALLY_INFEASIBLE 

The problem setup frontend determined the problem to have an empty feasible region.

FACTORIZATION_FAILED 

The linear system factorization failed.

LINE_SEARCH_FAILED 

The backtracking line search failed, and the problem isn't locally infeasible.

NONFINITE_INITIAL_COST_OR_CONSTRAINTS 

The solver encountered nonfinite initial cost or constraints and gave up.

DIVERGING_ITERATES 

The solver encountered diverging primal iterates xₖ and/or sₖ and gave up.

MAX_ITERATIONS_EXCEEDED 

The solver returned its solution so far after exceeding the maximum number of iterations.

TIMEOUT 

The solver returned its solution so far after exceeding the maximum elapsed wall clock time.

◆ ExpressionType

enum class slp::ExpressionType : uint8_t
strong

Expression type.

Used for autodiff caching.

Enumerator
NONE 

There is no expression.

CONSTANT 

The expression is a constant.

LINEAR 

The expression is composed of linear and lower-order operators.

QUADRATIC 

The expression is composed of quadratic and lower-order operators.

NONLINEAR 

The expression is composed of nonlinear and lower-order operators.

◆ IterationType

enum class slp::IterationType : uint8_t
strong

Iteration type.

Enumerator
NORMAL 

Normal iteration.

ACCEPTED_SOC 

Accepted second-order correction iteration.

REJECTED_SOC 

Rejected second-order correction iteration.

◆ TimestepMethod

enum class slp::TimestepMethod : uint8_t
strong

Enum describing the type of system timestep.

Enumerator
FIXED 

The timestep is a fixed constant.

VARIABLE 

The timesteps are allowed to vary as independent decision variables.

VARIABLE_SINGLE 

The timesteps are equal length but allowed to vary as a single decision variable.

◆ TranscriptionMethod

enum class slp::TranscriptionMethod : uint8_t
strong

Enum describing an OCP transcription method.

Enumerator
DIRECT_TRANSCRIPTION 

Each state is a decision variable constrained to the integrated dynamics of the previous state.

DIRECT_COLLOCATION 

The trajectory is modeled as a series of cubic polynomials where the centerpoint slope is constrained.

SINGLE_SHOOTING 

States depend explicitly as a function of all previous states and all previous inputs.

Function Documentation

◆ abs()

template<typename Scalar>
Variable< Scalar > slp::abs ( const Variable< Scalar > & x)

abs() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ acos()

template<typename Scalar>
Variable< Scalar > slp::acos ( const Variable< Scalar > & x)

acos() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ allocate_intrusive_shared()

template<typename T, typename Alloc, typename... Args>
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.

Template Parameters
TType of object for intrusive shared pointer.
AllocType of allocator for T.
ArgsTypes of constructor arguments.
Parameters
allocThe allocator for T.
argsConstructor arguments for T.

◆ asin()

template<typename Scalar>
Variable< Scalar > slp::asin ( const Variable< Scalar > & x)

asin() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ atan()

template<typename Scalar>
Variable< Scalar > slp::atan ( const Variable< Scalar > & x)

atan() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ atan2() [1/3]

template<typename Scalar>
Variable< Scalar > slp::atan2 ( const ScalarLike auto & y,
const Variable< Scalar > & x )

atan2() for Variables.

Template Parameters
ScalarScalar type.
Parameters
yThe y argument.
xThe x argument.

◆ atan2() [2/3]

template<typename Scalar>
Variable< Scalar > slp::atan2 ( const Variable< Scalar > & y,
const ScalarLike auto & x )

atan2() for Variables.

Template Parameters
ScalarScalar type.
Parameters
yThe y argument.
xThe x argument.

◆ atan2() [3/3]

template<typename Scalar>
Variable< Scalar > slp::atan2 ( const Variable< Scalar > & y,
const Variable< Scalar > & x )

atan2() for Variables.

Template Parameters
ScalarScalar type.
Parameters
yThe y argument.
xThe x argument.

◆ block() [1/2]

template<typename Scalar>
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.

Template Parameters
ScalarScalar type.
Parameters
listThe nested list of blocks.

◆ block() [2/2]

template<typename Scalar>
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.

Template Parameters
ScalarScalar type.
Parameters
listThe nested list of blocks.

◆ bounds()

template<typename L, typename X, typename U>
requires (ScalarLike<L> || MatrixLike<L>) && SleipnirType<X> && (ScalarLike<U> || MatrixLike<U>)
auto slp::bounds ( L && l,
X && x,
U && u )

Helper function for creating bound constraints.

Parameters
lLower bound.
xVariable to bound.
uUpper bound.

◆ cbrt()

template<typename Scalar>
Variable< Scalar > slp::cbrt ( const Variable< Scalar > & x)

cbrt() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ cos()

template<typename Scalar>
Variable< Scalar > slp::cos ( const Variable< Scalar > & x)

cos() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ cosh()

template<typename Scalar>
Variable< Scalar > slp::cosh ( const Variable< Scalar > & x)

cosh() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ cwise_reduce()

template<typename Scalar>
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.

Template Parameters
ScalarScalar type.
Parameters
lhsThe left-hand side of the binary operator.
rhsThe right-hand side of the binary operator.
binary_opThe binary operator to use for the reduce operation.

◆ erf()

template<typename Scalar>
Variable< Scalar > slp::erf ( const Variable< Scalar > & x)

erf() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ error_estimate() [1/3]

template<typename Scalar>
Scalar slp::error_estimate ( const Eigen::Vector< Scalar, Eigen::Dynamic > & g)

Returns the error estimate using the KKT conditions for Newton's method.

Template Parameters
ScalarScalar type.
Parameters
gGradient of the cost function ∇f.

◆ error_estimate() [2/3]

template<typename Scalar>
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.

Template Parameters
ScalarScalar type.
Parameters
gGradient of the cost function ∇f.
A_eThe problem's equality constraint Jacobian Aₑ(x) evaluated at the current iterate.
c_eThe problem's equality constraints cₑ(x) evaluated at the current iterate.
A_iThe problem's inequality constraint Jacobian Aᵢ(x) evaluated at the current iterate.
c_iThe problem's inequality constraints cᵢ(x) evaluated at the current iterate.
sInequality constraint slack variables.
yEquality constraint dual variables.
zInequality constraint dual variables.
μBarrier parameter.

◆ error_estimate() [3/3]

template<typename Scalar>
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.

Template Parameters
ScalarScalar type.
Parameters
gGradient of the cost function ∇f.
A_eThe problem's equality constraint Jacobian Aₑ(x) evaluated at the current iterate.
c_eThe problem's equality constraints cₑ(x) evaluated at the current iterate.
yEquality constraint dual variables.

◆ exp()

template<typename Scalar>
Variable< Scalar > slp::exp ( const Variable< Scalar > & x)

exp() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ EXPORT_TEMPLATE_DECLARE()

template class slp::EXPORT_TEMPLATE_DECLARE ( SLEIPNIR_DLLEXPORT )
extern

◆ fraction_to_the_boundary_rule()

template<typename Scalar>
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].

Template Parameters
ScalarScalar type.
Parameters
xThe variable.
pThe iterate on the variable.
τFraction-to-the-boundary rule scaling factor within (0, 1].
Returns
Fraction of the iterate step size within (0, 1].

◆ function_ref()

template<typename R, typename... Args>
slp::function_ref ( R(*  )(Args...)) ->function_ref< R(Args...)>

◆ get_bounds()

template<typename Scalar>
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),

Template Parameters
ScalarScalar type.
Parameters
decision_variablesDecision variables corresponding to each column of A_i.
inequality_constraintsVariables representing the left-hand side of cᵢ(decision_variables) ≥ 0.
A_iThe 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.

◆ global_pool_allocator()

template<typename T>
PoolAllocator< T > slp::global_pool_allocator ( )

Returns an allocator for a global pool memory resource.

Template Parameters
TThe type of object in the pool.

◆ global_pool_resource()

SLEIPNIR_DLLEXPORT PoolResource & slp::global_pool_resource ( )

Returns a global pool memory resource.

◆ histogram()

template<int Width>
requires (Width > 0)
std::string slp::histogram ( double value)

Renders histogram of the given normalized value.

Template Parameters
WidthWidth of the histogram in characters.
Parameters
valueNormalized value from 0 to 1.

◆ hypot() [1/4]

template<typename Scalar>
Variable< Scalar > slp::hypot ( const ScalarLike auto & x,
const Variable< Scalar > & y )

hypot() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe x argument.
yThe y argument.

◆ hypot() [2/4]

template<typename Scalar>
Variable< Scalar > slp::hypot ( const Variable< Scalar > & x,
const ScalarLike auto & y )

hypot() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe x argument.
yThe y argument.

◆ hypot() [3/4]

template<typename Scalar>
Variable< Scalar > slp::hypot ( const Variable< Scalar > & x,
const Variable< Scalar > & y )

hypot() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe x argument.
yThe y argument.

◆ hypot() [4/4]

template<typename Scalar>
Variable< Scalar > slp::hypot ( const Variable< Scalar > & x,
const Variable< Scalar > & y,
const Variable< Scalar > & z )

hypot() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe x argument.
yThe y argument.
zThe z argument.

◆ is_equality_locally_infeasible()

template<typename Scalar>
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.

Template Parameters
ScalarScalar type.
Parameters
A_eThe problem's equality constraint Jacobian Aₑ(x) evaluated at the current iterate.
c_eThe problem's equality constraints cₑ(x) evaluated at the current iterate.

◆ is_inequality_locally_infeasible()

template<typename Scalar>
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.

Template Parameters
ScalarScalar type.
Parameters
A_iThe problem's inequality constraint Jacobian Aᵢ(x) evaluated at the current iterate.
c_iThe problem's inequality constraints cᵢ(x) evaluated at the current iterate.

◆ kkt_error() [1/3]

template<typename Scalar>
Scalar slp::kkt_error ( const Eigen::Vector< Scalar, Eigen::Dynamic > & g)

Returns the KKT error for Newton's method.

Template Parameters
ScalarScalar type.
Parameters
gGradient of the cost function ∇f.

◆ kkt_error() [2/3]

template<typename Scalar>
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.

Template Parameters
ScalarScalar type.
Parameters
gGradient of the cost function ∇f.
A_eThe problem's equality constraint Jacobian Aₑ(x) evaluated at the current iterate.
c_eThe problem's equality constraints cₑ(x) evaluated at the current iterate.
A_iThe problem's inequality constraint Jacobian Aᵢ(x) evaluated at the current iterate.
c_iThe problem's inequality constraints cᵢ(x) evaluated at the current iterate.
sInequality constraint slack variables.
yEquality constraint dual variables.
zInequality constraint dual variables.
μBarrier parameter.

◆ kkt_error() [3/3]

template<typename Scalar>
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.

Template Parameters
ScalarScalar type.
Parameters
gGradient of the cost function ∇f.
A_eThe problem's equality constraint Jacobian Aₑ(x) evaluated at the current iterate.
c_eThe problem's equality constraints cₑ(x) evaluated at the current iterate.
yEquality constraint dual variables.

◆ log()

template<typename Scalar>
Variable< Scalar > slp::log ( const Variable< Scalar > & x)

log() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ log10()

template<typename Scalar>
Variable< Scalar > slp::log10 ( const Variable< Scalar > & x)

log10() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ make_constraints() [1/4]

template<typename Scalar, MatrixLike LHS, MatrixLike RHS>
requires SleipnirMatrixLike<LHS, Scalar> || SleipnirMatrixLike<RHS, Scalar>
auto slp::make_constraints ( LHS && lhs,
RHS && rhs )

◆ make_constraints() [2/4]

template<typename Scalar, MatrixLike LHS, ScalarLike RHS>
requires SleipnirMatrixLike<LHS, Scalar> || SleipnirScalarLike<RHS, Scalar>
auto slp::make_constraints ( LHS && lhs,
RHS && rhs )

◆ make_constraints() [3/4]

template<typename Scalar, ScalarLike LHS, MatrixLike RHS>
requires SleipnirScalarLike<LHS, Scalar> || SleipnirMatrixLike<RHS, Scalar>
auto slp::make_constraints ( LHS && lhs,
RHS && rhs )

◆ make_constraints() [4/4]

template<typename Scalar, ScalarLike LHS, ScalarLike RHS>
requires SleipnirScalarLike<LHS, Scalar> || SleipnirScalarLike<RHS, Scalar>
auto slp::make_constraints ( LHS && lhs,
RHS && rhs )

◆ make_intrusive_shared()

template<typename T, typename... Args>
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.

Template Parameters
TType of object for intrusive shared pointer.
ArgsTypes of constructor arguments.
Parameters
argsConstructor arguments for T.

◆ multistart()

template<typename Scalar, typename DecisionVariables>
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.

Template Parameters
ScalarScalar type.
DecisionVariablesThe type containing the decision variable initial guess.
Parameters
solveA user-provided function that takes a decision variable initial guess and returns a MultistartResult.
initial_guessesA list of decision variable initial guesses to try.

◆ operator<()

template<typename LHS, typename RHS>
requires (ScalarLike<LHS> || MatrixLike<LHS>) && (ScalarLike<RHS> || MatrixLike<RHS>) && (SleipnirType<LHS> || SleipnirType<RHS>)
auto slp::operator< ( LHS && lhs,
RHS && rhs )

Less-than comparison operator that returns an inequality constraint for two Variables.

Parameters
lhsLeft-hand side.
rhsLeft-hand side.

◆ operator<=()

template<typename LHS, typename RHS>
requires (ScalarLike<LHS> || MatrixLike<LHS>) && (ScalarLike<RHS> || MatrixLike<RHS>) && (SleipnirType<LHS> || SleipnirType<RHS>)
auto slp::operator<= ( LHS && lhs,
RHS && rhs )

Less-than-or-equal-to comparison operator that returns an inequality constraint for two Variables.

Parameters
lhsLeft-hand side.
rhsLeft-hand side.

◆ operator==() [1/3]

template<typename LHS, typename RHS>
requires (ScalarLike<LHS> || MatrixLike<LHS>) && SleipnirType<LHS> && (ScalarLike<RHS> || MatrixLike<RHS>) && SleipnirType<RHS>
auto slp::operator== ( LHS && lhs,
RHS && rhs )

Equality operator that returns an equality constraint for two Variables.

Parameters
lhsLeft-hand side.
rhsLeft-hand side.

◆ operator==() [2/3]

template<typename LHS, typename RHS>
requires (ScalarLike<LHS> || MatrixLike<LHS>) && (!SleipnirType<LHS>) && (ScalarLike<RHS> || MatrixLike<RHS>) && SleipnirType<RHS>
auto slp::operator== ( LHS && lhs,
RHS && rhs )

Equality operator that returns an equality constraint for two Variables.

Parameters
lhsLeft-hand side.
rhsLeft-hand side.

◆ operator==() [3/3]

template<typename LHS, typename RHS>
requires (ScalarLike<LHS> || MatrixLike<LHS>) && SleipnirType<LHS> && (ScalarLike<RHS> || MatrixLike<RHS>) && (!SleipnirType<RHS>)
auto slp::operator== ( LHS && lhs,
RHS && rhs )

Equality operator that returns an equality constraint for two Variables.

Parameters
lhsLeft-hand side.
rhsLeft-hand side.

◆ operator>()

template<typename LHS, typename RHS>
requires (ScalarLike<LHS> || MatrixLike<LHS>) && (ScalarLike<RHS> || MatrixLike<RHS>) && (SleipnirType<LHS> || SleipnirType<RHS>)
auto slp::operator> ( LHS && lhs,
RHS && rhs )

Greater-than comparison operator that returns an inequality constraint for two Variables.

Parameters
lhsLeft-hand side.
rhsLeft-hand side.

◆ operator>=() [1/3]

template<typename LHS, typename RHS>
requires (ScalarLike<LHS> || MatrixLike<LHS>) && SleipnirType<LHS> && (ScalarLike<RHS> || MatrixLike<RHS>) && SleipnirType<RHS>
auto slp::operator>= ( LHS && lhs,
RHS && rhs )

Greater-than-or-equal-to comparison operator that returns an inequality constraint for two Variables.

Parameters
lhsLeft-hand side.
rhsLeft-hand side.

◆ operator>=() [2/3]

template<typename LHS, typename RHS>
requires (ScalarLike<LHS> || MatrixLike<LHS>) && (!SleipnirType<LHS>) && (ScalarLike<RHS> || MatrixLike<RHS>) && SleipnirType<RHS>
auto slp::operator>= ( LHS && lhs,
RHS && rhs )

Greater-than-or-equal-to comparison operator that returns an inequality constraint for two Variables.

Parameters
lhsLeft-hand side.
rhsLeft-hand side.

◆ operator>=() [3/3]

template<typename LHS, typename RHS>
requires (ScalarLike<LHS> || MatrixLike<LHS>) && SleipnirType<LHS> && (ScalarLike<RHS> || MatrixLike<RHS>) && (!SleipnirType<RHS>)
auto slp::operator>= ( LHS && lhs,
RHS && rhs )

Greater-than-or-equal-to comparison operator that returns an inequality constraint for two Variables.

Parameters
lhsLeft-hand side.
rhsLeft-hand side.

◆ pow() [1/3]

template<typename Scalar>
Variable< Scalar > slp::pow ( const ScalarLike auto & base,
const Variable< Scalar > & power )

pow() for Variables.

Template Parameters
ScalarScalar type.
Parameters
baseThe base.
powerThe power.

◆ pow() [2/3]

template<typename Scalar>
Variable< Scalar > slp::pow ( const Variable< Scalar > & base,
const ScalarLike auto & power )

pow() for Variables.

Template Parameters
ScalarScalar type.
Parameters
baseThe base.
powerThe power.

◆ pow() [3/3]

template<typename Scalar>
Variable< Scalar > slp::pow ( const Variable< Scalar > & base,
const Variable< Scalar > & power )

pow() for Variables.

Template Parameters
ScalarScalar type.
Parameters
baseThe base.
powerThe power.

◆ power_of_10()

template<typename Scalar>
std::string slp::power_of_10 ( Scalar value)

Renders value as power of 10.

Template Parameters
ScalarScalar type.
Parameters
valueValue.

◆ print() [1/2]

template<typename... T>
void slp::print ( fmt::format_string< T... > fmt,
T &&... args )

Wrapper around fmt::print() that squelches write failure exceptions.

◆ print() [2/2]

template<typename... T>
void slp::print ( std::FILE * f,
fmt::format_string< T... > fmt,
T &&... args )

Wrapper around fmt::print() that squelches write failure exceptions.

◆ print_autodiff_diagnostics()

void slp::print_autodiff_diagnostics ( const gch::small_vector< SetupProfiler > & setup_profilers)
inline

Prints autodiff diagnostics.

Parameters
setup_profilersAutodiff setup profilers.

◆ print_bottom_iteration_diagnostics()

void slp::print_bottom_iteration_diagnostics ( )
inline

Prints bottom of iteration diagnostics table.

◆ print_bound_constraint_global_infeasibility_error()

void slp::print_bound_constraint_global_infeasibility_error ( const std::span< const std::pair< Eigen::Index, Eigen::Index > > conflicting_lower_upper_bound_indices)
inline

◆ print_c_e_local_infeasibility_error()

template<typename Scalar>
void slp::print_c_e_local_infeasibility_error ( const Eigen::Vector< Scalar, Eigen::Dynamic > & c_e)

Prints equality constraint local infeasibility error.

Template Parameters
ScalarScalar type.
Parameters
c_eThe problem's equality constraints cₑ(x) evaluated at the current iterate.

◆ print_c_i_local_infeasibility_error()

template<typename Scalar>
void slp::print_c_i_local_infeasibility_error ( const Eigen::Vector< Scalar, Eigen::Dynamic > & c_i)

Prints inequality constraint local infeasibility error.

Template Parameters
ScalarScalar type.
Parameters
c_iThe problem's inequality constraints cᵢ(x) evaluated at the current iterate.

◆ print_iteration_diagnostics()

template<typename Scalar, typename Rep, typename Period = std::ratio<1>>
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.

Template Parameters
ScalarScalar type.
Parameters
iterationsNumber of iterations.
typeThe iteration's type.
timeThe iteration duration.
errorThe error.
costThe cost.
infeasibilityThe infeasibility.
complementarityThe complementarity.
μThe barrier parameter.
δThe Hessian regularization factor.
primal_αThe primal step size.
primal_α_maxThe max primal step size.
α_reduction_factorFactor by which primal_α is reduced during backtracking.
dual_αThe dual step size.

◆ print_solver_diagnostics()

void slp::print_solver_diagnostics ( const gch::small_vector< SolveProfiler > & solve_profilers)
inline

Prints solver diagnostics.

Parameters
solve_profilersSolve profilers.

◆ print_too_few_dofs_error()

template<typename Scalar>
void slp::print_too_few_dofs_error ( const Eigen::Vector< Scalar, Eigen::Dynamic > & c_e)

Prints error for too few degrees of freedom.

Template Parameters
ScalarScalar type.
Parameters
c_eThe problem's equality constraints cₑ(x) evaluated at the current iterate.

◆ println() [1/2]

template<typename... T>
void slp::println ( fmt::format_string< T... > fmt,
T &&... args )

Wrapper around fmt::println() that squelches write failure exceptions.

◆ println() [2/2]

template<typename... T>
void slp::println ( std::FILE * f,
fmt::format_string< T... > fmt,
T &&... args )

Wrapper around fmt::println() that squelches write failure exceptions.

◆ project_onto_bounds()

template<typename Derived>
requires (static_cast<bool>(Eigen::DenseBase<Derived>::IsVectorAtCompileTime))
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].

Parameters
xA vector of decision variables.
decision_variable_indices_to_boundsAn array of bounds (stored [lower, upper]) for each decision variable in x.
κ_1A constant controlling distance from the lower or upper bound when the difference between the upper and lower bound is small.
κ_2A 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 ±∞).

◆ sign()

template<typename Scalar>
Variable< Scalar > slp::sign ( const Variable< Scalar > & x)

sign() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ sin()

template<typename Scalar>
Variable< Scalar > slp::sin ( const Variable< Scalar > & x)

sin() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ sinh()

template<typename Scalar>
Variable< Scalar > slp::sinh ( const Variable< Scalar > & x)

sinh() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ solve() [1/2]

template SLEIPNIR_DLLEXPORT VariableMatrix< double > slp::solve ( const VariableMatrix< double > & A,
const VariableMatrix< double > & B )
extern

◆ solve() [2/2]

template<typename Scalar>
VariableMatrix< Scalar > slp::solve ( const VariableMatrix< Scalar > & A,
const VariableMatrix< Scalar > & B )

Solves the VariableMatrix equation AX = B for X.

Template Parameters
ScalarScalar type.
Parameters
AThe left-hand side.
BThe right-hand side.
Returns
The solution X.

◆ sqrt()

template<typename Scalar>
Variable< Scalar > slp::sqrt ( const Variable< Scalar > & x)

sqrt() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ swap()

template<typename R, typename... Args>
void slp::swap ( function_ref< R(Args...)> & lhs,
function_ref< R(Args...)> & rhs )
constexprnoexcept

Swaps the referred callables of lhs and rhs.

◆ tan()

template<typename Scalar>
Variable< Scalar > slp::tan ( const Variable< Scalar > & x)

tan() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ tanh()

template<typename Scalar>
Variable< Scalar > slp::tanh ( const Variable< Scalar > & x)

tanh() for Variables.

Template Parameters
ScalarScalar type.
Parameters
xThe argument.

◆ to_ms()

template<typename Rep, typename Period = std::ratio<1>>
double slp::to_ms ( const std::chrono::duration< Rep, Period > & duration)
constexpr

Converts std::chrono::duration to a number of milliseconds rounded to three decimals.

◆ unreachable()

void slp::unreachable ( )
inline

◆ Variable() [1/3]

template<std::integral T>
slp::Variable ( T ) ->Variable< T >

◆ Variable() [2/3]

template<std::floating_point T>
slp::Variable ( T ) ->Variable< T >

◆ Variable() [3/3]

template<template< typename > typename T, typename Scalar>
requires SleipnirMatrixLike<T<Scalar>, Scalar>
slp::Variable ( T< Scalar > ) ->Variable< Scalar >

◆ VariableMatrix() [1/2]

template<typename Derived>
slp::VariableMatrix ( const Eigen::DiagonalBase< Derived > & ) ->VariableMatrix< typenameDerived::Scalar >

◆ VariableMatrix() [2/2]

template<typename Derived>
slp::VariableMatrix ( const Eigen::MatrixBase< Derived > & ) ->VariableMatrix< typenameDerived::Scalar >