Sleipnir C++ API
Loading...
Searching...
No Matches
sleipnir Namespace Reference

Namespaces

namespace  concepts
 
namespace  detail
 
namespace  slicing
 

Classes

struct  default_buffer_size
 
struct  EqualityConstraints
 
class  function_ref
 
class  function_ref< R(Args...)>
 
class  Gradient
 
class  Hessian
 
struct  InequalityConstraints
 
class  IntrusiveSharedPtr
 
class  Jacobian
 
struct  MultistartResult
 
class  OCPSolver
 
class  OptimizationProblem
 
class  PoolAllocator
 
class  PoolResource
 
class  Profiler
 
class  Slice
 
class  small_vector
 
class  small_vector_iterator
 
struct  SolverConfig
 
struct  SolverIterationInfo
 
struct  SolverStatus
 
class  Spy
 
class  Variable
 
class  VariableBlock
 
class  VariableMatrix
 

Concepts

concept  ScalarLike
 
concept  SleipnirMatrixLike
 
concept  EigenMatrixLike
 
concept  MatrixLike
 
concept  EigenSolver
 

Enumerations

enum class  ExpressionType : uint8_t {
  kNone , kConstant , kLinear , kQuadratic ,
  kNonlinear
}
 
enum class  TranscriptionMethod : uint8_t { kDirectTranscription , kDirectCollocation , kSingleShooting }
 
enum class  DynamicsType : uint8_t { kExplicitODE , kDiscrete }
 
enum class  TimestepMethod : uint8_t { kFixed , kVariable , kVariableSingle }
 
enum class  SolverExitCondition : int8_t {
  kSuccess = 0 , kSolvedToAcceptableTolerance = 1 , kCallbackRequestedStop = 2 , kTooFewDOFs = -1 ,
  kLocallyInfeasible = -2 , kFeasibilityRestorationFailed = -3 , kNonfiniteInitialCostOrConstraints = -4 , kDivergingIterates = -5 ,
  kMaxIterationsExceeded = -6 , kTimeout = -7
}
 

Functions

