Skip to content

Commit

Permalink
added bindings for dx and du
Browse files Browse the repository at this point in the history
  • Loading branch information
ajordana committed Aug 7, 2024
1 parent 0fd1e75 commit ca179ab
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
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

0 comments on commit ca179ab

Please sign in to comment.