Functions | |
| Function | casadi::integrator (const std::string &name, const std::string &solver, const SXDict &dae, const Dict &opts) |
| Function | casadi::integrator (const std::string &name, const std::string &solver, const MXDict &dae, const Dict &opts) |
| Function | casadi::integrator (const std::string &name, const std::string &solver, const Function &dae, const Dict &opts) |
| Function | casadi::integrator (const std::string &name, const std::string &solver, const SXDict &dae, double t0, const std::vector< double > &tout, const Dict &opts) |
| Function | casadi::integrator (const std::string &name, const std::string &solver, const MXDict &dae, double t0, const std::vector< double > &tout, const Dict &opts) |
| Function | casadi::integrator (const std::string &name, const std::string &solver, const Function &dae, double t0, const std::vector< double > &tout, const Dict &opts) |
| Function | casadi::integrator (const std::string &name, const std::string &solver, const SXDict &dae, double t0, double tf, const Dict &opts) |
| Function | casadi::integrator (const std::string &name, const std::string &solver, const MXDict &dae, double t0, double tf, const Dict &opts) |
| Function | casadi::integrator (const std::string &name, const std::string &solver, const Function &dae, double t0, double tf, const Dict &opts) |
| bool | casadi::has_integrator (const std::string &name) |
| Check if an integrator plugin is available. More... | |
| void | casadi::load_integrator (const std::string &name) |
| Explicitly load an integrator plugin. More... | |
| std::string | casadi::doc_integrator (const std::string &name) |
| Get the documentation string of an integrator plugin. More... | |
| std::vector< std::string > | casadi::integrator_in () |
| Get the input scheme of integrators. More... | |
| std::vector< std::string > | casadi::integrator_out () |
| Get the output scheme of integrators. More... | |
| std::string | casadi::integrator_in (casadi_int ind) |
| Get the name of an integrator input by index. More... | |
| std::string | casadi::integrator_out (casadi_int ind) |
| Get the name of an integrator output by index. More... | |
| casadi_int | casadi::integrator_n_in () |
| Get the number of integrator inputs. More... | |
| casadi_int | casadi::integrator_n_out () |
| Get the number of integrator outputs. More... | |
| std::vector< std::string > | casadi::dyn_in () |
| Get the input scheme of a DAE function. More... | |
| std::vector< std::string > | casadi::dyn_out () |
| Get the output scheme of a DAE function. More... | |
| std::string | casadi::dyn_in (casadi_int ind) |
| Get the name of a DAE function input by index. More... | |
| std::string | casadi::dyn_out (casadi_int ind) |
| Get the name of a DAE function output by index. More... | |
| casadi_int | casadi::dyn_n_in () |
| Get the number of inputs of a DAE function. More... | |
| casadi_int | casadi::dyn_n_out () |
| Get the number of outputs of a DAE function. More... | |
| std::vector< std::string > | casadi::event_in () |
| Get the input scheme of an event transition function. More... | |
| std::vector< std::string > | casadi::event_out () |
| Get the output scheme of an event transition function. More... | |
Create an ODE/DAE integrator Solves an initial value problem (IVP) coupled to a terminal value problem with differential equation given as an implicit ODE coupled to an algebraic equation and a set of quadratures:
Initial conditions at t=t0 x(t0) = x0 q(t0) = 0 Forward integration from t=t0 to t=tf der(x) = fx(x, z, p, u, t) Forward ODE 0 = fz(x, z, p, u, t) Forward algebraic equations der(q) = fq(x, z, p, u, t) Forward quadratures Terminal conditions at t=tf rx(tf) = rx0 rq(tf) = 0 Backward integration from t=tf to t=t0 der(rx) = gx(rx, rz, rp, x, z, p, t) Backward ODE 0 = gz(rx, rz, rp, x, z, p, t) Backward algebraic equations der(rq) = gq(rx, rz, rp, x, z, p, t) Backward quadratures where we assume that both the forward and backwards integrations are index-1 (i.e. dfz/dz, dgz/drz are invertible) and furthermore that gx, gz and gq have a linear dependency on rx, rz and rp.
The DAE is given as a dictionary with the fields "x" (differential state), "ode" (its right-hand side, same size as "x") and optionally "t" (time, scalar), "z" (algebraic variables) with "alg" (residual, same size as "z"), "p" (parameters), "u" (controls, piecewise constant on the output grid), "quad" (quadrature right-hand side) and "zero" (event indicators, experimental). Every entry must be a dense vector; row vectors are flattened to columns. Any other field name is an error, as is a symbol in an output that is not an input. The DAE can also be given as a Function with the full input scheme t, x, z, p, u and output scheme ode, alg, quad, zero (see dyn_in and dyn_out), empty where unused. The pure ODE integrators (cvodes, rk, erk, rosenbrock) reject a problem with "z".
Time grid: integrator(name, solver, dae, opts) integrates from t0 = 0 to tf = 1; integrator(name, solver, dae, t0, tf, opts) to a single output time tf; and integrator(name, solver, dae, t0, tout, opts) returns the solution at every time in the list tout. The grid must be increasing but need not contain t0; including it gives the initial state as the first output column. t0 > tf integrates backwards in time. The legacy options "t0", "tf", "grid" and "output_t0" are deprecated and emit a warning.
The returned Function has inputs x0, z0, p, u, adj_xf, adj_zf, adj_qf (see integrator_in) and outputs xf, zf, qf, adj_x0, adj_z0, adj_p, adj_u (see integrator_out). With N output times, x0, z0 and p are column vectors, u has one column per output time (the control on the interval ending at that time; a single column is broadcast), and xf, zf, qf have one column per output time. z0 is the initial guess for the algebraic variables; it must be consistent for the Sundials solvers to converge. Omitted inputs are zero. The adj_* inputs and outputs are empty unless option "nadj" is positive: then adj_xf, adj_zf and adj_qf take one adjoint seed per output time and adj_x0, adj_p and adj_u return the corresponding adjoint sensitivities, i.e. adj_x0 is the gradient of sum(adj_xf .* xf) + sum(adj_qf .* qf) with respect to x0. Option "nfwd" adds, in the same way, forward sensitivity columns to every input and output. Without these options derivatives are obtained by embedding the call in an MX expression and differentiating (sensitivity equations are created on demand).
Options common to all plugins (the plugin options follow in the tables below):
>>> x = SX.sym("x"); p = SX.sym("p")
>>> dae = {"x": x, "p": p, "ode": -p*x, "quad": x}
>>> F = integrator("F", "cvodes", dae)
>>> print(F)
F:(x0,z0[0],p,u[0],adj_xf[],adj_zf[],adj_qf[])->(xf,zf[0],qf,adj_x0[],...,adj_u[]) ...
>>> r = F(x0=1, p=1)
>>> r["xf"], r["qf"]
(DM(0.3679), DM(0.6321))
>>> F = integrator("F", "rk", dae, 0, [1, 2, 3])
>>> F(x0=1, p=1)["xf"]
DM([[0.3679, 0.1353, 0.0498]])
>>> xf, zf, qf, adj_x0, adj_z0, adj_p, adj_u = F(1, 0, 1, 0, 0, 0, 0)
>>> xf.shape, zf.shape, adj_x0.shape
((1, 3), (0, 3), (0, 0))
>> x = SX.sym('x'); p = SX.sym('p');
>> dae = struct('x', x, 'p', p, 'ode', -p*x, 'quad', x);
>> F = integrator('F', 'cvodes', dae); disp(F)
F:(x0,z0[0],p,u[0],adj_xf[],adj_zf[],adj_qf[])->(xf,zf[0],qf,adj_x0[],...,adj_u[]) ...
>> r = F('x0', 1, 'p', 1); r.xf, r.qf
0.3679
0.6321
>> F = integrator('F', 'rk', dae, 0, [1, 2, 3]);
>> r = F('x0', 1, 'p', 1); r.xf
[[0.3679, 0.1353, 0.0498]]
>> [xf, zf, qf, adj_x0, adj_z0, adj_p, adj_u] = F(1, 0, 1, 0, 0, 0, 0);
>> size(xf), size(zf), size(adj_x0)
1 3
0 3
0 0
julia> x = ca.SX.sym("x"); p = ca.SX.sym("p");
julia> dae = Dict("x" => x, "p" => p, "ode" => -p*x, "quad" => x);
julia> F = ca.integrator("F", "cvodes", dae);
julia> ca.n_in(F), ca.n_out(F), ca.size_in(F, 4)
(7, 7, (0, 0))
julia> r = F(x0=1, p=1);
julia> r["xf"], r["qf"]
(0.3679, 0.6321)
julia> F = ca.integrator("F", "rk", dae, 0, [1, 2, 3]);
julia> F(x0=1, p=1)["xf"]
DM([[0.3679, 0.1353, 0.0498]])
julia> xf, zf, qf, adj_x0, adj_z0, adj_p, adj_u = F(1, 0, 1, 0, 0, 0, 0);
julia> size(xf), size(zf), size(adj_x0)
((1, 3), (0, 3), (0, 0))
>>> x = SX.sym("x"); z = SX.sym("z"); u = SX.sym("u")
>>> F = integrator("F", "idas", {"x": x, "z": z, "ode": -z, "alg": z**2 - x})
>>> r = F(x0=1, z0=1)
>>> r["xf"], r["zf"]
(DM(0.25), DM(0.5))
>>> F(x0=1, z0=-1)["zf"]
DM(-1.5)
>>> F = integrator("F", "rk", {"x": x, "u": u, "ode": u}, 0, [1, 2, 3])
>>> F(x0=0, u=[1, 2, 3])["xf"], F(x0=0, u=1)["xf"]
(DM([[1, 3, 6]]), DM([[1, 2, 3]]))
>>> try:
... integrator("F", "cvodes", {"x": x, "z": z, "ode": -z, "alg": z - x})
... except RuntimeError as e:
... print("does not support algebraic variables" in str(e))
True
>>> try:
... integrator("F", "cvodes", {"x": x, "ode": vertcat(x, x)})
... except RuntimeError as e:
... print("Dimension mismatch for 'ode'" in str(e))
True
>> x = SX.sym('x'); z = SX.sym('z'); u = SX.sym('u');
>> F = integrator('F', 'idas', struct('x', x, 'z', z, 'ode', -z, 'alg', z^2 - x));
>> r = F('x0', 1, 'z0', 1); r.xf, r.zf
0.25
0.5
>> r = F('x0', 1, 'z0', -1); r.zf
-1.5
>> F = integrator('F', 'rk', struct('x', x, 'u', u, 'ode', u), 0, [1, 2, 3]);
>> r = F('x0', 0, 'u', [1 2 3]); disp(r.xf)
[[1, 3, 6]]
>> r = F('x0', 0, 'u', 1); disp(r.xf)
[[1, 2, 3]]
>> dae = struct('x', x, 'z', z, 'ode', -z, 'alg', z - x);
>> try, integrator('F', 'cvodes', dae); catch e, msg = e.message; end
>> contains(msg, 'does not support algebraic variables')
1
>> dae = struct('x', x, 'ode', [x; x]);
>> try, integrator('F', 'cvodes', dae); catch e, msg = e.message; end
>> contains(msg, 'Dimension mismatch for ''ode''')
1
julia> x = ca.SX.sym("x"); z = ca.SX.sym("z"); u = ca.SX.sym("u");
julia> dae = Dict("x" => x, "z" => z, "ode" => -z, "alg" => z^2 - x);
julia> F = ca.integrator("F", "idas", dae);
julia> r = F(x0=1, z0=1);
julia> r["xf"], r["zf"]
(0.25, 0.5)
julia> F(x0=1, z0=-1)["zf"]
DM(-1.5)
julia> F = ca.integrator("F", "rk", Dict("x" => x, "u" => u, "ode" => u), 0, [1, 2, 3]);
julia> F(x0=0, u=[1 2 3])["xf"]
DM([[1, 3, 6]])
julia> F(x0=0, u=1)["xf"]
DM([[1, 2, 3]])
julia> try
ca.integrator("F", "cvodes", Dict("x" => x, "z" => z, "ode" => -z, "alg" => z - x))
catch e
println(occursin("does not support algebraic variables", sprint(showerror, e)))
end
true
julia> try
ca.integrator("F", "cvodes", Dict("x" => x, "ode" => [x; x]))
catch e
println(occursin("Dimension mismatch for 'ode'", sprint(showerror, e)))
end
true
>>> x = SX.sym("x"); p = SX.sym("p")
>>> dae = {"x": x, "p": p, "ode": -p*x, "quad": x}
>>> F = integrator("F", "cvodes", dae, {"nadj": 1})
>>> print(F)
F:(x0,z0[0],p,u[0],adj_xf,adj_zf[0],adj_qf)->(xf,zf[0],qf,adj_x0,...,adj_p,adj_u[0]) ...
>>> r = F(x0=1, p=1, adj_xf=1)
>>> r["adj_x0"], r["adj_p"]
(DM(0.3679), DM(-0.3679))
>>> F = integrator("F", "cvodes", dae)
>>> pm = MX.sym("p")
>>> J = Function("J", [pm], [jacobian(F(x0=1, p=pm)["xf"], pm)])
>>> J(1)
DM(-0.3679)
>> x = SX.sym('x'); p = SX.sym('p');
>> dae = struct('x', x, 'p', p, 'ode', -p*x, 'quad', x);
>> F = integrator('F', 'cvodes', dae, struct('nadj', 1)); disp(F)
F:(x0,z0[0],p,u[0],adj_xf,adj_zf[0],adj_qf)->(xf,zf[0],qf,adj_x0,...,adj_p,adj_u[0]) ...
>> r = F('x0', 1, 'p', 1, 'adj_xf', 1); r.adj_x0, r.adj_p
0.3679
-0.3679
>> F = integrator('F', 'cvodes', dae); pm = MX.sym('p'); r = F('x0', 1, 'p', pm);
>> J = Function('J', {pm}, {jacobian(r.xf, pm)}); J(1)
-0.3679
julia> x = ca.SX.sym("x"); p = ca.SX.sym("p");
julia> dae = Dict("x" => x, "p" => p, "ode" => -p*x, "quad" => x);
julia> F = ca.integrator("F", "cvodes", dae, Dict("nadj" => 1));
julia> ca.size_in(F, 4), ca.size_out(F, 5)
((1, 1), (1, 1))
julia> r = F(x0=1, p=1, adj_xf=1);
julia> r["adj_x0"], r["adj_p"]
(0.3679, -0.3679)
julia> F = ca.integrator("F", "cvodes", dae);
julia> pm = ca.MX.sym("p");
julia> J = ca.Function("J", [pm], [ca.jacobian(F(x0=1, p=pm)["xf"], pm)]);
julia> J(1)
DM(-0.3679)
| 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 |
| augmented_options | OT_DICT | Options to be passed down to the augmented integrator, if one is constructed | casadi::Integrator |
| 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 |
| 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 |
| event_tol | OT_DOUBLE | Termination tolerance for the event iteration | casadi::Integrator |
| 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 |
| grid | OT_DOUBLEVECTOR | [DEPRECATED] Time grid | casadi::Integrator |
| 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_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 |
| max_event_iter | OT_INT | Maximum number of iterations to zero in on a single event | casadi::Integrator |
| max_events | OT_INT | Maximum total number of events | casadi::Integrator |
| 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 |
| nadj | OT_INT | Number of adjoint sensitivities to be calculated [0] | casadi::Integrator |
| never_inline | OT_BOOL | Forbid inlining. | casadi::FunctionInternal |
| nfwd | OT_INT | Number of forward sensitivities to be calculated [0] | casadi::Integrator |
| number_of_finite_elements | OT_INT | Target number of finite elements. The actual number may be higher to accommodate all output times | casadi::Integrator |
| output_t0 | OT_BOOL | [DEPRECATED] Output the state at the initial time | casadi::Integrator |
| 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_stats | OT_BOOL | Print out statistics after integration | casadi::Integrator |
| 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 |
| rootfinder | OT_STRING | An implicit function solver | casadi::Integrator |
| rootfinder_options | OT_DICT | Options to be passed to the NLP Solver | casadi::Integrator |
| show_eval_warnings | OT_BOOL | Show warnings generated from function evaluations [true] | casadi::OracleFunction |
| simplify | OT_BOOL | Implement as MX Function (codegeneratable/serializable) default: false | casadi::Integrator |
| simplify_options | OT_DICT | Any options to pass to simplified form Function constructor | casadi::Integrator |
| specific_options | OT_DICT | Options for specific auto-generated functions, overwriting the defaults from common_options. Nested dictionary. | casadi::OracleFunction |
| t0 | OT_DOUBLE | [DEPRECATED] Beginning of the time horizon | casadi::Integrator |
| tf | OT_DOUBLE | [DEPRECATED] End of the time horizon | casadi::Integrator |
| transition | OT_FUNCTION | Function to be called a zero-crossing events | casadi::Integrator |
| 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 |
|---|---|---|
| INTEGRATOR_X0 | x0 | Differential state at the initial time. |
| INTEGRATOR_Z0 | z0 | Initial guess for the algebraic variable at the initial time. |
| INTEGRATOR_P | p | Parameters. |
| INTEGRATOR_U | u | Piecewise constant control, a new control interval starts at each output time. |
| INTEGRATOR_ADJ_XF | adj_xf | Adjoint seeds corresponding to the states at the output times. |
| INTEGRATOR_ADJ_ZF | adj_zf | Adjoint seeds corresponding to the algebraic variables at the output times. |
| INTEGRATOR_ADJ_QF | adj_qf | Adjoint seeds corresponding to the quadratures at the output times. |
| Full name | Short | Description |
|---|---|---|
| INTEGRATOR_XF | xf | Differential state at all output times. |
| INTEGRATOR_ZF | zf | Algebraic variable at all output times. |
| INTEGRATOR_QF | qf | Quadrature state at all output times. |
| INTEGRATOR_ADJ_X0 | adj_x0 | Adjoint sensitivities corresponding to the initial state. |
| INTEGRATOR_ADJ_Z0 | adj_z0 | Adjoint sensitivities corresponding to the algebraic variable guess. |
| INTEGRATOR_ADJ_P | adj_p | Adjoint sensitivities corresponding to the parameter vector. |
| INTEGRATOR_ADJ_U | adj_u | Adjoint sensitivities corresponding to the control vector. |
- cvodes
- idas
- erk
- rk
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 Integrator.doc("myextraplugin")
Interface to CVodes from the Sundials suite.
A call to evaluate will integrate to the end.
You can retrieve the entire state trajectory as follows, after the evaluate call: Call reset. Then call integrate(t_i) and getOuput for a series of times t_i.
Extra doc: https://github.com/casadi/casadi/wiki/L_228
| Id | Type | Description |
|---|---|---|
| abstol | OT_DOUBLE | Absolute tolerence for the IVP solution |
| always_recalculate_jacobian | OT_BOOL | Recalculate Jacobian before factorizations, even if Jacobian is current [default: true] |
| disable_internal_warnings | OT_BOOL | Disable SUNDIALS internal warning messages |
| fsens_all_at_once | OT_BOOL | Calculate all right hand sides of the sensitivity equations at once |
| fsens_err_con | OT_BOOL | include the forward sensitivities in all error controls |
| interpolation_type | OT_STRING | Type of interpolation for the adjoint sensitivities |
| linear_multistep_method | OT_STRING | Integrator scheme: BDF|adams |
| linear_solver | OT_STRING | A custom linear solver creator function [default: qr] |
| linear_solver_options | OT_DICT | Options to be passed to the linear solver |
| max_krylov | OT_INT | Maximum Krylov subspace size |
| max_multistep_order | OT_INT | Maximum order for the (variable-order) multistep method |
| max_num_steps | OT_INT | Maximum number of integrator steps |
| max_order | OT_DOUBLE | Maximum order |
| max_step_size | OT_DOUBLE | Max step size [default: 0/inf] |
| min_step_size | OT_DOUBLE | Min step size [default: 0/0.0] |
| newton_scheme | OT_STRING | Linear solver scheme in the Newton method: DIRECT|gmres|bcgstab|tfqmr |
| nonlin_conv_coeff | OT_DOUBLE | Coefficient in the nonlinear convergence test |
| nonlinear_solver_iteration | OT_STRING | Nonlinear solver type: NEWTON|functional |
| quad_err_con | OT_BOOL | Should the quadratures affect the step size control |
| reltol | OT_DOUBLE | Relative tolerence for the IVP solution |
| scale_abstol | OT_BOOL | Scale absolute tolerance by nominal value |
| second_order_correction | OT_BOOL | Second order correction in the augmented system Jacobian [true] |
| sensitivity_method | OT_STRING | Sensitivity method: SIMULTANEOUS|staggered |
| step0 | OT_DOUBLE | initial step size [default: 0/estimated] |
| steps_per_checkpoint | OT_INT | Number of steps between two consecutive checkpoints |
| stop_at_end | OT_BOOL | [DEPRECATED] Stop the integrator at the end of the interval |
| use_preconditioner | OT_BOOL | Precondition the iterative solver [default: true] |
Interface to IDAS from the Sundials suite.
Extra doc: https://github.com/casadi/casadi/wiki/L_225
| Id | Type | Description |
|---|---|---|
| abstol | OT_DOUBLE | Absolute tolerence for the IVP solution |
| abstolv | OT_DOUBLEVECTOR | Absolute tolerarance for each component |
| calc_ic | OT_BOOL | Use IDACalcIC to get consistent initial conditions. |
| calc_icB | OT_BOOL | Use IDACalcIC to get consistent initial conditions for backwards system [default: equal to calc_ic]. |
| cj_scaling | OT_BOOL | IDAS scaling on cj for the user-defined linear solver module |
| constraints | OT_INTVECTOR | Constrain the solution y=[x,z]. 0 (default): no constraint on yi, 1: yi >= 0.0, -1: yi <= 0.0, 2: yi > 0.0, -2: yi < 0.0. |
| disable_internal_warnings | OT_BOOL | Disable SUNDIALS internal warning messages |
| first_time | OT_DOUBLE | First requested time as a fraction of the time interval |
| fsens_err_con | OT_BOOL | include the forward sensitivities in all error controls |
| init_xdot | OT_DOUBLEVECTOR | Initial values for the state derivatives |
| interpolation_type | OT_STRING | Type of interpolation for the adjoint sensitivities |
| linear_solver | OT_STRING | A custom linear solver creator function [default: qr] |
| linear_solver_options | OT_DICT | Options to be passed to the linear solver |
| max_krylov | OT_INT | Maximum Krylov subspace size |
| max_multistep_order | OT_INT | Maximum order for the (variable-order) multistep method |
| max_num_steps | OT_INT | Maximum number of integrator steps |
| max_order | OT_DOUBLE | Maximum order |
| max_step_size | OT_DOUBLE | Maximim step size |
| newton_scheme | OT_STRING | Linear solver scheme in the Newton method: DIRECT|gmres|bcgstab|tfqmr |
| nonlin_conv_coeff | OT_DOUBLE | Coefficient in the nonlinear convergence test |
| quad_err_con | OT_BOOL | Should the quadratures affect the step size control |
| reltol | OT_DOUBLE | Relative tolerence for the IVP solution |
| scale_abstol | OT_BOOL | Scale absolute tolerance by nominal value |
| second_order_correction | OT_BOOL | Second order correction in the augmented system Jacobian [true] |
| sensitivity_method | OT_STRING | Sensitivity method: SIMULTANEOUS|staggered |
| step0 | OT_DOUBLE | initial step size [default: 0/estimated] |
| steps_per_checkpoint | OT_INT | Number of steps between two consecutive checkpoints |
| stop_at_end | OT_BOOL | [DEPRECATED] Stop the integrator at the end of the interval |
| suppress_algebraic | OT_BOOL | Suppress algebraic variables in the error testing |
| use_preconditioner | OT_BOOL | Precondition the iterative solver [default: true] |
Fixed-step implicit Runge-Kutta integrator ODE/DAE integrator based on collocation schemes
The method is still under development
Extra doc: https://github.com/casadi/casadi/wiki/L_234
| Id | Type | Description |
|---|---|---|
| collocation_scheme | OT_STRING | Collocation scheme: radau|legendre |
| interpolation_order | OT_INT | Order of the interpolating polynomials |
| number_of_finite_elements | OT_INT | Target number of finite elements. The actual number may be higher to accommodate all output times |
| rootfinder | OT_STRING | An implicit function solver |
| rootfinder_options | OT_DICT | Options to be passed to the NLP Solver |
| simplify | OT_BOOL | Implement as MX Function (codegeneratable/serializable) default: false |
| simplify_options | OT_DICT | Any options to pass to simplified form Function constructor |
Explicit Runge-Kutta integrator for ODEs: a pair of order 5(4) with adaptive or fixed steps, or the classical method of order 4 with fixed steps.
Steps are independent of the output times. Adaptive steps are chosen by error control on the nominal states; with fixed steps, each run of steps over a control group (or up to the end) is divided into equal steps of at most step_size. Outputs inside a step come from a dense output (order 4 and 3 respectively) at no extra cost. Forward sensitivities are the exact derivatives of the discrete solution and adjoint sensitivities are the exact discrete adjoint of the taped steps. With fixed steps the tape has a known bound, so adjoints can be code-generated; with adaptive steps, set max_tape_steps.
Zero-crossing events (DAE output zero, option transition) are located on the dense output of the step in which a function becomes negative; integration restarts from the state after the transition. Sensitivities, forward, adjoint and forward-over-adjoint, include those of the event times.
Extra doc: https://github.com/casadi/casadi/wiki/L_2kb
| Id | Type | Description |
|---|---|---|
| abstol | OT_DOUBLE | Absolute tolerance [1e-8] |
| control_group_size | OT_INTVECTOR | Number of output intervals in each control group, over which the controls, one column each, are constant: a run of steps [default: 1 for each output interval] |
| max_num_steps | OT_INT | Adaptive steps: maximum number of steps per output interval [10000] |
| max_step_size | OT_DOUBLE | Adaptive steps: maximum step size [default: unbounded] |
| max_tape_steps | OT_INT | Adaptive steps: capacity, in steps, of a tape in the work vector, for adjoint sensitivities; needed for code generation [0: tape of unbounded size]. With fixed steps, the tape is sized exactly. |
| method | OT_STRING | Runge-Kutta method: 'rk45' (pair of order 5(4), adaptive unless step_size is set) or 'rk4' (classical, order 4, fixed steps only; default step_size (tf - t0)/20) [rk45] |
| min_step_size | OT_DOUBLE | Adaptive steps: minimum step size [1e-14] |
| quad_err_con | OT_BOOL | Adaptive steps: include the quadratures in the error control [true] |
| reltol | OT_DOUBLE | Relative tolerance [1e-6] |
| step0 | OT_DOUBLE | Adaptive steps: initial step size [default: estimated] |
| step_size | OT_DOUBLE | Fixed steps: each run of steps, over a control group or up to the end without controls, is divided into equal steps of at most step_size [0: adaptive steps] |
Rosenbrock-Wanner integrator for stiff ODEs and semi-explicit index-1 DAEs, with adaptive or fixed steps.
An 8-stage, stiffly accurate, L-stable method of order 5 with an embedded method of order 4. Each step needs one Jacobian and one sparse QR factorization; the method is linearly implicit, without Newton iterations. Steps cross the output times within a control group, which are interpolated by a dense output of order 4. Step sizes are chosen from the nominal solution only, so forward sensitivities are the exact derivatives of the discrete solution (internal numerical differentiation) and adjoint sensitivities are the exact discrete adjoint of the taped steps. With step_size, each run of steps over a control group is divided into equal steps instead, and the tape has a known bound.
Zero-crossing events (DAE output zero, option transition) are located on the dense output of the step in which a function becomes negative; integration restarts from the state after the transition. Sensitivities, forward, adjoint and forward-over-adjoint, include those of the event times.
Extra doc: https://github.com/casadi/casadi/wiki/L_2ka
| Id | Type | Description |
|---|---|---|
| abstol | OT_DOUBLE | Absolute tolerance [1e-8] |
| control_group_size | OT_INTVECTOR | Number of output intervals in each control group, over which the controls, one column each, are constant: a run of steps [default: 1 for each output interval] |
| init_max_iter | OT_INT | Maximum number of Newton iterations for consistent algebraic states [20] |
| init_tol | OT_DOUBLE | Tolerance on the scaled Newton step when making the algebraic states consistent [1e-3] |
| max_num_steps | OT_INT | Adaptive steps: maximum number of steps per output interval [10000] |
| max_step_size | OT_DOUBLE | Adaptive steps: maximum step size [default: unbounded] |
| max_tape_steps | OT_INT | Adaptive steps: capacity, in steps, of a tape in the work vector, for adjoint sensitivities; needed for code generation [0: tape of unbounded size]. With fixed steps, the tape is sized exactly. |
| min_step_size | OT_DOUBLE | Adaptive steps: minimum step size [1e-14] |
| quad_err_con | OT_BOOL | Adaptive steps: include the quadratures in the error control [true] |
| reltol | OT_DOUBLE | Relative tolerance [1e-6] |
| step0 | OT_DOUBLE | Adaptive steps: initial step size [default: estimated] |
| step_size | OT_DOUBLE | Fixed steps: each run of steps, over a control group or up to the end without controls, is divided into equal steps of at most step_size [0: adaptive steps] |
Fixed-step explicit Runge-Kutta integrator for ODEs Currently implements RK4.
The method is still under development
Extra doc: https://github.com/casadi/casadi/wiki/L_23a
Extra doc: https://github.com/casadi/casadi/wiki/L_21k
| CASADI_EXPORT std::string casadi::doc_integrator | ( | const std::string & | name | ) |
The text includes the plugin-specific option table.
>>> "Runge-Kutta" in doc_integrator("rk")
True
>> contains(doc_integrator('rk'), 'Runge-Kutta')
1
julia> occursin("Runge-Kutta", ca.doc_integrator("rk"))
true
Extra doc: https://github.com/casadi/casadi/wiki/L_2ok
Definition at line 130 of file integrator.cpp.
References casadi::PluginInterface< Integrator >::getPlugin().
| CASADI_EXPORT std::vector< std::string > casadi::dyn_in | ( | ) |
Returns the names of the 5 inputs of a DAE Function as expected by integrator, in order: t, x, z, p, u. These are also the dictionary keys accepted by integrator.
>>> dyn_in() ['t', 'x', 'z', 'p', 'u']
>> dyn_in() t x z p u
julia> ca.dyn_in()
5-element Vector{String}:
"t"
"x"
"z"
"p"
"u"
Extra doc: https://github.com/casadi/casadi/wiki/L_25p
Definition at line 232 of file integrator.cpp.
Referenced by casadi::DaeBuilder::create(), casadi::DaeBuilderInternal::fmu_fun(), casadi::Integrator::get_forward_dae(), casadi::Integrator::init(), casadi::RuntimeIntegrator::init(), casadi::Integrator::map2oracle(), and casadi::DaeBuilderInternal::transition().
| CASADI_EXPORT std::string casadi::dyn_in | ( | casadi_int | ind | ) |
| ind | Index in 0..dyn_n_in()-1; any other value gives an empty string |
>>> dyn_in(1), repr(dyn_in(5))
('x', "''")
>> dyn_in(1), isempty(dyn_in(5)) x 1
julia> ca.dyn_in(1), ca.dyn_in(5)
("x", "")
Extra doc: https://github.com/casadi/casadi/wiki/L_25r
Definition at line 240 of file integrator.cpp.
References casadi::to_string().
| CASADI_EXPORT casadi_int casadi::dyn_n_in | ( | ) |
>>> dyn_n_in() 5
>> dyn_n_in() 5
julia> ca.dyn_n_in() 5
Extra doc: https://github.com/casadi/casadi/wiki/L_25t
Definition at line 248 of file integrator.cpp.
References casadi::DYN_NUM_IN.
| CASADI_EXPORT casadi_int casadi::dyn_n_out | ( | ) |
>>> dyn_n_out() 4
>> dyn_n_out() 4
julia> ca.dyn_n_out() 4
Extra doc: https://github.com/casadi/casadi/wiki/L_25u
Definition at line 252 of file integrator.cpp.
References casadi::DYN_NUM_OUT.
| CASADI_EXPORT std::vector< std::string > casadi::dyn_out | ( | ) |
Returns the names of the 4 outputs of a DAE Function as expected by integrator, in order: ode, alg, quad, zero.
>>> dyn_out()
['ode', 'alg', 'quad', 'zero']
>>> x = SX.sym("x"); t = SX.sym("t"); e = SX(0, 1)
>>> dae = Function("dae", [t, x, e, e, e], [-x, e, x, e], dyn_in(), dyn_out())
>>> integrator("F", "rk", dae)(x0=1)["xf"]
DM(0.3679)
>> dyn_out()
ode
alg
quad
zero
>> x = SX.sym('x'); t = SX.sym('t'); e = SX(0, 1);
>> dae = Function('dae', {t, x, e, e, e}, {-x, e, x, e}, dyn_in(), dyn_out());
>> F = integrator('F', 'rk', dae); r = F('x0', 1); r.xf
0.3679
julia> ca.dyn_out()
4-element Vector{String}:
"ode"
"alg"
"quad"
"zero"
julia> x = ca.SX.sym("x"); t = ca.SX.sym("t"); e = ca.SX(0, 1);
julia> dae = ca.Function("dae", [t, x, e, e, e], [-x, e, x, e], ca.dyn_in(), ca.dyn_out());
julia> ca.integrator("F", "rk", dae)(x0=1)["xf"]
DM(0.3679)
Extra doc: https://github.com/casadi/casadi/wiki/L_25q
Definition at line 236 of file integrator.cpp.
Referenced by casadi::DaeBuilder::create(), casadi::DaeBuilderInternal::fmu_fun(), casadi::Integrator::get_forward_dae(), casadi::Integrator::init(), and casadi::Integrator::map2oracle().
| CASADI_EXPORT std::string casadi::dyn_out | ( | casadi_int | ind | ) |
| ind | Index in 0..dyn_n_out()-1; any other value gives an empty string |
>>> dyn_out(0), repr(dyn_out(4))
('ode', "''")
>> dyn_out(0), isempty(dyn_out(4)) ode 1
julia> ca.dyn_out(0), ca.dyn_out(4)
("ode", "")
Extra doc: https://github.com/casadi/casadi/wiki/L_25s
Definition at line 244 of file integrator.cpp.
References casadi::to_string().
| CASADI_EXPORT std::vector< std::string > casadi::event_in | ( | ) |
Returns the names of the inputs of the Function passed as option "transition" to integrator: index (of the triggered "zero" indicator), t, x, z, p, u.
>>> event_in() ['index', 't', 'x', 'z', 'p', 'u']
>> event_in() index t x z p u
julia> ca.event_in()
6-element Vector{String}:
"index"
"t"
"x"
"z"
"p"
"u"
Extra doc: https://github.com/casadi/casadi/wiki/L_2b4
Definition at line 256 of file integrator.cpp.
Referenced by casadi::DaeBuilderInternal::transition().
| CASADI_EXPORT std::vector< std::string > casadi::event_out | ( | ) |
Returns the names of the outputs of a transition Function: post_x, post_z, the values of x and z right after the event.
>>> event_out() ['post_x', 'post_z']
>> event_out() post_x post_z
julia> ca.event_out()
2-element Vector{String}:
"post_x"
"post_z"
Extra doc: https://github.com/casadi/casadi/wiki/L_2b5
Definition at line 260 of file integrator.cpp.
Referenced by casadi::DaeBuilderInternal::transition().
| CASADI_EXPORT bool casadi::has_integrator | ( | const std::string & | name | ) |
Tries to load the plugin name if it is not loaded yet; false when it is not found.
>>> has_integrator("rk"), has_integrator("no_such_plugin")
(True, False)
>> has_integrator('rk'), has_integrator('no_such_plugin')
1
0
julia> ca.has_integrator("rk"), ca.has_integrator("no_such_plugin")
(true, false)
Extra doc: https://github.com/casadi/casadi/wiki/L_2oi
Definition at line 122 of file integrator.cpp.
References casadi::PluginInterface< Integrator >::has_plugin().
| CASADI_EXPORT Function casadi::integrator | ( | const std::string & | name, |
| const std::string & | solver, | ||
| const Function & | dae, | ||
| const Dict & | opts | ||
| ) |
Definition at line 144 of file integrator.cpp.
References casadi::integrator().
| CASADI_EXPORT Function casadi::integrator | ( | const std::string & | name, |
| const std::string & | solver, | ||
| const Function & | dae, | ||
| double | t0, | ||
| const std::vector< double > & | tout, | ||
| const Dict & | opts | ||
| ) |
Definition at line 159 of file integrator.cpp.
References casadi::Integrator::create_advanced(), casadi::Function::get_free(), casadi::PluginInterface< Integrator >::getPlugin(), casadi::Function::has_free(), and casadi::str().
| CASADI_EXPORT Function casadi::integrator | ( | const std::string & | name, |
| const std::string & | solver, | ||
| const Function & | dae, | ||
| double | t0, | ||
| double | tf, | ||
| const Dict & | opts | ||
| ) |
Definition at line 179 of file integrator.cpp.
References casadi::integrator().
| CASADI_EXPORT Function casadi::integrator | ( | const std::string & | name, |
| const std::string & | solver, | ||
| const MXDict & | dae, | ||
| const Dict & | opts | ||
| ) |
Definition at line 139 of file integrator.cpp.
References casadi::integrator().
| CASADI_EXPORT Function casadi::integrator | ( | const std::string & | name, |
| const std::string & | solver, | ||
| const MXDict & | dae, | ||
| double | t0, | ||
| const std::vector< double > & | tout, | ||
| const Dict & | opts | ||
| ) |
Definition at line 154 of file integrator.cpp.
References casadi::integrator(), and casadi::Integrator::map2oracle().
| CASADI_EXPORT Function casadi::integrator | ( | const std::string & | name, |
| const std::string & | solver, | ||
| const MXDict & | dae, | ||
| double | t0, | ||
| double | tf, | ||
| const Dict & | opts | ||
| ) |
Definition at line 174 of file integrator.cpp.
References casadi::integrator().
| CASADI_EXPORT Function casadi::integrator | ( | const std::string & | name, |
| const std::string & | solver, | ||
| const SXDict & | dae, | ||
| const Dict & | opts = Dict() |
||
| ) |
Definition at line 134 of file integrator.cpp.
Referenced by casadi::Integrator::get_forward(), casadi::Integrator::get_reverse(), casadi::integrator(), and casadi::simpleIntegrator().
| CASADI_EXPORT Function casadi::integrator | ( | const std::string & | name, |
| const std::string & | solver, | ||
| const SXDict & | dae, | ||
| double | t0, | ||
| const std::vector< double > & | tout, | ||
| const Dict & | opts | ||
| ) |
Definition at line 149 of file integrator.cpp.
References casadi::integrator(), and casadi::Integrator::map2oracle().
| CASADI_EXPORT Function casadi::integrator | ( | const std::string & | name, |
| const std::string & | solver, | ||
| const SXDict & | dae, | ||
| double | t0, | ||
| double | tf, | ||
| const Dict & | opts | ||
| ) |
Definition at line 169 of file integrator.cpp.
References casadi::integrator().
| CASADI_EXPORT std::vector< std::string > casadi::integrator_in | ( | ) |
Returns the names of the 7 inputs of a Function created by integrator, in order: x0, z0, p, u, adj_xf, adj_zf, adj_qf.
>>> integrator_in() ['x0', 'z0', 'p', 'u', 'adj_xf', 'adj_zf', 'adj_qf']
>> integrator_in() x0 z0 p u adj_xf adj_zf adj_qf
julia> ca.integrator_in()
7-element Vector{String}:
"x0"
"z0"
"p"
"u"
"adj_xf"
"adj_zf"
"adj_qf"
Extra doc: https://github.com/casadi/casadi/wiki/L_7b
Definition at line 184 of file integrator.cpp.
References casadi::integrator_n_in().
Referenced by casadi::FixedStepIntegrator::create_advanced(), casadi::Integrator::get_forward(), casadi::Integrator::get_name_in(), and casadi::Integrator::get_reverse().
| CASADI_EXPORT std::string casadi::integrator_in | ( | casadi_int | ind | ) |
| ind | Index in 0..integrator_n_in()-1; any other value gives an empty string |
>>> integrator_in(0), integrator_in(6), repr(integrator_in(7))
('x0', 'adj_qf', "''")
>> integrator_in(0), integrator_in(6), isempty(integrator_in(7)) x0 adj_qf 1
julia> ca.integrator_in(0), ca.integrator_in(6), ca.integrator_in(7)
("x0", "adj_qf", "")
Extra doc: https://github.com/casadi/casadi/wiki/L_7d
Definition at line 196 of file integrator.cpp.
References casadi::INTEGRATOR_ADJ_QF, casadi::INTEGRATOR_ADJ_XF, casadi::INTEGRATOR_ADJ_ZF, casadi::INTEGRATOR_NUM_IN, casadi::INTEGRATOR_P, casadi::INTEGRATOR_U, casadi::INTEGRATOR_X0, and casadi::INTEGRATOR_Z0.
| CASADI_EXPORT casadi_int casadi::integrator_n_in | ( | ) |
>>> integrator_n_in() 7
>> integrator_n_in() 7
julia> ca.integrator_n_in() 7
Extra doc: https://github.com/casadi/casadi/wiki/L_7f
Definition at line 224 of file integrator.cpp.
References casadi::INTEGRATOR_NUM_IN.
Referenced by casadi::integrator_in().
| CASADI_EXPORT casadi_int casadi::integrator_n_out | ( | ) |
>>> integrator_n_out() 7
>> integrator_n_out() 7
julia> ca.integrator_n_out() 7
Extra doc: https://github.com/casadi/casadi/wiki/L_7g
Definition at line 228 of file integrator.cpp.
References casadi::INTEGRATOR_NUM_OUT.
Referenced by casadi::integrator_out().
| CASADI_EXPORT std::vector< std::string > casadi::integrator_out | ( | ) |
Returns the names of the 7 outputs of a Function created by integrator, in order: xf, zf, qf, adj_x0, adj_z0, adj_p, adj_u.
>>> integrator_out() ['xf', 'zf', 'qf', 'adj_x0', 'adj_z0', 'adj_p', 'adj_u']
>> integrator_out() xf zf qf adj_x0 adj_z0 adj_p adj_u
julia> ca.integrator_out()
7-element Vector{String}:
"xf"
"zf"
"qf"
"adj_x0"
"adj_z0"
"adj_p"
"adj_u"
Extra doc: https://github.com/casadi/casadi/wiki/L_7c
Definition at line 190 of file integrator.cpp.
References casadi::integrator_n_out().
Referenced by casadi::FixedStepIntegrator::create_advanced(), casadi::Integrator::get_forward(), casadi::Integrator::get_name_out(), and casadi::Integrator::get_reverse().
| CASADI_EXPORT std::string casadi::integrator_out | ( | casadi_int | ind | ) |
| ind | Index in 0..integrator_n_out()-1; any other value gives an empty string |
>>> integrator_out(0), integrator_out(6), repr(integrator_out(7))
('xf', 'adj_u', "''")
>> integrator_out(0), integrator_out(6), isempty(integrator_out(7)) xf adj_u 1
julia> ca.integrator_out(0), ca.integrator_out(6), ca.integrator_out(7)
("xf", "adj_u", "")
Extra doc: https://github.com/casadi/casadi/wiki/L_7e
Definition at line 210 of file integrator.cpp.
References casadi::INTEGRATOR_ADJ_P, casadi::INTEGRATOR_ADJ_U, casadi::INTEGRATOR_ADJ_X0, casadi::INTEGRATOR_ADJ_Z0, casadi::INTEGRATOR_NUM_OUT, casadi::INTEGRATOR_QF, casadi::INTEGRATOR_XF, and casadi::INTEGRATOR_ZF.
| CASADI_EXPORT void casadi::load_integrator | ( | const std::string & | name | ) |
Normally plugins are loaded on first use; this raises an error when the plugin cannot be found.
>>> try:
... load_integrator("no_such_plugin")
... except RuntimeError as e:
... print("no_such_plugin" in str(e))
True
>> try, load_integrator('no_such_plugin'); catch e, msg = e.message; end
>> contains(msg, 'no_such_plugin')
1
julia> try
ca.load_integrator("no_such_plugin")
catch e
println(occursin("no_such_plugin", sprint(showerror, e)))
end
true
Extra doc: https://github.com/casadi/casadi/wiki/L_2oj
Definition at line 126 of file integrator.cpp.
References casadi::PluginInterface< Integrator >::load_plugin().