SLEIPNIR_DLLEXPORT Variable abs (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable acos (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable asin (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable atan (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable atan2 (const Variable &y, const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable cos (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable cosh (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable erf (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable exp (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable hypot (const Variable &x, const Variable &y)
 
SLEIPNIR_DLLEXPORT Variable pow (const Variable &base, const Variable &power)
 
SLEIPNIR_DLLEXPORT Variable log (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable log10 (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable sign (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable sin (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable sinh (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable sqrt (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable tan (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable tanh (const Variable &x)
 
SLEIPNIR_DLLEXPORT Variable hypot (const Variable &x, const Variable &y, const Variable &z)
 
template<typename LHS , typename RHS >
requires (ScalarLike<std::decay_t<LHS>> || MatrixLike<std::decay_t<LHS>>) && (ScalarLike<std::decay_t<RHS>> || MatrixLike<std::decay_t<RHS>>) && (!std::same_as<std::decay_t<LHS>, double> || !std::same_as<std::decay_t<RHS>, double>)
small_vector< VariableMakeConstraints (LHS &&lhs, RHS &&rhs)
 
template<typename LHS , typename RHS >
requires (ScalarLike<std::decay_t<LHS>> || MatrixLike<std::decay_t<LHS>>) && (ScalarLike<std::decay_t<RHS>> || MatrixLike<std::decay_t<RHS>>) && (!std::same_as<std::decay_t<LHS>, double> || !std::same_as<std::decay_t<RHS>, double>)
EqualityConstraints operator== (LHS &&lhs, RHS &&rhs)
 
template<typename LHS , typename RHS >
requires (ScalarLike<std::decay_t<LHS>> || MatrixLike<std::decay_t<LHS>>) && (ScalarLike<std::decay_t<RHS>> || MatrixLike<std::decay_t<RHS>>) && (!std::same_as<std::decay_t<LHS>, double> || !std::same_as<std::decay_t<RHS>, double>)
InequalityConstraints operator< (LHS &&lhs, RHS &&rhs)
 
template<typename LHS , typename RHS >
requires (ScalarLike<std::decay_t<LHS>> || MatrixLike<std::decay_t<LHS>>) && (ScalarLike<std::decay_t<RHS>> || MatrixLike<std::decay_t<RHS>>) && (!std::same_as<std::decay_t<LHS>, double> || !std::same_as<std::decay_t<RHS>, double>)
InequalityConstraints operator<= (LHS &&lhs, RHS &&rhs)
 
template<typename LHS , typename RHS >
requires (ScalarLike<std::decay_t<LHS>> || MatrixLike<std::decay_t<LHS>>) && (ScalarLike<std::decay_t<RHS>> || MatrixLike<std::decay_t<RHS>>) && (!std::same_as<std::decay_t<LHS>, double> || !std::same_as<std::decay_t<RHS>, double>)
InequalityConstraints operator> (LHS &&lhs, RHS &&rhs)
 
template<typename LHS , typename RHS >
requires (ScalarLike<std::decay_t<LHS>> || MatrixLike<std::decay_t<LHS>>) && (ScalarLike<std::decay_t<RHS>> || MatrixLike<std::decay_t<RHS>>) && (!std::same_as<std::decay_t<LHS>, double> || !std::same_as<std::decay_t<RHS>, double>)
InequalityConstraints operator>= (LHS &&lhs, RHS &&rhs)
 
SLEIPNIR_DLLEXPORT VariableMatrix CwiseReduce (const VariableMatrix &lhs, const VariableMatrix &rhs, function_ref< Variable(const Variable &x, const Variable &y)> binaryOp)
 
SLEIPNIR_DLLEXPORT VariableMatrix Block (std::initializer_list< std::initializer_list< VariableMatrix > > list)
 
SLEIPNIR_DLLEXPORT VariableMatrix Block (const std::vector< std::vector< VariableMatrix > > &list)
 
SLEIPNIR_DLLEXPORT VariableMatrix Solve (const VariableMatrix &A, const VariableMatrix &B)
 
template<typename F , typename State , typename Input , typename Time >
State RK4 (F &&f, State x, Input u, Time t0, Time dt)
 
template<typename DecisionVariables >
MultistartResult< DecisionVariablesMultistart (function_ref< MultistartResult< DecisionVariables >(const DecisionVariables &initialGuess)> solve, std::span< const DecisionVariables > initialGuesses)
 
SLEIPNIR_DLLEXPORT void InteriorPoint (std::span< Variable > decisionVariables, std::span< Variable > equalityConstraints, std::span< Variable > inequalityConstraints, Variable &f, function_ref< bool(const SolverIterationInfo &info)> callback, const SolverConfig &config, bool feasibilityRestoration, Eigen::VectorXd &x, Eigen::VectorXd &s, SolverStatus *status)
 
SLEIPNIR_DLLEXPORT void Newton (std::span< Variable > decisionVariables, Variable &f, function_ref< bool(const SolverIterationInfo &info)> callback, const SolverConfig &config, Eigen::VectorXd &x, SolverStatus *status)
 
SLEIPNIR_DLLEXPORT void SQP (std::span< Variable > decisionVariables, std::span< Variable > equalityConstraints, Variable &f, function_ref< bool(const SolverIterationInfo &info)> callback, const SolverConfig &config, Eigen::VectorXd &x, SolverStatus *status)
 
SLEIPNIR_DLLEXPORT constexpr std::string_view ToMessage (const SolverExitCondition &exitCondition)
 
template<typename R , typename... Args>
constexpr void swap (function_ref< R(Args...)> &lhs, function_ref< R(Args...)> &rhs) noexcept
 
template<typename R , typename... Args>
 function_ref (R(*)(Args...)) -> function_ref< R(Args...)>
 
template<typename T , typename... Args>
IntrusiveSharedPtr< T > MakeIntrusiveShared (Args &&... args)
 
template<typename T , typename Alloc , typename... Args>
IntrusiveSharedPtr< T > AllocateIntrusiveShared (Alloc alloc, Args &&... args)
 
SLEIPNIR_DLLEXPORT PoolResourceGlobalPoolResource ()
 
template<typename T >
PoolAllocator< T > GlobalPoolAllocator ()
 
template<typename... T>
void print (std::format_string< T... > fmt, T &&... args)
 
template<typename... T>
void print (std::FILE *f, std::format_string< T... > fmt, T &&... args)
 
template<typename... T>
void println (std::format_string< T... > fmt, T &&... args)
 
template<typename... T>
void println (std::FILE *f, std::format_string< T... > fmt, T &&... args)
 
template<typename PointerLHS , typename DifferenceTypeLHS , typename PointerRHS , typename DifferenceTypeRHS >
requires requires { { lhs.base() == rhs.base() } -> std::convertible_to<bool>; }
constexpr bool operator== (const small_vector_iterator< PointerLHS, DifferenceTypeLHS > &lhs, const small_vector_iterator< PointerRHS, DifferenceTypeRHS > &rhs) noexcept(noexcept(lhs.base()==rhs.base()))
 
template<typename Pointer , typename DifferenceType >
requires requires { { lhs.base() == rhs.base() } -> std::convertible_to<bool>; }
constexpr bool operator== (const small_vector_iterator< Pointer, DifferenceType > &lhs, const small_vector_iterator< Pointer, DifferenceType > &rhs) noexcept(noexcept(lhs.base()==rhs.base()))
 
template<typename PointerLHS , typename DifferenceTypeLHS , typename PointerRHS , typename DifferenceTypeRHS >
requires std::three_way_comparable_with<PointerLHS, PointerRHS>
constexpr auto operator<=> (const small_vector_iterator< PointerLHS, DifferenceTypeLHS > &lhs, const small_vector_iterator< PointerRHS, DifferenceTypeRHS > &rhs) noexcept(noexcept(lhs.base()<=> rhs.base()))
 
template<typename Pointer , typename DifferenceType >
requires std::three_way_comparable<Pointer>
constexpr auto operator<=> (const small_vector_iterator< Pointer, DifferenceType > &lhs, const small_vector_iterator< Pointer, DifferenceType > &rhs) noexcept(noexcept(lhs.base()<=> rhs.base()))
 
template<typename PointerLHS , typename DifferenceTypeLHS , typename PointerRHS , typename DifferenceTypeRHS >
constexpr auto operator<=> (const small_vector_iterator< PointerLHS, DifferenceTypeLHS > &lhs, const small_vector_iterator< PointerRHS, DifferenceTypeRHS > &rhs) noexcept(noexcept(lhs.base()< rhs.base()) &&noexcept(rhs.base()< lhs.base()))
 
template<typename Pointer , typename DifferenceType >
constexpr auto operator<=> (const small_vector_iterator< Pointer, DifferenceType > &lhs, const small_vector_iterator< Pointer, DifferenceType > &rhs) noexcept(noexcept(lhs.base()< rhs.base()) &&noexcept(rhs.base()< lhs.base()))
 
template<typename PointerLHS , typename PointerRHS , typename DifferenceType >
constexpr DifferenceType operator- (const small_vector_iterator< PointerLHS, DifferenceType > &lhs, const small_vector_iterator< PointerRHS, DifferenceType > &rhs) noexcept
 
template<typename Pointer , typename DifferenceType >
constexpr DifferenceType operator- (const small_vector_iterator< Pointer, DifferenceType > &lhs, const small_vector_iterator< Pointer, DifferenceType > &rhs) noexcept
 
template<typename Pointer , typename DifferenceType >
constexpr small_vector_iterator< Pointer, DifferenceTypeoperator+ (DifferenceType n, const small_vector_iterator< Pointer, DifferenceType > &it) noexcept
 
template<typename T , unsigned InlineCapacityLHS, unsigned InlineCapacityRHS, typename Allocator >
constexpr bool operator== (const small_vector< T, InlineCapacityLHS, Allocator > &lhs, const small_vector< T, InlineCapacityRHS, Allocator > &rhs)
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr bool operator== (const small_vector< T, InlineCapacity, Allocator > &lhs, const small_vector< T, InlineCapacity, Allocator > &rhs)
 
template<typename T , unsigned InlineCapacityLHS, unsigned InlineCapacityRHS, typename Allocator >
requires std::three_way_comparable<T>
constexpr auto operator<=> (const small_vector< T, InlineCapacityLHS, Allocator > &lhs, const small_vector< T, InlineCapacityRHS, Allocator > &rhs)
 
template<typename T , unsigned InlineCapacity, typename Allocator >
requires std::three_way_comparable<T>
constexpr auto operator<=> (const small_vector< T, InlineCapacity, Allocator > &lhs, const small_vector< T, InlineCapacity, Allocator > &rhs)
 
template<typename T , unsigned InlineCapacityLHS, unsigned InlineCapacityRHS, typename Allocator >
constexpr auto operator<=> (const small_vector< T, InlineCapacityLHS, Allocator > &lhs, const small_vector< T, InlineCapacityRHS, Allocator > &rhs)
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr auto operator<=> (const small_vector< T, InlineCapacity, Allocator > &lhs, const small_vector< T, InlineCapacity, Allocator > &rhs)
 
template<typename T , unsigned InlineCapacity, typename Allocator >
requires concepts::MoveInsertable< T, small_vector<T, InlineCapacity, Allocator>, Allocator> && concepts::Swappable<T>
constexpr void swap (small_vector< T, InlineCapacity, Allocator > &lhs, small_vector< T, InlineCapacity, Allocator > &rhs) noexcept(noexcept(lhs.swap(rhs)))
 
template<typename T , unsigned InlineCapacity, typename Allocator , typename U >
constexpr small_vector< T, InlineCapacity, Allocator >::size_type erase (small_vector< T, InlineCapacity, Allocator > &v, const U &value)
 
template<typename T , unsigned InlineCapacity, typename Allocator , typename Pred >
constexpr small_vector< T, InlineCapacity, Allocator >::size_type erase_if (small_vector< T, InlineCapacity, Allocator > &v, Pred pred)
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::iterator begin (small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_iterator begin (const small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_iterator cbegin (const small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::iterator end (small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_iterator end (const small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_iterator cend (const small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::reverse_iterator rbegin (small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_reverse_iterator rbegin (const small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_reverse_iterator crbegin (const small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::reverse_iterator rend (small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_reverse_iterator rend (const small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_reverse_iterator crend (const small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::size_type size (const small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr std::common_type_t< std::ptrdiff_t, typename std::make_signed_t< typename small_vector< T, InlineCapacity, Allocator >::size_type > > ssize (const small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr bool empty (const small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::pointer data (small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_pointer data (const small_vector< T, InlineCapacity, Allocator > &v) noexcept
 
template<typename InputIt , unsigned InlineCapacity = default_buffer_size_v< std::allocator<typename std::iterator_traits<InputIt>::value_type>>, typename Allocator = std::allocator<typename std::iterator_traits<InputIt>::value_type>>
 small_vector (InputIt, InputIt, Allocator=Allocator()) -> small_vector< typename std::iterator_traits< InputIt >::value_type, InlineCapacity, Allocator >
 

Variables

class SLEIPNIR_DLLEXPORT Hessian
 
class SLEIPNIR_DLLEXPORT Jacobian
 
template<typename Allocator >
constexpr unsigned default_buffer_size_v
 

Detailed Description

small_vector.hpp An implementation of small_vector (a vector with a small buffer optimization).

Copyright © 2020-2021 Gene Harvey

This software may be modified and distributed under the terms of the MIT license. See LICENSE_small_vector.txt for details.

Source: https://github.com/gharveymn/small_vector

Enumeration Type Documentation

◆ DynamicsType

Enum describing a type of system dynamics constraints.

Enumerator
kExplicitODE 

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

kDiscrete 

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

◆ ExpressionType

Expression type.

Used for autodiff caching.

Enumerator
kNone 

There is no expression.

kConstant 

The expression is a constant.

kLinear 

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

kQuadratic 

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

kNonlinear 

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

◆ SolverExitCondition

Solver exit condition.

Enumerator
kSuccess 

Solved the problem to the desired tolerance.

kSolvedToAcceptableTolerance 

Solved the problem to an acceptable tolerance, but not the desired one.

kCallbackRequestedStop 

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

kTooFewDOFs 

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

kLocallyInfeasible 

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

kFeasibilityRestorationFailed 

The solver failed to reach the desired tolerance, and feasibility restoration failed to converge.

kNonfiniteInitialCostOrConstraints 

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

kDivergingIterates 

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

kMaxIterationsExceeded 

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

kTimeout 

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

◆ TimestepMethod

Enum describing the type of system timestep.

Enumerator
kFixed 

The timestep is a fixed constant.

kVariable 

The timesteps are allowed to vary as independent decision variables.

kVariableSingle 

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

◆ TranscriptionMethod

Enum describing an OCP transcription method.

Enumerator
kDirectTranscription 

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

kDirectCollocation 

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

kSingleShooting 

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

Function Documentation

◆ abs()

SLEIPNIR_DLLEXPORT Variable sleipnir::abs ( const Variable x)
inline

std::abs() for Variables.

Parameters
xThe argument.

◆ acos()

SLEIPNIR_DLLEXPORT Variable sleipnir::acos ( const Variable x)
inline

std::acos() for Variables.

Parameters
xThe argument.

◆ AllocateIntrusiveShared()

template<typename T , typename Alloc , typename... Args>
IntrusiveSharedPtr< T > sleipnir::AllocateIntrusiveShared ( 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()

SLEIPNIR_DLLEXPORT Variable sleipnir::asin ( const Variable x)
inline

std::asin() for Variables.

Parameters
xThe argument.

◆ atan()

SLEIPNIR_DLLEXPORT Variable sleipnir::atan ( const Variable x)
inline

std::atan() for Variables.

Parameters
xThe argument.

◆ atan2()

SLEIPNIR_DLLEXPORT Variable sleipnir::atan2 ( const Variable y,
const Variable x 
)
inline

std::atan2() for Variables.

Parameters
yThe y argument.
xThe x argument.

◆ begin() [1/2]

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_iterator sleipnir::begin ( const small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ begin() [2/2]

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::iterator sleipnir::begin ( small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ Block() [1/2]

SLEIPNIR_DLLEXPORT VariableMatrix sleipnir::Block ( const std::vector< std::vector< VariableMatrix > > &  list)
inline

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.

Parameters
listThe nested list of blocks.

◆ Block() [2/2]

SLEIPNIR_DLLEXPORT VariableMatrix sleipnir::Block ( std::initializer_list< std::initializer_list< VariableMatrix > >  list)
inline

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.

Parameters
listThe nested list of blocks.

◆ cbegin()

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_iterator sleipnir::cbegin ( const small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ cend()

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_iterator sleipnir::cend ( const small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ cos()

SLEIPNIR_DLLEXPORT Variable sleipnir::cos ( const Variable x)
inline

std::cos() for Variables.

Parameters
xThe argument.

◆ cosh()

SLEIPNIR_DLLEXPORT Variable sleipnir::cosh ( const Variable x)
inline

std::cosh() for Variables.

Parameters
xThe argument.

◆ crbegin()

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_reverse_iterator sleipnir::crbegin ( const small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ crend()

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_reverse_iterator sleipnir::crend ( const small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ CwiseReduce()

SLEIPNIR_DLLEXPORT VariableMatrix sleipnir::CwiseReduce ( const VariableMatrix lhs,
const VariableMatrix rhs,
function_ref< Variable(const Variable &x, const Variable &y)>  binaryOp 
)
inline

Applies a coefficient-wise reduce operation to two matrices.

Parameters
lhsThe left-hand side of the binary operator.
rhsThe right-hand side of the binary operator.
binaryOpThe binary operator to use for the reduce operation.

◆ data() [1/2]

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_pointer sleipnir::data ( const small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ data() [2/2]

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::pointer sleipnir::data ( small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ empty()

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr bool sleipnir::empty ( const small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ end() [1/2]

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_iterator sleipnir::end ( const small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ end() [2/2]

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::iterator sleipnir::end ( small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ erase()

template<typename T , unsigned InlineCapacity, typename Allocator , typename U >
constexpr small_vector< T, InlineCapacity, Allocator >::size_type sleipnir::erase ( small_vector< T, InlineCapacity, Allocator > &  v,
const U &  value 
)
inlineconstexpr

◆ erase_if()

template<typename T , unsigned InlineCapacity, typename Allocator , typename Pred >
constexpr small_vector< T, InlineCapacity, Allocator >::size_type sleipnir::erase_if ( small_vector< T, InlineCapacity, Allocator > &  v,
Pred  pred 
)
inlineconstexpr

◆ erf()

SLEIPNIR_DLLEXPORT Variable sleipnir::erf ( const Variable x)
inline

std::erf() for Variables.

Parameters
xThe argument.

◆ exp()

SLEIPNIR_DLLEXPORT Variable sleipnir::exp ( const Variable x)
inline

std::exp() for Variables.

Parameters
xThe argument.

◆ function_ref()

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

◆ GlobalPoolAllocator()

template<typename T >
PoolAllocator< T > sleipnir::GlobalPoolAllocator ( )

Returns an allocator for a global pool memory resource.

Template Parameters
TThe type of object in the pool.

◆ GlobalPoolResource()

SLEIPNIR_DLLEXPORT PoolResource & sleipnir::GlobalPoolResource ( )

Returns a global pool memory resource.

◆ hypot() [1/2]

SLEIPNIR_DLLEXPORT Variable sleipnir::hypot ( const Variable x,
const Variable y 
)
inline

std::hypot() for Variables.

Parameters
xThe x argument.
yThe y argument.

◆ hypot() [2/2]

SLEIPNIR_DLLEXPORT Variable sleipnir::hypot ( const Variable x,
const Variable y,
const Variable z 
)
inline

std::hypot() for Variables.

Parameters
xThe x argument.
yThe y argument.
zThe z argument.

◆ InteriorPoint()

SLEIPNIR_DLLEXPORT void sleipnir::InteriorPoint ( std::span< Variable decisionVariables,
std::span< Variable equalityConstraints,
std::span< Variable inequalityConstraints,
Variable f,
function_ref< bool(const SolverIterationInfo &info)>  callback,
const SolverConfig config,
bool  feasibilityRestoration,
Eigen::VectorXd &  x,
Eigen::VectorXd &  s,
SolverStatus status 
)

Finds the optimal solution to a nonlinear program using the interior-point method.

A nonlinear program has the form:

     min_x f(x)
subject to cₑ(x) = 0
           cᵢ(x) ≥ 0

where f(x) is the cost function, cₑ(x) are the equality constraints, and cᵢ(x) are the inequality constraints.

Parameters
[in]decisionVariablesThe list of decision variables.
[in]equalityConstraintsThe list of equality constraints.
[in]inequalityConstraintsThe list of inequality constraints.
[in]fThe cost function.
[in]callbackThe user callback.
[in]configConfiguration options for the solver.
[in]feasibilityRestorationWhether to use feasibility restoration instead of the normal algorithm.
[in,out]xThe initial guess and output location for the decision variables.
[in,out]sThe initial guess and output location for the inequality constraint slack variables.
[out]statusThe solver status.

◆ log()

SLEIPNIR_DLLEXPORT Variable sleipnir::log ( const Variable x)
inline

std::log() for Variables.

Parameters
xThe argument.

◆ log10()

SLEIPNIR_DLLEXPORT Variable sleipnir::log10 ( const Variable x)
inline

std::log10() for Variables.

Parameters
xThe argument.

◆ MakeConstraints()

template<typename LHS , typename RHS >
requires (ScalarLike<std::decay_t<LHS>> || MatrixLike<std::decay_t<LHS>>) && (ScalarLike<std::decay_t<RHS>> || MatrixLike<std::decay_t<RHS>>) && (!std::same_as<std::decay_t<LHS>, double> || !std::same_as<std::decay_t<RHS>, double>)
small_vector< Variable > sleipnir::MakeConstraints ( LHS &&  lhs,
RHS &&  rhs 
)

Make a list of constraints.

The standard form for equality constraints is c(x) = 0, and the standard form for inequality constraints is c(x) ≥ 0. This function takes constraints of the form lhs = rhs or lhs ≥ rhs and converts them to lhs - rhs = 0 or lhs - rhs ≥ 0.

Parameters
lhsLeft-hand side.
rhsRight-hand side.

◆ MakeIntrusiveShared()

template<typename T , typename... Args>
IntrusiveSharedPtr< T > sleipnir::MakeIntrusiveShared ( 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()

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
DecisionVariablesThe type containing the decision variable initial guess.
Parameters
solveA user-provided function that takes a decision variable initial guess and returns a MultistartResult.
initialGuessesA list of decision variable initial guesses to try.

◆ Newton()

SLEIPNIR_DLLEXPORT void sleipnir::Newton ( std::span< Variable decisionVariables,
Variable f,
function_ref< bool(const SolverIterationInfo &info)>  callback,
const SolverConfig config,
Eigen::VectorXd &  x,
SolverStatus status 
)

Finds the optimal solution to a nonlinear program using Newton's method.

A nonlinear program has the form:

     min_x f(x)

where f(x) is the cost function.

Parameters
[in]decisionVariablesThe list of decision variables.
[in]fThe cost function.
[in]callbackThe user callback.
[in]configConfiguration options for the solver.
[in,out]xThe initial guess and output location for the decision variables.
[out]statusThe solver status.

◆ operator+()

◆ operator-() [1/2]

◆ operator-() [2/2]

◆ operator<()

template<typename LHS , typename RHS >
requires (ScalarLike<std::decay_t<LHS>> || MatrixLike<std::decay_t<LHS>>) && (ScalarLike<std::decay_t<RHS>> || MatrixLike<std::decay_t<RHS>>) && (!std::same_as<std::decay_t<LHS>, double> || !std::same_as<std::decay_t<RHS>, double>)
InequalityConstraints sleipnir::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<std::decay_t<LHS>> || MatrixLike<std::decay_t<LHS>>) && (ScalarLike<std::decay_t<RHS>> || MatrixLike<std::decay_t<RHS>>) && (!std::same_as<std::decay_t<LHS>, double> || !std::same_as<std::decay_t<RHS>, double>)
InequalityConstraints sleipnir::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/8]

template<typename T , unsigned InlineCapacity, typename Allocator >
requires std::three_way_comparable<T>
constexpr auto sleipnir::operator<=> ( const small_vector< T, InlineCapacity, Allocator > &  lhs,
const small_vector< T, InlineCapacity, Allocator > &  rhs 
)
constexpr

◆ operator<=>() [2/8]

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr auto sleipnir::operator<=> ( const small_vector< T, InlineCapacity, Allocator > &  lhs,
const small_vector< T, InlineCapacity, Allocator > &  rhs 
)
constexpr

◆ operator<=>() [3/8]

template<typename T , unsigned InlineCapacityLHS, unsigned InlineCapacityRHS, typename Allocator >
requires std::three_way_comparable<T>
constexpr auto sleipnir::operator<=> ( const small_vector< T, InlineCapacityLHS, Allocator > &  lhs,
const small_vector< T, InlineCapacityRHS, Allocator > &  rhs 
)
constexpr

◆ operator<=>() [4/8]

template<typename T , unsigned InlineCapacityLHS, unsigned InlineCapacityRHS, typename Allocator >
constexpr auto sleipnir::operator<=> ( const small_vector< T, InlineCapacityLHS, Allocator > &  lhs,
const small_vector< T, InlineCapacityRHS, Allocator > &  rhs 
)
constexpr

◆ operator<=>() [5/8]

◆ operator<=>() [6/8]

template<typename Pointer , typename DifferenceType >
requires std::three_way_comparable<Pointer>
constexpr auto sleipnir::operator<=> ( const small_vector_iterator< Pointer, DifferenceType > &  lhs,
const small_vector_iterator< Pointer, DifferenceType > &  rhs 
)
constexprnoexcept

◆ operator<=>() [7/8]

◆ operator<=>() [8/8]

◆ operator==() [1/5]

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr bool sleipnir::operator== ( const small_vector< T, InlineCapacity, Allocator > &  lhs,
const small_vector< T, InlineCapacity, Allocator > &  rhs 
)
inlineconstexpr

◆ operator==() [2/5]

template<typename T , unsigned InlineCapacityLHS, unsigned InlineCapacityRHS, typename Allocator >
constexpr bool sleipnir::operator== ( const small_vector< T, InlineCapacityLHS, Allocator > &  lhs,
const small_vector< T, InlineCapacityRHS, Allocator > &  rhs 
)
inlineconstexpr

◆ operator==() [3/5]

template<typename Pointer , typename DifferenceType >
requires requires { { lhs.base() == rhs.base() } -> std::convertible_to<bool>; }
constexpr bool sleipnir::operator== ( const small_vector_iterator< Pointer, DifferenceType > &  lhs,
const small_vector_iterator< Pointer, DifferenceType > &  rhs 
)
constexprnoexcept

◆ operator==() [4/5]

template<typename PointerLHS , typename DifferenceTypeLHS , typename PointerRHS , typename DifferenceTypeRHS >
requires requires { { lhs.base() == rhs.base() } -> std::convertible_to<bool>; }
constexpr bool sleipnir::operator== ( const small_vector_iterator< PointerLHS, DifferenceTypeLHS > &  lhs,
const small_vector_iterator< PointerRHS, DifferenceTypeRHS > &  rhs 
)
constexprnoexcept

◆ operator==() [5/5]

template<typename LHS , typename RHS >
requires (ScalarLike<std::decay_t<LHS>> || MatrixLike<std::decay_t<LHS>>) && (ScalarLike<std::decay_t<RHS>> || MatrixLike<std::decay_t<RHS>>) && (!std::same_as<std::decay_t<LHS>, double> || !std::same_as<std::decay_t<RHS>, double>)
EqualityConstraints sleipnir::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<std::decay_t<LHS>> || MatrixLike<std::decay_t<LHS>>) && (ScalarLike<std::decay_t<RHS>> || MatrixLike<std::decay_t<RHS>>) && (!std::same_as<std::decay_t<LHS>, double> || !std::same_as<std::decay_t<RHS>, double>)
InequalityConstraints sleipnir::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>=()

template<typename LHS , typename RHS >
requires (ScalarLike<std::decay_t<LHS>> || MatrixLike<std::decay_t<LHS>>) && (ScalarLike<std::decay_t<RHS>> || MatrixLike<std::decay_t<RHS>>) && (!std::same_as<std::decay_t<LHS>, double> || !std::same_as<std::decay_t<RHS>, double>)
InequalityConstraints sleipnir::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()

SLEIPNIR_DLLEXPORT Variable sleipnir::pow ( const Variable base,
const Variable power 
)
inline

std::pow() for Variables.

Parameters
baseThe base.
powerThe power.

◆ print() [1/2]

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

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

◆ print() [2/2]

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

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

◆ println() [1/2]

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

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

◆ println() [2/2]

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

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

◆ rbegin() [1/2]

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_reverse_iterator sleipnir::rbegin ( const small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ rbegin() [2/2]

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::reverse_iterator sleipnir::rbegin ( small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ rend() [1/2]

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::const_reverse_iterator sleipnir::rend ( const small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ rend() [2/2]

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::reverse_iterator sleipnir::rend ( small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ RK4()

State sleipnir::RK4 ( F &&  f,
State  x,
Input  u,
Time  t0,
Time  dt 
)

Performs 4th order Runge-Kutta integration of dx/dt = f(t, x, u) for dt.

Parameters
fThe function to integrate. It must take two arguments x and u.
xThe initial value of x.
uThe value u held constant over the integration period.
t0The initial time.
dtThe time over which to integrate.

◆ sign()

SLEIPNIR_DLLEXPORT Variable sleipnir::sign ( const Variable x)
inline

sign() for Variables.

Parameters
xThe argument.

◆ sin()

SLEIPNIR_DLLEXPORT Variable sleipnir::sin ( const Variable x)
inline

std::sin() for Variables.

Parameters
xThe argument.

◆ sinh()

SLEIPNIR_DLLEXPORT Variable sleipnir::sinh ( const Variable x)
inline

std::sinh() for Variables.

Parameters
xThe argument.

◆ size()

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr small_vector< T, InlineCapacity, Allocator >::size_type sleipnir::size ( const small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ small_vector()

template<typename InputIt , unsigned InlineCapacity = default_buffer_size_v< std::allocator<typename std::iterator_traits<InputIt>::value_type>>, typename Allocator = std::allocator<typename std::iterator_traits<InputIt>::value_type>>
sleipnir::small_vector ( InputIt  ,
InputIt  ,
Allocator  = Allocator() 
) -> small_vector< typename std::iterator_traits< InputIt >::value_type, InlineCapacity, Allocator >

◆ Solve()

Solves the VariableMatrix equation AX = B for X.

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

◆ SQP()

SLEIPNIR_DLLEXPORT void sleipnir::SQP ( std::span< Variable decisionVariables,
std::span< Variable equalityConstraints,
Variable f,
function_ref< bool(const SolverIterationInfo &info)>  callback,
const SolverConfig config,
Eigen::VectorXd &  x,
SolverStatus status 
)

Finds the optimal solution to a nonlinear program using Sequential Quadratic Programming (SQP).

A nonlinear program has the form:

     min_x f(x)
subject to cₑ(x) = 0

where f(x) is the cost function and cₑ(x) are the equality constraints.

Parameters
[in]decisionVariablesThe list of decision variables.
[in]equalityConstraintsThe list of equality constraints.
[in]fThe cost function.
[in]callbackThe user callback.
[in]configConfiguration options for the solver.
[in,out]xThe initial guess and output location for the decision variables.
[out]statusThe solver status.

◆ sqrt()

SLEIPNIR_DLLEXPORT Variable sleipnir::sqrt ( const Variable x)
inline

std::sqrt() for Variables.

Parameters
xThe argument.

◆ ssize()

template<typename T , unsigned InlineCapacity, typename Allocator >
constexpr std::common_type_t< std::ptrdiff_t, typename std::make_signed_t< typename small_vector< T, InlineCapacity, Allocator >::size_type > > sleipnir::ssize ( const small_vector< T, InlineCapacity, Allocator > &  v)
constexprnoexcept

◆ swap() [1/2]

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

Swaps the referred callables of lhs and rhs.

◆ swap() [2/2]

template<typename T , unsigned InlineCapacity, typename Allocator >
requires concepts::MoveInsertable< T, small_vector<T, InlineCapacity, Allocator>, Allocator> && concepts::Swappable<T>
constexpr void sleipnir::swap ( small_vector< T, InlineCapacity, Allocator > &  lhs,
small_vector< T, InlineCapacity, Allocator > &  rhs 
)
inlineconstexprnoexcept

◆ tan()

SLEIPNIR_DLLEXPORT Variable sleipnir::tan ( const Variable x)
inline

std::tan() for Variables.

Parameters
xThe argument.

◆ tanh()

SLEIPNIR_DLLEXPORT Variable sleipnir::tanh ( const Variable x)
inline

std::tanh() for Variables.

Parameters
xThe argument.

◆ ToMessage()

SLEIPNIR_DLLEXPORT constexpr std::string_view sleipnir::ToMessage ( const SolverExitCondition exitCondition)
constexpr

Returns user-readable message corresponding to the exit condition.

Parameters
exitConditionSolver exit condition.

Variable Documentation

◆ default_buffer_size_v

template<typename Allocator >
constexpr unsigned sleipnir::default_buffer_size_v
inlineconstexpr
Initial value:
=
default_buffer_size<Allocator>::value

◆ Hessian

◆ Jacobian