Module Expr Str Import alias identifier ImportFrom alias ImportFrom alias alias ImportFrom alias Print Str Assign NameStore Call NameLoad Num NameLoad NameLoad Print Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Num Num Num Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr TupleLoad Num Call NameLoad AttributeLoad NameLoad attr Print Str Assign NameStore Call AttributeLoad NameLoad attr keyword Str Print Str FunctionDef arguments args NameParam defaults body Return Call NameLoad NameLoad SubscriptLoad NameLoad Index Num NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call NameLoad NameLoad NameLoad NameLoad keyword TupleLoad NameLoad decorator_list Print Str Assign NameStore Call Call NameLoad keyword Num GeneratorExp Call Call NameLoad NameLoad NameLoad comprehension NameStore NameLoad Print Str Assign NameStore Call Call NameLoad keyword Num GeneratorExp Call Call NameLoad NameLoad NameLoad comprehension NameStore NameLoad
N/A N/A This example shows how you can parallelize ODE integration of a generated
ODE function using joblib. The example shows how you can both evaluate the
right hand side function and integrate the equations of motion with
different model parameters while spreading the independent computations over
the number of CPUs on the computer. For example, this could be useful in
genetic algorithm optimization routines to parallelize the evaluation of the
cost function at each iteration. N/A numpy np scipy.integrate odeint joblib Parallel delayed pydy.models n_link_pendulum_on_cart N/A Generating equations of motion N/A sys N/A n_link_pendulum_on_cart 10 False False N/A Defining numerical values N/A x N/A N/A N/A np random random N/A len N/A sys states N/A t N/A N/A np linspace 0.0 10.0 100000 N/A p_set N/A N/A N/A np random random N/A 16 N/A len N/A sys constants_symbols N/A Generating the ODE function N/A rhs N/A N/A sys generate_ode_function generator cython N/A Defining wrapper functions rhs_wrapper N/A N/A p N/A N/A N/A N/A rhs x N/A t N/A 0 p N/A odeint_wrapper N/A N/A p N/A N/A N/A N/A odeint rhs x t args N/A p N/A N/A Running rhs evalutions in parallel N/A res1 N/A N/A Parallel n_jobs -1 N/A N/A N/A delayed rhs_wrapper p N/A p p_set N/A Running odeint evaluations in parallel N/A res2 N/A N/A Parallel n_jobs -1 N/A N/A N/A delayed odeint_wrapper p N/A p p_set