#include <iostream>
#include <vector>
#include <copp/copp.hpp>
int main()
{
std::vector<double> s{0.0, 0.5, 1.0};
std::vector<double> amax{1.0, 1.0, 1.0};
std::vector<double> a0{0.25, 0.25, 0.25};
copp::Constraints constraints(1, s.size());
constraints.append_s(s)
.add_constraint_1st(amax, 0);
const copp::Boundary3 boundary{0.25, 0.25, 0.0, 0.0};
copp::clarabel::Options options;
options.allow_almost_solved = true;
copp::solver::topp3::Problem first_problem{
constraints.ref(),
a0,
0,
boundary,
};
auto profile1 = copp::solver::topp3_socp::solve(first_problem, options);
copp::solver::topp3::Problem second_problem{
constraints.ref(),
profile1.a,
0,
boundary,
};
auto profile2 = copp::solver::topp3_socp::solve(second_problem, options);
auto time = copp::interpolation::s_to_t_topp3(s, profile2, 0.0);
std::cout << "TOPP3-SOCP done with 2 refinement rounds.\n";
std::cout << "profile length = " << profile2.len() << "\n";
std::cout << "t_final = " << time.t_final << "\n";
return 0;
}