Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added bindings for dx and du #31

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bindings/csqp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ void exposeSolverCSQP() {
"Additional iteration if SQP max. iter reached (default: False)")
.add_property("xs", make_function(&SolverCSQP::get_xs, bp::return_value_policy<bp::copy_const_reference>()), bp::make_function(&SolverCSQP::set_xs), "xs")
.add_property("us", make_function(&SolverCSQP::get_us, bp::return_value_policy<bp::copy_const_reference>()), bp::make_function(&SolverCSQP::set_us), "us")
.add_property("dx_tilde", make_function(&SolverCSQP::get_xs_tilde, bp::return_value_policy<bp::copy_const_reference>()), "dx_tilde")
.add_property("du_tilde", make_function(&SolverCSQP::get_us_tilde, bp::return_value_policy<bp::copy_const_reference>()), "du_tilde")

.add_property("dx_tilde", make_function(&SolverCSQP::get_dx_tilde, bp::return_value_policy<bp::copy_const_reference>()), "dx_tilde")
.add_property("du_tilde", make_function(&SolverCSQP::get_du_tilde, bp::return_value_policy<bp::copy_const_reference>()), "du_tilde")
.add_property("dx", make_function(&SolverCSQP::get_dx, bp::return_value_policy<bp::copy_const_reference>()), "dx")
.add_property("du", make_function(&SolverCSQP::get_du, bp::return_value_policy<bp::copy_const_reference>()), "du")


.add_property("constraint_norm", bp::make_function(&SolverCSQP::get_constraint_norm),
Expand Down
3 changes: 3 additions & 0 deletions bindings/sqp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ void exposeSolverSQP() {
.def_readwrite("fs_try", &SolverSQP::fs_try_, "fs_try")
.def_readwrite("lag_mul", &SolverSQP::lag_mul_, "lagrange multipliers")

.add_property("dx", make_function(&SolverSQP::get_dx, bp::return_value_policy<bp::copy_const_reference>()), "dx")
.add_property("du", make_function(&SolverSQP::get_du, bp::return_value_policy<bp::copy_const_reference>()), "du")

.add_property("KKT", bp::make_function(&SolverSQP::get_KKT),
"KKT residual norm")

Expand Down
7 changes: 5 additions & 2 deletions include/mim_solvers/csqp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,11 @@ class SolverCSQP : public SolverDDP {
const std::vector<Eigen::VectorXd>& get_xs() const { return xs_; };
const std::vector<Eigen::VectorXd>& get_us() const { return us_; };

const std::vector<Eigen::VectorXd>& get_xs_tilde() const { return dxtilde_; };
const std::vector<Eigen::VectorXd>& get_us_tilde() const { return dutilde_; };
const std::vector<Eigen::VectorXd>& get_dx_tilde() const { return dxtilde_; };
const std::vector<Eigen::VectorXd>& get_du_tilde() const { return dutilde_; };

const std::vector<Eigen::VectorXd>& get_dx() const { return dx_; };
const std::vector<Eigen::VectorXd>& get_du() const { return du_; };

const std::vector<Eigen::VectorXd>& get_y() const { return y_; };
const std::vector<Eigen::VectorXd>& get_z() const { return z_; };
Expand Down
3 changes: 3 additions & 0 deletions include/mim_solvers/sqp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ class SolverSQP : public SolverDDP {
const std::vector<Eigen::VectorXd>& get_xs_try() const { return xs_try_; };
const std::vector<Eigen::VectorXd>& get_us_try() const { return us_try_; };

const std::vector<Eigen::VectorXd>& get_dx() const { return dx_; };
const std::vector<Eigen::VectorXd>& get_du() const { return du_; };

double get_KKT() const { return KKT_; };
double get_gap_norm() const { return gap_norm_; };
double get_xgrad_norm() const { return x_grad_norm_; };
Expand Down