CasADi in C++: How do I access the MX symbols with its name?

37 views
Skip to first unread message

YZ He

unread,
Mar 27, 2023, 4:38:20 PM3/27/23
to CasADi
Hi everyone,

I have a optimization variable that is composed of 3 MX symbols. 

casadi::MX opt_u = casadi::MX::sym("u", nu*horizon, 1);
casadi::MX opt_y = casadi::MX::sym("y", ny*horizon, 1);
casadi::MX opt_g = casadi::MX::sym("g", this->U_f.cols());

this->opti_vars = casadi::MX::vertcat({opt_u, opt_y, opt_g});

Is there a way to access each variable like opti_vars["u"] in Python? Thanks in advance.
Reply all
Reply to author
Forward
0 new messages