COPP C++ API 0.2.3
C++ interface for COPP trajectory optimization
Loading...
Searching...
No Matches
copp3_socp.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <initializer_list>
4#include <vector>
5
6#include "copp/clarabel.hpp"
8#include "copp/objective.hpp"
9#include "copp/robot.hpp"
10#include "copp/solver/topp3.hpp"
11
13{
14
17
41 {
42 public:
44 Robot &robot,
45 std::vector<Objective> objectives,
47 std::size_t idx_s_start = 0,
49 StationaryBounds num_stationary_max = {},
50 double a_linearization_floor = 1.0e-10,
51 Span<const double> b_linearization = {});
52
54 Robot &robot,
55 std::initializer_list<Objective> objectives,
57 std::size_t idx_s_start = 0,
59 StationaryBounds num_stationary_max = {},
60 double a_linearization_floor = 1.0e-10,
61 Span<const double> b_linearization = {});
62
64 Robot &robot,
65 std::vector<Objective> objectives,
67 std::size_t idx_s_start,
69 std::size_t symmetric_num_stationary_max,
70 double a_linearization_floor = 1.0e-10,
72
73 Robot &robot() const noexcept { return *robot_; }
74 const std::vector<Objective> &objectives() const noexcept { return objectives_; }
75 const std::vector<double> &a_linearization() const noexcept { return a_linearization_; }
77 const std::vector<double> &b_linearization() const noexcept { return b_linearization_; }
78 std::size_t idx_s_start() const noexcept { return idx_s_start_; }
79 std::size_t idx_s_final() const noexcept { return idx_s_final_; }
80 Boundary3 boundary() const noexcept { return boundary_; }
81 StationaryBounds num_stationary_max() const noexcept { return num_stationary_max_; }
82 StationaryBounds num_stationary() const noexcept { return num_stationary_; }
83 double a_linearization_floor() const noexcept { return a_linearization_floor_; }
84 std::size_t s_len() const noexcept { return a_linearization_.size(); }
85
86 private:
87 Robot *robot_ = nullptr;
88 std::vector<Objective> objectives_;
89 std::vector<double> a_linearization_;
90 std::vector<double> b_linearization_;
91 std::size_t idx_s_start_ = 0;
92 std::size_t idx_s_final_ = 0;
93 Boundary3 boundary_;
94 StationaryBounds num_stationary_max_;
95 StationaryBounds num_stationary_;
96 double a_linearization_floor_ = 1.0e-10;
97 };
98
103 COPP_API Profile3rd solve(const Problem &problem, const clarabel::Options &options = {});
105 const Problem &problem,
106 const clarabel::Options &options,
108 {
109 return detail::expected_from([&] { return solve(problem, options); });
110 }
111 inline Expected<Profile3rd> solve(const Problem &problem, NoThrowTag tag)
112 {
113 return solve(problem, clarabel::Options{}, tag);
114 }
115
120 COPP_API Result solve_expert(const Problem &problem, const clarabel::Options &options = {});
122 const Problem &problem,
123 const clarabel::Options &options,
125 {
126 return detail::expected_from([&] { return solve_expert(problem, options); });
127 }
129 {
130 return solve_expert(problem, clarabel::Options{}, tag);
131 }
132
133} // namespace copp::solver::copp3_socp
Small C++17 expected-like result used by no-throw overloads.
Definition core.hpp:527
Robot facade backed by Rust Robot<CppRobotModel>.
Definition robot.hpp:375
Non-owning view of a contiguous one-dimensional array.
Definition core.hpp:139
COPP3-SOCP problem descriptor.
StationaryBounds num_stationary_max() const noexcept
std::size_t idx_s_start() const noexcept
Problem(Robot &robot, std::vector< Objective > objectives, Span< const double > a_linearization, std::size_t idx_s_start, Boundary3 boundary, std::size_t symmetric_num_stationary_max, double a_linearization_floor=1.0e-10, Span< const double > b_linearization={})
const std::vector< double > & a_linearization() const noexcept
const std::vector< Objective > & objectives() const noexcept
Robot & robot() const noexcept
std::size_t s_len() const noexcept
double a_linearization_floor() const noexcept
const std::vector< double > & b_linearization() const noexcept
Copied b_linearization; empty when direct linearization is used.
std::size_t idx_s_final() const noexcept
Problem(Robot &robot, std::vector< Objective > objectives, Span< const double > a_linearization, std::size_t idx_s_start=0, Boundary3 boundary={}, StationaryBounds num_stationary_max={}, double a_linearization_floor=1.0e-10, Span< const double > b_linearization={})
Boundary3 boundary() const noexcept
StationaryBounds num_stationary() const noexcept
Problem(Robot &robot, std::initializer_list< Objective > objectives, Span< const double > a_linearization, std::size_t idx_s_start=0, Boundary3 boundary={}, StationaryBounds num_stationary_max={}, double a_linearization_floor=1.0e-10, Span< const double > b_linearization={})
#define COPP_API
Definition core.hpp:23
auto expected_from(Fn &&fn) -> Expected< typename std::decay< decltype(fn())>::type >
Definition core.hpp:580
Third-order convex-objective Clarabel SOCP backend with COPP objective support and expert objective/s...
COPP_API Result solve_expert(const Problem &problem, const clarabel::Options &options={})
Solve COPP3-SOCP and always return Clarabel diagnostics.
copp::solver::topp3::Result Result
copp::solver::topp3::StationaryBounds StationaryBounds
COPP_API Profile3rd solve(const Problem &problem, const clarabel::Options &options={})
Solve COPP3-SOCP and return an accepted third-order profile.
Third-order endpoint boundary values.
Definition core.hpp:87
Tag object selecting no-throw overloads.
Definition core.hpp:608
Owned third-order TOPP/COPP profile.
Shared Clarabel options for COPP/TOPP SOCP-style solvers.
Definition clarabel.hpp:117
Expert third-order Clarabel result.
Definition topp3.hpp:134
User-supplied upper bound for stationary boundary intervals.
Definition topp3.hpp:25