A simplified interface for NLP modeling/solving. More...
#include <optistack_internal.hpp>
Extra doc: https://github.com/casadi/casadi/wiki/L_172
Definition at line 55 of file optistack_internal.hpp.
Public Member Functions | |
OptiNode (const std::string &problem_type) | |
Create Opti Context. More... | |
~OptiNode () | |
Destructor. More... | |
MX | variable (casadi_int n=1, casadi_int m=1, const std::string &attribute="full") |
Create a decision variable (symbol) More... | |
MX | parameter (casadi_int n=1, casadi_int m=1, const std::string &attribute="full") |
Create a parameter (symbol); fixed during optimization. More... | |
void | minimize (const MX &f) |
Set objective. More... | |
void | subject_to (const MX &g) |
brief Add constraints More... | |
void | subject_to () |
Clear constraints. More... | |
void | solver (const std::string &solver, const Dict &plugin_options=Dict(), const Dict &solver_options=Dict()) |
Solver. More... | |
void | set_domain (const MX &x, const std::string &domain) |
Set domain of variable. More... | |
OptiSol | solve (bool accept_limit) |
Crunch the numbers; solve the problem. More... | |
Opti | copy () const |
Copy. More... | |
Dict | stats () const |
Get statistics. More... | |
std::string | return_status () const |
Get return status of solver. More... | |
bool | return_success (bool accept_limit) const |
Did the solver return successfully? More... | |
Function | casadi_solver () const |
Get the underlying CasADi solver of the Opti stack. More... | |
std::vector< MX > | initial () const |
get assignment expressions for initial values More... | |
std::vector< MX > | value_variables () const |
get assignment expressions for latest values More... | |
std::vector< MX > | value_parameters () const |
void | callback_class (OptiCallback *callback) |
void | callback_class () |
bool | has_callback_class () const |
bool | is_parametric (const MX &expr) const |
return true if expression is only dependant on Opti parameters, not variables More... | |
MetaCon | canon_expr (const MX &expr) const |
Interpret an expression (for internal use only) More... | |
MetaVar | get_meta (const MX &m) const |
Get meta-data of symbol (for internal use only) More... | |
MetaCon | get_meta_con (const MX &m) const |
Get meta-data of symbol (for internal use only) More... | |
void | set_meta (const MX &m, const MetaVar &meta) |
Set meta-data of an expression. More... | |
void | set_meta_con (const MX &m, const MetaCon &meta) |
Set meta-data of an expression. More... | |
void | update_user_dict (const MX &m, const Dict &meta) |
add meta-data of an expression More... | |
Dict | user_dict (const MX &m) const |
MX | dual (const MX &m) const |
get the dual variable More... | |
void | assert_active_symbol (const MX &m) const |
std::vector< MX > | active_symvar (VariableType type) const |
std::vector< DM > | active_values (VariableType type) const |
MX | x_lookup (casadi_int i) const |
MX | g_lookup (casadi_int i) const |
std::string | x_describe (casadi_int i) const |
std::string | g_describe (casadi_int i) const |
std::string | describe (const MX &x, casadi_int indent=0) const |
void | solve_prepare () |
Function | solver_construct (bool callback=true) |
DMDict | solve_actual (const DMDict &args) |
DMDict | arg () const |
void | res (const DMDict &res) |
DMDict | res () const |
std::vector< MX > | constraints () const |
MX | objective () const |
OptiAdvanced | baked_copy () const |
std::string | class_name () const override |
casadi_int | nx () const |
Number of (scalarised) decision variables. More... | |
casadi_int | np () const |
Number of (scalarised) parameters. More... | |
casadi_int | ng () const |
Number of (scalarised) constraints. More... | |
MX | x () const |
Get all (scalarised) decision variables as a symbolic column vector. More... | |
MX | p () const |
Get all (scalarised) parameters as a symbolic column vector. More... | |
MX | g () const |
Get all (scalarised) constraint expressions as a column vector. More... | |
MX | f () const |
Get objective expression. More... | |
MX | lbg () const |
MX | ubg () const |
MX | lam_g () const |
Get dual variables as a symbolic column vector. More... | |
void | assert_empty () const |
Function | to_function (const std::string &name, const std::vector< MX > &args, const std::vector< MX > &res, const std::vector< std::string > &name_in, const std::vector< std::string > &name_out, const Dict &opts) |
Create a CasADi Function from the Opti solver. More... | |
void | disp (std::ostream &stream, bool more=false) const override |
Print representation. More... | |
void | bake () |
Fix the structure of the optimization problem. More... | |
casadi_int | instance_number () const |
void | mark_problem_dirty (bool flag=true) |
bool | problem_dirty () const |
void | mark_solver_dirty (bool flag=true) |
bool | solver_dirty () const |
void | mark_solved (bool flag=true) |
bool | solved () const |
void | assert_solved () const |
void | assert_baked () const |
void | set_initial (const MX &x, const DM &v) |
void | set_initial (const std::vector< MX > &assignments) |
void | set_value (const MX &x, const DM &v) |
Set value of parameter. More... | |
void | set_value (const std::vector< MX > &assignments) |
Set value of parameter. More... | |
DM | value (const MX &x, const std::vector< MX > &values=std::vector< MX >()) const |
DM | value (const DM &x, const std::vector< MX > &values=std::vector< MX >()) const |
DM | value (const SX &x, const std::vector< MX > &values=std::vector< MX >()) const |
std::vector< MX > | symvar () const |
std::vector< MX > | symvar (const MX &expr) const |
std::vector< MX > | symvar (const MX &expr, VariableType type) const |
Static Public Member Functions | |
static OptiNode * | create (const std::string &problem_type) |
Public Attributes | |
bool | problem_dirty_ |
bool | solver_dirty_ |
bool | solved_ |
Friends | |
class | InternalOptiCallback |
casadi::OptiNode::OptiNode | ( | const std::string & | problem_type | ) |
casadi::OptiNode::~OptiNode | ( | ) |
std::vector<MX> casadi::OptiNode::active_symvar | ( | VariableType | type | ) | const |
std::vector<DM> casadi::OptiNode::active_values | ( | VariableType | type | ) | const |
|
inline |
Definition at line 189 of file optistack_internal.hpp.
void casadi::OptiNode::assert_active_symbol | ( | const MX & | m | ) | const |
void casadi::OptiNode::assert_baked | ( | ) | const |
void casadi::OptiNode::assert_empty | ( | ) | const |
void casadi::OptiNode::assert_solved | ( | ) | const |
void casadi::OptiNode::bake | ( | ) |
|
inline |
Definition at line 195 of file optistack_internal.hpp.
void casadi::OptiNode::callback_class | ( | ) |
void casadi::OptiNode::callback_class | ( | OptiCallback * | callback | ) |
Function casadi::OptiNode::casadi_solver | ( | ) | const |
|
inlineoverride |
Definition at line 201 of file optistack_internal.hpp.
|
inline |
Definition at line 192 of file optistack_internal.hpp.
Opti casadi::OptiNode::copy | ( | ) | const |
|
static |
std::string casadi::OptiNode::describe | ( | const MX & | x, |
casadi_int | indent = 0 |
||
) | const |
|
override |
|
inline |
Definition at line 240 of file optistack_internal.hpp.
|
inline |
Definition at line 234 of file optistack_internal.hpp.
std::string casadi::OptiNode::g_describe | ( | casadi_int | i | ) | const |
MX casadi::OptiNode::g_lookup | ( | casadi_int | i | ) | const |
bool casadi::OptiNode::has_callback_class | ( | ) | const |
std::vector<MX> casadi::OptiNode::initial | ( | ) | const |
casadi_int casadi::OptiNode::instance_number | ( | ) | const |
bool casadi::OptiNode::is_parametric | ( | const MX & | expr | ) | const |
|
inline |
Definition at line 256 of file optistack_internal.hpp.
|
inline |
Definition at line 245 of file optistack_internal.hpp.
|
inline |
Definition at line 283 of file optistack_internal.hpp.
|
inline |
Definition at line 291 of file optistack_internal.hpp.
|
inline |
Definition at line 287 of file optistack_internal.hpp.
void casadi::OptiNode::minimize | ( | const MX & | f | ) |
|
inline |
Definition at line 216 of file optistack_internal.hpp.
|
inline |
Definition at line 210 of file optistack_internal.hpp.
|
inline |
Definition at line 204 of file optistack_internal.hpp.
|
inline |
Definition at line 193 of file optistack_internal.hpp.
|
inline |
Definition at line 228 of file optistack_internal.hpp.
MX casadi::OptiNode::parameter | ( | casadi_int | n = 1 , |
casadi_int | m = 1 , |
||
const std::string & | attribute = "full" |
||
) |
|
inline |
Definition at line 284 of file optistack_internal.hpp.
|
inline |
Definition at line 191 of file optistack_internal.hpp.
void casadi::OptiNode::res | ( | const DMDict & | res | ) |
std::string casadi::OptiNode::return_status | ( | ) | const |
bool casadi::OptiNode::return_success | ( | bool | accept_limit | ) | const |
void casadi::OptiNode::set_domain | ( | const MX & | x, |
const std::string & | domain | ||
) |
Set initial value for decision variables
void casadi::OptiNode::set_initial | ( | const std::vector< MX > & | assignments | ) |
Set initial value for decision variables
Each parameter must be given a value before 'solve' can be called
Extra doc: https://github.com/casadi/casadi/wiki/L_173
void casadi::OptiNode::set_value | ( | const std::vector< MX > & | assignments | ) |
Each parameter must be given a value before 'solve' can be called
Extra doc: https://github.com/casadi/casadi/wiki/L_173
OptiSol casadi::OptiNode::solve | ( | bool | accept_limit | ) |
void casadi::OptiNode::solve_prepare | ( | ) |
|
inline |
Definition at line 292 of file optistack_internal.hpp.
void casadi::OptiNode::solver | ( | const std::string & | solver, |
const Dict & | plugin_options = Dict() , |
||
const Dict & | solver_options = Dict() |
||
) |
Function casadi::OptiNode::solver_construct | ( | bool | callback = true | ) |
|
inline |
Definition at line 288 of file optistack_internal.hpp.
Dict casadi::OptiNode::stats | ( | ) | const |
void casadi::OptiNode::subject_to | ( | ) |
void casadi::OptiNode::subject_to | ( | const MX & | g | ) |
std::vector<MX> casadi::OptiNode::symvar | ( | ) | const |
Get symbols present in expression
std::vector<MX> casadi::OptiNode::symvar | ( | const MX & | expr, |
VariableType | type | ||
) | const |
Get symbols present in expression
Function casadi::OptiNode::to_function | ( | const std::string & | name, |
const std::vector< MX > & | args, | ||
const std::vector< MX > & | res, | ||
const std::vector< std::string > & | name_in, | ||
const std::vector< std::string > & | name_out, | ||
const Dict & | opts | ||
) |
Extra doc: https://github.com/casadi/casadi/wiki/L_174
|
inline |
Definition at line 250 of file optistack_internal.hpp.
|
inline |
Obtain value of expression at the current value
Definition at line 110 of file optistack_internal.hpp.
DM casadi::OptiNode::value | ( | const MX & | x, |
const std::vector< MX > & | values = std::vector< MX >() |
||
) | const |
Obtain value of expression at the current value
|
inline |
Obtain value of expression at the current value
Definition at line 111 of file optistack_internal.hpp.
std::vector<MX> casadi::OptiNode::value_parameters | ( | ) | const |
std::vector<MX> casadi::OptiNode::value_variables | ( | ) | const |
MX casadi::OptiNode::variable | ( | casadi_int | n = 1 , |
casadi_int | m = 1 , |
||
const std::string & | attribute = "full" |
||
) |
|
inline |
Definition at line 222 of file optistack_internal.hpp.
std::string casadi::OptiNode::x_describe | ( | casadi_int | i | ) | const |
MX casadi::OptiNode::x_lookup | ( | casadi_int | i | ) | const |
|
friend |
Definition at line 57 of file optistack_internal.hpp.
bool casadi::OptiNode::problem_dirty_ |
Definition at line 282 of file optistack_internal.hpp.
bool casadi::OptiNode::solved_ |
Definition at line 290 of file optistack_internal.hpp.
bool casadi::OptiNode::solver_dirty_ |
Definition at line 286 of file optistack_internal.hpp.