Functions | |
| CASADI_EXPORT Function | casadi::rootfinder (const std::string &name, const std::string &solver, const SXDict &rfp, const Dict &opts=Dict()) |
| CASADI_EXPORT Function | casadi::rootfinder (const std::string &name, const std::string &solver, const MXDict &rfp, const Dict &opts=Dict()) |
| CASADI_EXPORT Function | casadi::rootfinder (const std::string &name, const std::string &solver, const Function &f, const Dict &opts=Dict()) |
| CASADI_EXPORT std::vector< std::string > | casadi::rootfinder_in () |
| Get the rootfinder input scheme. More... | |
| CASADI_EXPORT std::vector< std::string > | casadi::rootfinder_out () |
| Get the rootfinder output scheme. More... | |
| CASADI_EXPORT std::string | casadi::rootfinder_in (casadi_int ind) |
| Get the name of a rootfinder input by index. More... | |
| CASADI_EXPORT std::string | casadi::rootfinder_out (casadi_int ind) |
| Get the name of a rootfinder output by index. More... | |
| CASADI_EXPORT casadi_int | casadi::rootfinder_n_in () |
| Number of rootfinder inputs. More... | |
| CASADI_EXPORT casadi_int | casadi::rootfinder_n_out () |
| Number of rootfinder outputs. More... | |
| CASADI_EXPORT std::vector< std::string > | casadi::rootfinder_options (const std::string &name) |
| Get all options of a rootfinder plugin. More... | |
| CASADI_EXPORT std::string | casadi::rootfinder_option_type (const std::string &name, const std::string &op) |
| Get the type of an option of a rootfinder plugin. More... | |
| CASADI_EXPORT std::string | casadi::rootfinder_option_info (const std::string &name, const std::string &op) |
| Get the documentation string of an option of a rootfinder plugin. More... | |
| CASADI_EXPORT bool | casadi::has_rootfinder (const std::string &name) |
| Check if a rootfinder plugin is available. More... | |
| CASADI_EXPORT void | casadi::load_rootfinder (const std::string &name) |
| Explicitly load a rootfinder plugin. More... | |
| CASADI_EXPORT std::string | casadi::doc_rootfinder (const std::string &name) |
| Get the documentation string of a rootfinder plugin. More... | |
Create a solver for rootfinding problems
Returns a Function that solves a system of nonlinear equations g(x, p) = 0 for x, given the parameters p and an initial guess for x. The problem is given as a dictionary with fields "x" (unknowns, dense column vector), "g" (residual, dense column vector of the same size) and optionally "p" (parameters); any other field name is an error. The returned Function has inputs x0 (the guess) and p, and output x (see rootfinder_in and rootfinder_out). Omitted inputs are zero.
More generally, the problem is given as a Function [y0, y1, ..., yi, ..., yn] = F(x0, x1, ..., xj, ..., xm) where input xj is unknown and output yi is the residual that must be zero. The result is [y0, y1, ..., xj, ..., yn] = G(x0, x1, ..., xj_guess, ..., xm): the unknown input is replaced by a guess (its name gets a "0" suffix) and the residual output is replaced by the solution (named like the unknown input); the other inputs and outputs are passed through. By default j = 0 and i = 0; options "implicit_input" and "implicit_output" select other indices. xj and yi must be dense column vectors of the same size and d(yi)/d(xj) must be structurally and numerically invertible: a structurally rank-deficient Jacobian is an error at construction, a singular one makes the plugin fail.
The call can be embedded in an MX expression and differentiated: derivatives follow from the implicit function theorem, using the linear solver chosen with "linear_solver". "error_on_fail" defaults to true: a solve that does not converge raises; with false the last iterate is returned and stats() reports "success" and "return_status".
Options common to all plugins (the plugin options follow in the tables below):
* >>> x = SX.sym("x"); p = SX.sym("p")
* >>> G = rootfinder("G", "newton", {"x": x, "p": p, "g": x**2 - p})
* >>> G
* Function(G:(x0,p)->(x) Newton)
* >>> G(x0=1, p=2)["x"], G(1, 2)
* (DM(1.4142), DM(1.4142))
* >>> G.stats()["success"], G.stats()["return_status"]
* (True, 'success')
* >>> pm = MX.sym("p")
* >>> dxdp = Function("dxdp", [pm], [jacobian(G(x0=1, p=pm)["x"], pm)])
* >>> dxdp(4)
* DM(0.25)
* >>> f = Function("f", [x, p], [x**2 - p, 3*x], ["x", "p"], ["g", "h"])
* >>> G = rootfinder("G", "newton", f)
* >>> G
* Function(G:(x0,p)->(x,h) Newton)
* >>> G(x0=1, p=4)
* {'h': DM(6), 'x': DM(2)}
* >>> f = Function("f", [p, x], [3*x, x**2 - p], ["p", "x"], ["h", "g"])
* >>> G = rootfinder("G", "newton", f, {"implicit_input": 1, "implicit_output": 1})
* >>> G
* Function(G:(p,x0)->(h,x) Newton)
*
* >> x = SX.sym('x'); p = SX.sym('p');
* >> G = rootfinder('G', 'newton', struct('x', x, 'p', p, 'g', x^2 - p)); disp(G)
* G:(x0,p)->(x) Newton
* >> r = G('x0', 1, 'p', 2); r.x, G(1, 2)
* 1.4142
* 1.4142
* >> st = G.stats(); disp(st.success), disp(st.return_status)
* 1
* success
* >> pm = MX.sym('p'); r = G('x0', 1, 'p', pm);
* >> dxdp = Function('dxdp', {pm}, {jacobian(r.x, pm)}); disp(dxdp(4))
* 0.25
* >> f = Function('f', {x, p}, {x^2 - p, 3*x}, {'x', 'p'}, {'g', 'h'});
* >> G = rootfinder('G', 'newton', f); disp(G)
* G:(x0,p)->(x,h) Newton
* >> r = G('x0', 1, 'p', 4); disp(r.x), disp(r.h)
* 2
* 6
* >> f = Function('f', {p, x}, {3*x, x^2 - p}, {'p', 'x'}, {'h', 'g'});
* >> G = rootfinder('G', 'newton', f, struct('implicit_input', 1, 'implicit_output', 1)); disp(G)
* G:(p,x0)->(h,x) Newton
*
* julia> x = ca.SX.sym("x"); p = ca.SX.sym("p");
* julia> G = ca.rootfinder("G", "newton", Dict("x" => x, "p" => p, "g" => x^2 - p))
* Function(G:(x0,p)->(x) Newton)
* julia> G(x0=1, p=2)["x"], G(1, 2)
* (1.4142, 1.4142)
* julia> ca.stats(G)["success"], ca.stats(G)["return_status"]
* (true, "success")
* julia> pm = ca.MX.sym("p");
* julia> dxdp = ca.Function("dxdp", [pm], [ca.jacobian(G(x0=1, p=pm)["x"], pm)]);
* julia> dxdp(4)
* DM(0.25)
* julia> f = ca.Function("f", [x, p], [x^2 - p, 3*x], ["x", "p"], ["g", "h"]);
* julia> G = ca.rootfinder("G", "newton", f)
* Function(G:(x0,p)->(x,h) Newton)
* julia> G(x0=1, p=4)
* Dict{String, DM} with 2 entries:
* "h" => 6
* "x" => 2
* julia> f = ca.Function("f", [p, x], [3*x, x^2 - p], ["p", "x"], ["h", "g"]);
* julia> opts = Dict("implicit_input" => 1, "implicit_output" => 1);
* julia> G = ca.rootfinder("G", "newton", f, opts)
* Function(G:(p,x0)->(h,x) Newton)
*
* >>> x = SX.sym("x"); p = SX.sym("p")
* >>> G = rootfinder("G", "newton", {"x": x, "p": p, "g": x**2 - p}, {"max_iter": 2})
* >>> try:
* ... G(x0=1, p=2)
* ... except RuntimeError as e:
* ... print("rootfinder process failed" in str(e))
* True
* >>> opts = {"max_iter": 2, "error_on_fail": False, "print_iteration": False}
* >>> G = rootfinder("G", "newton", {"x": x, "p": p, "g": x**2 - p}, opts)
* >>> G(x0=1, p=2)["x"], G.stats()["return_status"]
* (DM(1.4167), 'max_iteration_reached')
* >>> X = SX.sym("x", 2)
* >>> try:
* ... rootfinder("G", "newton", {"x": X, "g": vertcat(X[0] - 1, 1)})
* ... except RuntimeError as e:
* ... print("structurally rank-deficient" in str(e))
* True
* >>> try:
* ... rootfinder("G", "newton", {"x": X, "g": X[0]})
* ... except RuntimeError as e:
* ... print("Dimension mismatch" in str(e))
* True
*
* >> x = SX.sym('x'); p = SX.sym('p'); rfp = struct('x', x, 'p', p, 'g', x^2 - p);
* >> G = rootfinder('G', 'newton', rfp, struct('max_iter', 2));
* >> try, G('x0', 1, 'p', 2); catch e, msg = e.message; end
* >> contains(msg, 'rootfinder process failed')
* 1
* >> opts = struct('max_iter', 2, 'error_on_fail', false, 'print_iteration', false);
* >> G = rootfinder('G', 'newton', rfp, opts);
* >> r = G('x0', 1, 'p', 2); st = G.stats(); r.x, st.return_status
* 1.4167
* max_iteration_reached
* >> X = SX.sym('x', 2);
* >> rfp = struct('x', X, 'g', [X(1) - 1; 1]);
* >> try, rootfinder('G', 'newton', rfp); catch e, msg = e.message; end
* >> contains(msg, 'structurally rank-deficient')
* 1
* >> try, rootfinder('G', 'newton', struct('x', X, 'g', X(1))); catch e, msg = e.message; end
* >> contains(msg, 'Dimension mismatch')
* 1
*
* julia> x = ca.SX.sym("x"); p = ca.SX.sym("p");
* julia> rfp = Dict("x" => x, "p" => p, "g" => x^2 - p);
* julia> G = ca.rootfinder("G", "newton", rfp, Dict("max_iter" => 2));
* julia> try
* G(x0=1, p=2)
* catch e
* println(occursin("rootfinder process failed", sprint(showerror, e)))
* end
* true
* julia> opts = Dict("max_iter" => 2, "error_on_fail" => false, "print_iteration" => false);
* julia> G = ca.rootfinder("G", "newton", rfp, opts);
* julia> G(x0=1, p=2)["x"], ca.stats(G)["return_status"]
* (1.4167, "max_iteration_reached")
* julia> X = ca.SX.sym("x", 2);
* julia> try
* ca.rootfinder("G", "newton", Dict("x" => X, "g" => [X[1] - 1; 1]))
* catch e
* println(occursin("structurally rank-deficient", sprint(showerror, e)))
* end
* true
* julia> try
* ca.rootfinder("G", "newton", Dict("x" => X, "g" => X[1]))
* catch e
* println(occursin("Dimension mismatch", sprint(showerror, e)))
* end
* true
*
| Id | Type | Description | Used in |
|---|---|---|---|
| ad_weight | OT_DOUBLE | Weighting factor for derivative calculation.When there is an option of either using forward or reverse mode directional derivatives, the condition ad_weight*nf<=(1-ad_weight)*na is used where nf and na are estimates of the number of forward/reverse mode directional derivatives needed. By default, ad_weight is calculated automatically, but this can be overridden by setting this option. In particular, 0 means forcing forward mode and 1 forcing reverse mode. Leave unset for (class specific) heuristics. | casadi::FunctionInternal |
| ad_weight_sp | OT_DOUBLE | Weighting factor for sparsity pattern calculation calculation.Overrides default behavior. Set to 0 and 1 to force forward and reverse mode respectively. Cf. option "ad_weight". When set to -1, sparsity is completely ignored and dense matrices are used. | casadi::FunctionInternal |
| always_inline | OT_BOOL | Force inlining. | casadi::FunctionInternal |
| cache | OT_DICT | Prepopulate the function cache. Default: empty | casadi::FunctionInternal |
| codegen_options | OT_DICT | Options to be passed to the code generator of jit, e.g. {"stats": true} to record statistics inside the compiled code. Default: none | casadi::FunctionInternal |
| common_options | OT_DICT | Options for auto-generated functions | casadi::OracleFunction |
| compiler | OT_STRING | Just-in-time compiler plugin to be used. | casadi::FunctionInternal |
| constraints | OT_INTVECTOR | Constrain the unknowns. 0 (default): no constraint on ui, 1: ui >= 0.0, -1: ui <= 0.0, 2: ui > 0.0, -2: ui < 0.0. | casadi::Rootfinder |
| custom_jacobian | OT_FUNCTION | Override CasADi's AD. Use together with 'jac_penalty': 0. Note: Highly experimental. Syntax may break often. | casadi::FunctionInternal |
| der_options | OT_DICT | Default options to be used to populate forward_options, reverse_options, and jacobian_options before those options are merged in. | casadi::FunctionInternal |
| derivative_of | OT_FUNCTION | The function is a derivative of another function. The type of derivative (directional derivative, Jacobian) is inferred from the function name. | casadi::FunctionInternal |
| dump | OT_BOOL | Dump function to file upon first evaluation. [false] | casadi::FunctionInternal |
| dump_dir | OT_STRING | Directory to dump inputs/outputs and traces to. Make sure the directory exists [.] | casadi::FunctionInternal |
| dump_format | OT_STRING | Choose file format to dump matrices. See DM.from_file [mtx] | casadi::FunctionInternal |
| dump_in | OT_BOOL | Dump numerical values of inputs to file (readable with DM.from_file) [default: false] A counter is used to generate unique names. The counter may be reset using reset_dump_count. | casadi::FunctionInternal |
| dump_out | OT_BOOL | Dump numerical values of outputs to file (readable with DM.from_file) [default: false] A counter is used to generate unique names. The counter may be reset using reset_dump_count. | casadi::FunctionInternal |
| enable_fd | OT_BOOL | Enable derivative calculation by finite differencing. [default: false]] | casadi::FunctionInternal |
| enable_forward | OT_BOOL | Enable derivative calculation using generated functions for Jacobian-times-vector products - typically using forward mode AD - if available. [default: true] | casadi::FunctionInternal |
| enable_jacobian | OT_BOOL | Enable derivative calculation using generated functions for Jacobians of all differentiable outputs with respect to all differentiable inputs - if available. [default: true] | casadi::FunctionInternal |
| enable_reverse | OT_BOOL | Enable derivative calculation using generated functions for transposed Jacobian-times-vector products - typically using reverse mode AD - if available. [default: true] | casadi::FunctionInternal |
| error_on_fail | OT_BOOL | Throw exceptions when function evaluation fails (default true). | casadi::ProtoFunction |
| expand | OT_BOOL | Replace MX with SX expressions in problem formulation [false] This happens before creating derivatives unless indicated by postpone_expand | casadi::OracleFunction |
| external_transform | OT_VECTORVECTOR | List of external_transform instruction arguments. Default: empty | casadi::FunctionInternal |
| fd_method | OT_STRING | Method for finite differencing [default 'central'] | casadi::FunctionInternal |
| fd_options | OT_DICT | Options to be passed to the finite difference instance | casadi::FunctionInternal |
| forward_options | OT_DICT | Options to be passed to a forward mode constructor | casadi::FunctionInternal |
| gather_stats | OT_BOOL | Deprecated option (ignored): Statistics are now always collected. | casadi::FunctionInternal |
| implicit_input | OT_INT | Index of the input that corresponds to the actual root-finding | casadi::Rootfinder |
| implicit_output | OT_INT | Index of the output that corresponds to the actual root-finding | casadi::Rootfinder |
| inputs_check | OT_BOOL | Throw exceptions when the numerical values of the inputs don't make sense | casadi::FunctionInternal |
| is_diff_in | OT_BOOLVECTOR | Indicate for each input if it should be differentiable. | casadi::FunctionInternal |
| is_diff_out | OT_BOOLVECTOR | Indicate for each output if it should be differentiable. | casadi::FunctionInternal |
| jac_penalty | OT_DOUBLE | When requested for a number of forward/reverse directions, it may be cheaper to compute first the full jacobian and then multiply with seeds, rather than obtain the requested directions in a straightforward manner. Casadi uses a heuristic to decide which is cheaper. A high value of 'jac_penalty' makes it less likely for the heurstic to chose the full Jacobian strategy. The special value -1 indicates never to use the full Jacobian strategy | casadi::FunctionInternal |
| jacobian_function | OT_FUNCTION | Function object for calculating the Jacobian (autogenerated by default) | casadi::Rootfinder |
| jacobian_options | OT_DICT | Options to be passed to a Jacobian constructor | casadi::FunctionInternal |
| jit | OT_BOOL | Use just-in-time compiler to speed up the evaluation | casadi::FunctionInternal |
| jit_cleanup | OT_BOOL | Cleanup up the temporary source file that jit creates. Default: true | casadi::FunctionInternal |
| jit_name | OT_STRING | The file name used to write out code. The actual file names used depend on 'jit_temp_suffix' and include extensions. Default: 'jit_tmp' | casadi::FunctionInternal |
| jit_options | OT_DICT | Options to be passed to the jit compiler. | casadi::FunctionInternal |
| jit_serialize | OT_STRING | Specify behaviour when serializing a jitted function: SOURCE|link|embed. | casadi::FunctionInternal |
| jit_temp_suffix | OT_BOOL | Use a temporary (seemingly random) filename suffix for generated code and libraries. This is desired for thread-safety. This behaviour may defeat caching compiler wrappers. Default: true | casadi::FunctionInternal |
| linear_solver | OT_STRING | User-defined linear solver class. Needed for sensitivities. | casadi::Rootfinder |
| linear_solver_options | OT_DICT | Options to be passed to the linear solver. | casadi::Rootfinder |
| max_io | OT_INT | Acceptable number of inputs and outputs. Warn if exceeded. | casadi::FunctionInternal |
| max_num_dir | OT_INT | Specify the maximum number of directions for derivative functions. Overrules the builtin optimized_num_dir. | casadi::FunctionInternal |
| monitor | OT_STRINGVECTOR | Set of user problem functions to be monitored | casadi::OracleFunction |
| never_inline | OT_BOOL | Forbid inlining. | casadi::FunctionInternal |
| post_expand | OT_BOOL | After construction, expand this Function. Default: False | casadi::FunctionInternal |
| post_expand_options | OT_DICT | Options to be passed to post-construction expansion. Default: empty | casadi::FunctionInternal |
| postpone_expand | OT_BOOL | When expand is active, postpone it until after creation of derivatives. Default: False | casadi::OracleFunction |
| print_canonical | OT_BOOL | When printing numerical matrices, use a format that is exact and reproducible in generated C code. | casadi::FunctionInternal |
| print_in | OT_BOOL | Print numerical values of inputs [default: false] | casadi::FunctionInternal |
| print_out | OT_BOOL | Print numerical values of outputs [default: false] | casadi::FunctionInternal |
| print_time | OT_BOOL | print information about execution time. Implies record_time. | casadi::ProtoFunction |
| record_time | OT_BOOL | record information about execution time, for retrieval with stats(). | casadi::ProtoFunction |
| regularity_check | OT_BOOL | Throw exceptions when NaN or Inf appears during evaluation | casadi::ProtoFunction |
| reverse_options | OT_DICT | Options to be passed to a reverse mode constructor | casadi::FunctionInternal |
| show_eval_warnings | OT_BOOL | Show warnings generated from function evaluations [true] | casadi::OracleFunction |
| specific_options | OT_DICT | Options for specific auto-generated functions, overwriting the defaults from common_options. Nested dictionary. | casadi::OracleFunction |
| user_data | OT_VOIDPTR | A user-defined field that can be used to identify the function or pass additional information | casadi::FunctionInternal |
| verbose | OT_BOOL | Verbose evaluation – for debugging | casadi::ProtoFunction |
| Full name | Short | Description |
|---|---|---|
| ROOTFINDER_X0 | x0 | Initial guess for the solution. |
| ROOTFINDER_P | p | Parameters. |
| Full name | Short | Description |
|---|---|---|
| ROOTFINDER_X | x | Solution to the system of equations. |
- kinsol
- nlpsol
- newton
Note: some of the plugins in this list might not be available on your system. Also, there might be extra plugins available to you that are not listed here. You can obtain their documentation with Rootfinder.doc("myextraplugin")
KINSOL interface from the Sundials suite
Extra doc: https://github.com/casadi/casadi/wiki/L_226
| Id | Type | Description |
|---|---|---|
| abstol | OT_DOUBLE | Stopping criterion tolerance |
| disable_internal_warnings | OT_BOOL | Disable KINSOL internal warning messages |
| exact_jacobian | OT_BOOL | Use exact Jacobian information |
| f_scale | OT_DOUBLEVECTOR | Equation scaling factors |
| iterative_solver | OT_STRING | gmres|bcgstab|tfqmr |
| linear_solver_type | OT_STRING | dense|banded|iterative|user_defined |
| lower_bandwidth | OT_INT | Lower bandwidth for banded linear solvers |
| max_iter | OT_INT | Maximum number of Newton iterations. Putting 0 sets the default value of KinSol. |
| max_krylov | OT_INT | Maximum Krylov space dimension |
| pretype | OT_STRING | Type of preconditioner |
| print_level | OT_INT | Verbosity level |
| strategy | OT_STRING | Globalization strategy |
| u_scale | OT_DOUBLEVECTOR | Variable scaling factors |
| upper_bandwidth | OT_INT | Upper bandwidth for banded linear solvers |
| use_preconditioner | OT_BOOL | Precondition an iterative solver |
Implements simple newton iterations to solve an implicit function.
Extra doc: https://github.com/casadi/casadi/wiki/L_237
| Id | Type | Description |
|---|---|---|
| abstol | OT_DOUBLE | Stopping criterion tolerance on ||g||__inf) |
| abstolStep | OT_DOUBLE | Stopping criterion tolerance on step size |
| max_iter | OT_INT | Maximum number of Newton iterations to perform before returning. |
Implements simple newton iterations to solve an implicit function.
Extra doc: https://github.com/casadi/casadi/wiki/L_236
| Id | Type | Description |
|---|---|---|
| abstol | OT_DOUBLE | Stopping criterion tolerance on max(|F|) |
| abstolStep | OT_DOUBLE | Stopping criterion tolerance on step size |
| line_search | OT_BOOL | Enable line-search (default: true) |
| max_iter | OT_INT | Maximum number of Newton iterations to perform before returning. |
| print_iteration | OT_BOOL | Print information about each iteration |
Extra doc: https://github.com/casadi/casadi/wiki/L_21r
| CASADI_EXPORT std::string casadi::doc_rootfinder | ( | const std::string & | name | ) |
The text includes the plugin-specific option table.
>>> "newton iterations" in doc_rootfinder("newton")
True
>> contains(doc_rootfinder('newton'), 'newton iterations')
1
julia> occursin("newton iterations", ca.doc_rootfinder("newton"))
true
Extra doc: https://github.com/casadi/casadi/wiki/L_2ni
| CASADI_EXPORT bool casadi::has_rootfinder | ( | const std::string & | name | ) |
Tries to load the plugin name if it is not loaded yet; false when it is not found.
>>> has_rootfinder("newton"), has_rootfinder("no_such_plugin")
(True, False)
>> has_rootfinder('newton'), has_rootfinder('no_such_plugin')
1
0
julia> ca.has_rootfinder("newton"), ca.has_rootfinder("no_such_plugin")
(true, false)
Extra doc: https://github.com/casadi/casadi/wiki/L_2ng
| CASADI_EXPORT void casadi::load_rootfinder | ( | const std::string & | name | ) |
Normally plugins are loaded on first use; this raises an error when the plugin cannot be found.
>>> try:
... load_rootfinder("no_such_plugin")
... except RuntimeError as e:
... print("no_such_plugin" in str(e))
True
>> try, load_rootfinder('no_such_plugin'); catch e, msg = e.message; end
>> contains(msg, 'no_such_plugin')
1
julia> try
ca.load_rootfinder("no_such_plugin")
catch e
println(occursin("no_such_plugin", sprint(showerror, e)))
end
true
Extra doc: https://github.com/casadi/casadi/wiki/L_2nh
| CASADI_EXPORT Function casadi::rootfinder | ( | const std::string & | name, |
| const std::string & | solver, | ||
| const Function & | f, | ||
| const Dict & | opts = Dict() |
||
| ) |
| CASADI_EXPORT Function casadi::rootfinder | ( | const std::string & | name, |
| const std::string & | solver, | ||
| const MXDict & | rfp, | ||
| const Dict & | opts = Dict() |
||
| ) |
| CASADI_EXPORT std::vector<std::string> casadi::rootfinder_in | ( | ) |
Returns the names of the 2 inputs of a Function created by rootfinder from a dictionary, in order: x0, p. A Function created from a general Function keeps that Function's input names, with "0" appended to the unknown.
>>> rootfinder_in() ['x0', 'p']
>> rootfinder_in() x0 p
julia> ca.rootfinder_in()
2-element Vector{String}:
"x0"
"p"
Extra doc: https://github.com/casadi/casadi/wiki/L_1ty
| CASADI_EXPORT std::string casadi::rootfinder_in | ( | casadi_int | ind | ) |
| ind | Index in 0..rootfinder_n_in()-1; any other value gives an empty string |
>>> rootfinder_in(0), rootfinder_in(1), repr(rootfinder_in(2))
('x0', 'p', "''")
>> rootfinder_in(0), rootfinder_in(1), isempty(rootfinder_in(2)) x0 p 1
julia> ca.rootfinder_in(0), ca.rootfinder_in(1), ca.rootfinder_in(2)
("x0", "p", "")
Extra doc: https://github.com/casadi/casadi/wiki/L_1u0
| CASADI_EXPORT casadi_int casadi::rootfinder_n_in | ( | ) |
>>> rootfinder_n_in() 2
>> rootfinder_n_in() 2
julia> ca.rootfinder_n_in() 2
Extra doc: https://github.com/casadi/casadi/wiki/L_1u2
| CASADI_EXPORT casadi_int casadi::rootfinder_n_out | ( | ) |
>>> rootfinder_n_out() 1
>> rootfinder_n_out() 1
julia> ca.rootfinder_n_out() 1
Extra doc: https://github.com/casadi/casadi/wiki/L_1u3
| CASADI_EXPORT std::string casadi::rootfinder_option_info | ( | const std::string & | name, |
| const std::string & | op | ||
| ) |
| name | Plugin name |
| op | Option name; an unknown option raises an error |
>>> rootfinder_option_info("newton", "abstol")
'Stopping criterion tolerance on max(|F|)'
>> rootfinder_option_info('newton', 'abstol')
Stopping criterion tolerance on max(|F|)
julia> ca.rootfinder_option_info("newton", "abstol")
"Stopping criterion tolerance on max(|F|)"
Extra doc: https://github.com/casadi/casadi/wiki/L_1u6
| CASADI_EXPORT std::string casadi::rootfinder_option_type | ( | const std::string & | name, |
| const std::string & | op | ||
| ) |
| name | Plugin name |
| op | Option name; an unknown option raises an error |
>>> rootfinder_option_type("newton", "max_iter")
'OT_INT'
>>> rootfinder_option_type("newton", "abstol")
'OT_DOUBLE'
>> rootfinder_option_type('newton', 'max_iter')
OT_INT
>> rootfinder_option_type('newton', 'abstol')
OT_DOUBLE
julia> ca.rootfinder_option_type("newton", "max_iter")
"OT_INT"
julia> ca.rootfinder_option_type("newton", "abstol")
"OT_DOUBLE"
Extra doc: https://github.com/casadi/casadi/wiki/L_1u5
| CASADI_EXPORT std::vector<std::string> casadi::rootfinder_options | ( | const std::string & | name | ) |
Returns the names of the plugin-specific options only; the options shared by all plugins (e.g. "linear_solver", "error_on_fail") are not included. Raises an error for an unknown plugin.
>>> opts = rootfinder_options("newton")
>>> "max_iter" in opts, "abstol" in opts, "linear_solver" in opts
(True, True, False)
>> opts = cellstr(rootfinder_options('newton'));
>> ismember({'max_iter', 'abstol', 'linear_solver'}, opts)
1 1 0
julia> opts = ca.rootfinder_options("newton");
julia> "max_iter" in opts, "abstol" in opts, "linear_solver" in opts
(true, true, false)
Extra doc: https://github.com/casadi/casadi/wiki/L_1u4
| CASADI_EXPORT std::vector<std::string> casadi::rootfinder_out | ( | ) |
Returns the name of the single output of a Function created by rootfinder from a dictionary: x.
>>> rootfinder_out() ['x']
>> rootfinder_out() x
julia> ca.rootfinder_out()
1-element Vector{String}:
"x"
Extra doc: https://github.com/casadi/casadi/wiki/L_1tz
| CASADI_EXPORT std::string casadi::rootfinder_out | ( | casadi_int | ind | ) |
| ind | Index in 0..rootfinder_n_out()-1; any other value gives an empty string |
>>> rootfinder_out(0), repr(rootfinder_out(1))
('x', "''")
>> rootfinder_out(0), isempty(rootfinder_out(1)) x 1
julia> ca.rootfinder_out(0), ca.rootfinder_out(1)
("x", "")
Extra doc: https://github.com/casadi/casadi/wiki/L_1u1