sleipnirgroup-jormungandr 0.6.7.dev113__tar.gz → 0.6.7.dev114__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sleipnirgroup-jormungandr might be problematic. Click here for more details.
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/PKG-INFO +1 -1
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/src/sleipnir/__init__.py +1 -1
- sleipnirgroup_jormungandr-0.6.7.dev114/python/test/optimization/double_integrator_problem_test.py +241 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/flywheel_ocp_test.py +14 -43
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/flywheel_problem_test.py +11 -42
- sleipnirgroup_jormungandr-0.6.7.dev114/python/test/optimization/flywheel_util.py +52 -0
- sleipnirgroup_jormungandr-0.6.7.dev113/python/test/optimization/double_integrator_problem_test.py +0 -120
- sleipnirgroup_jormungandr-0.6.7.dev113/python/test/optimization/near.py +0 -2
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/CMakeLists.txt +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/LICENSE.txt +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/README.md +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/SleipnirConfig.cmake.in +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/cmake/BuildTypes.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/cmake/CompilerFlags.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/cmake/Pybind11Mkdoc.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/cmake/Pybind11MkdocPostprocess.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/cmake/SubdirList.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/cmake/aarch64-linux-gnu.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/cmake/arm-none-eabi.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/autodiff/expression.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/autodiff/expression_functions.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/autodiff/expression_graph.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/autodiff/expression_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/autodiff/gradient.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/autodiff/hessian.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/autodiff/jacobian.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/autodiff/sleipnir_base.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/autodiff/slice.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/autodiff/variable.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/autodiff/variable_block.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/autodiff/variable_matrix.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/multistart.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/ocp/dynamics_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/ocp/timestep_method.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/ocp/transcription_method.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/ocp.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/problem.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/exit_status.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/ipm.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/ipm_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/iteration_info.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/newton.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/newton_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/options.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/sqp.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/sqp_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/all_finite.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/append_as_triplets.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/bounds.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/constraint_violation.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/dense_kkt_solver.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/feasibility_restoration.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/feasibility_restoration_cycle_detector.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/filter.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/fraction_to_the_boundary_rule.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/inertia.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/kkt_error.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/kkt_solver.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/problem_scaling.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/sparse_inf_norms.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/sparse_kkt_solver.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/optimization/solver/util/time_trace.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/util/assert.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/util/concepts.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/util/empty.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/util/force_inline.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/util/function_ref.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/util/intrusive_shared_ptr.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/util/pool.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/util/print.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/util/print_diagnostics.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/util/scope_exit.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/util/spy.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/util/symbol_exports.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/include/sleipnir/util/time_tracer.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/pyproject.toml +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/arity.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/autodiff/bind_expression_type.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/autodiff/bind_gradient.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/autodiff/bind_hessian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/autodiff/bind_jacobian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/autodiff/bind_variable.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/autodiff/bind_variable_block.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/autodiff/bind_variable_matrix.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/binders.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/docstrings.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/for_each_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/main.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/optimization/bind_equality_constraints.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/optimization/bind_inequality_constraints.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/optimization/bind_ocp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/optimization/bind_problem.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/optimization/ocp/bind_dynamics_type.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/optimization/ocp/bind_timestep_method.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/optimization/ocp/bind_transcription_method.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/optimization/solver/bind_exit_status.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/optimization/solver/bind_iteration_info.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/slice_tuple.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/text_wrap.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/cpp/try_cast.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/postprocess_stubs.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/src/sleipnir/autodiff/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/src/sleipnir/optimization/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/autodiff/gradient_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/autodiff/hessian_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/autodiff/jacobian_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/autodiff/variable_matrix_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/autodiff/variable_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/arm_on_elevator_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/cart_pole_ocp_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/cart_pole_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/cart_pole_util.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/constraints_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/decision_variable_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/differential_drive_ocp_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/differential_drive_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/differential_drive_util.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/linear_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/multistart_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/nonlinear_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/problem_spy_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/quadratic_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/rk4.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/solver/exit_status_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/python/test/optimization/trivial_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/src/autodiff/gradient.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/src/autodiff/hessian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/src/autodiff/jacobian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/src/autodiff/variable_matrix.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/src/optimization/ocp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/src/optimization/problem.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/src/optimization/solver/ipm.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/src/optimization/solver/newton.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/src/optimization/solver/sqp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/src/util/pool.cpp +0 -0
sleipnirgroup_jormungandr-0.6.7.dev114/python/test/optimization/double_integrator_problem_test.py
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import math
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import numpy.typing as npt
|
|
5
|
+
import pytest
|
|
6
|
+
from scipy.signal import cont2discrete
|
|
7
|
+
from sleipnir.autodiff import ExpressionType
|
|
8
|
+
from sleipnir.optimization import ExitStatus, Problem, bounds
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def optimal_double_integrator_inputs(
|
|
12
|
+
r: float, dt: float, N: int
|
|
13
|
+
) -> npt.NDArray[np.float64]:
|
|
14
|
+
"""
|
|
15
|
+
Returns the input trajectory that minimizes Σ(r − pₖ)² for k ∈ [0, N]
|
|
16
|
+
subject to double integrator kinematics with timestep dt, starting and
|
|
17
|
+
ending at rest at 0 and r respectively, |vₖ| ≤ 1, and |aₖ| ≤ 1.
|
|
18
|
+
|
|
19
|
+
Parameter ``r``:
|
|
20
|
+
Reference position.
|
|
21
|
+
|
|
22
|
+
Parameter ``dt``:
|
|
23
|
+
Timestep.
|
|
24
|
+
|
|
25
|
+
Parameter ``N``:
|
|
26
|
+
Number of timesteps.
|
|
27
|
+
"""
|
|
28
|
+
v_max = 1.0
|
|
29
|
+
a_max = 1.0
|
|
30
|
+
t_n = N * dt
|
|
31
|
+
|
|
32
|
+
# The optimal input accelerates to the velocity limit, cruises, then
|
|
33
|
+
# decelerates past r and accelerates back to rest at r. In continuous time,
|
|
34
|
+
# let vₘₐₓ = 1 and aₘₐₓ = 1 be the velocity and acceleration limits and
|
|
35
|
+
# tₙ = N dt be the total time. A phase with input u and duration t changes
|
|
36
|
+
# the velocity by ut, and if it starts at velocity v₀, it covers
|
|
37
|
+
# v₀t + ut²/2. The phases are
|
|
38
|
+
#
|
|
39
|
+
# Phase │ Duration │ u │ Final v │ Distance
|
|
40
|
+
# ───────────┼──────────┼───────┼─────────┼───────────────────
|
|
41
|
+
# Accelerate │ t₁ │ aₘₐₓ │ vₘₐₓ │ aₘₐₓt₁²/2
|
|
42
|
+
# Cruise │ t₂ │ 0 │ vₘₐₓ │ vₘₐₓt₂
|
|
43
|
+
# Decelerate │ t₃ │ −aₘₐₓ │ −aₘₐₓt₄ │ vₘₐₓt₃ − aₘₐₓt₃²/2
|
|
44
|
+
# Accelerate │ t₄ │ aₘₐₓ │ 0 │ −aₘₐₓt₄²/2
|
|
45
|
+
#
|
|
46
|
+
# where t₁ = vₘₐₓ/aₘₐₓ. The phases fill the total time. Deceleration
|
|
47
|
+
# starts at vₘₐₓ and the final acceleration ends at rest, so the velocity
|
|
48
|
+
# between them is both vₘₐₓ − aₘₐₓt₃ and −aₘₐₓt₄. Therefore,
|
|
49
|
+
#
|
|
50
|
+
# t₁ + t₂ + t₃ + t₄ = tₙ
|
|
51
|
+
# vₘₐₓ − aₘₐₓt₃ = −aₘₐₓt₄
|
|
52
|
+
#
|
|
53
|
+
# Dividing the second equation by aₘₐₓ gives t₄ = t₃ − t₁, and substituting
|
|
54
|
+
# that into the first gives t₂ = tₙ − 2t₃. Ending at r requires the
|
|
55
|
+
# distances to sum to r. Dividing that sum by aₘₐₓ and substituting
|
|
56
|
+
# vₘₐₓ/aₘₐₓ = t₁ gives
|
|
57
|
+
#
|
|
58
|
+
# t₁²/2 + t₁t₂ + t₁t₃ − (t₃² + t₄²)/2 = r/aₘₐₓ
|
|
59
|
+
# t₁²/2 + t₁(tₙ − 2t₃) + t₁t₃ − (t₃² + (t₃ − t₁)²)/2 = r/aₘₐₓ
|
|
60
|
+
# t₁²/2 + t₁tₙ − t₁t₃ − t₃² + t₁t₃ − t₁²/2 = r/aₘₐₓ
|
|
61
|
+
# t₁tₙ − t₃² = r/aₘₐₓ
|
|
62
|
+
# t₃ = √(t₁tₙ − r/aₘₐₓ)
|
|
63
|
+
#
|
|
64
|
+
# so the phase durations are
|
|
65
|
+
#
|
|
66
|
+
# t₁ = vₘₐₓ/aₘₐₓ
|
|
67
|
+
# t₂ = tₙ − 2t₃
|
|
68
|
+
# t₃ = √(t₁tₙ − r/aₘₐₓ)
|
|
69
|
+
# t₄ = t₃ − t₁
|
|
70
|
+
t_1 = v_max / a_max
|
|
71
|
+
t_3 = math.sqrt(t_1 * t_n - r / a_max)
|
|
72
|
+
t_2 = t_n - 2.0 * t_3
|
|
73
|
+
t_4 = t_3 - t_1
|
|
74
|
+
|
|
75
|
+
# Each phase starts when the previous one ends, and the last ends at tₙ, so
|
|
76
|
+
# the phases start at 0, t₁, t₁ + t₂, and tₙ − t₄.
|
|
77
|
+
#
|
|
78
|
+
# The kinematics are exact for piecewise constant acceleration, so the
|
|
79
|
+
# discrete optimum switches at the same times. Timestep k applies uₖ over
|
|
80
|
+
# [k dt, (k + 1) dt), so cruising, deceleration, and the final acceleration
|
|
81
|
+
# start in timesteps
|
|
82
|
+
#
|
|
83
|
+
# k₂ = t₁/dt
|
|
84
|
+
# k₃ = ⌊(t₁ + t₂)/dt⌋
|
|
85
|
+
# k₄ = ⌊(tₙ − t₄)/dt⌋
|
|
86
|
+
#
|
|
87
|
+
# t₁/dt is assumed to be an integer, so cruising starts on a timestep
|
|
88
|
+
# boundary.
|
|
89
|
+
k_2 = round(t_1 / dt)
|
|
90
|
+
k_3 = math.floor((t_1 + t_2) / dt)
|
|
91
|
+
k_4 = math.floor((t_n - t_4) / dt)
|
|
92
|
+
|
|
93
|
+
# Every timestep's input is its phase's u, except in timesteps k₃ and k₄.
|
|
94
|
+
# Deceleration and the final acceleration generally start partway through
|
|
95
|
+
# those timesteps, so they take fractional inputs, which start at zero and
|
|
96
|
+
# are solved for below.
|
|
97
|
+
U = np.zeros(N)
|
|
98
|
+
U[:k_2] = a_max
|
|
99
|
+
U[k_3 + 1 : k_4] = -a_max
|
|
100
|
+
U[k_4 + 1 :] = a_max
|
|
101
|
+
|
|
102
|
+
# Continuous dynamics ẋ = Ax + Bu with state x = [p v]ᵀ and input u = a
|
|
103
|
+
A = np.array([[0.0, 1.0], [0.0, 0.0]])
|
|
104
|
+
B = np.array([[0.0], [1.0]])
|
|
105
|
+
A_d, B_d, *_ = cont2discrete((A, B, np.eye(2), np.zeros((2, 1))), dt)
|
|
106
|
+
|
|
107
|
+
def final_state(inputs: npt.NDArray[np.float64]) -> npt.NDArray[np.float64]:
|
|
108
|
+
"""
|
|
109
|
+
Returns the state at timestep N reached from rest at 0 with the inputs.
|
|
110
|
+
"""
|
|
111
|
+
x = np.zeros((2, 1))
|
|
112
|
+
for u in inputs:
|
|
113
|
+
x = A_d @ x + B_d * u
|
|
114
|
+
return x
|
|
115
|
+
|
|
116
|
+
def unit(k: int) -> npt.NDArray[np.float64]:
|
|
117
|
+
"""
|
|
118
|
+
Returns the inputs that are zero except for a unit input at timestep k.
|
|
119
|
+
"""
|
|
120
|
+
e = np.zeros(N)
|
|
121
|
+
e[k] = 1.0
|
|
122
|
+
return e
|
|
123
|
+
|
|
124
|
+
# The discrete dynamics xₖ₊₁ = A_d xₖ + B_d uₖ are exact for piecewise
|
|
125
|
+
# constant inputs and linear in the inputs, so the final state is
|
|
126
|
+
#
|
|
127
|
+
# xₙ = x_fixed + c₃uₖ₃ + c₄uₖ₄
|
|
128
|
+
#
|
|
129
|
+
# where x_fixed is the final state from the fixed inputs alone, and c₃ and
|
|
130
|
+
# c₄ are the final states from unit inputs at timesteps k₃ and k₄. The
|
|
131
|
+
# fractional inputs are still zero in U, so x_fixed is the final state
|
|
132
|
+
# from U. Ending at rest at r requires
|
|
133
|
+
#
|
|
134
|
+
# [uₖ₃] [r]
|
|
135
|
+
# [c₃ c₄][uₖ₄] = [0] − x_fixed
|
|
136
|
+
#
|
|
137
|
+
# which is a 2×2 linear system for the fractional inputs.
|
|
138
|
+
x_fixed = final_state(U)
|
|
139
|
+
C = np.hstack([final_state(unit(k_3)), final_state(unit(k_4))])
|
|
140
|
+
U[k_3], U[k_4] = np.linalg.solve(C, np.array([[r], [0.0]]) - x_fixed)[:, 0]
|
|
141
|
+
|
|
142
|
+
return U
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def test_double_integrator_problem() -> None:
|
|
146
|
+
TOTAL_TIME = 3.5
|
|
147
|
+
dt = 0.005
|
|
148
|
+
N = int(TOTAL_TIME / dt)
|
|
149
|
+
|
|
150
|
+
r = 2.0
|
|
151
|
+
|
|
152
|
+
problem = Problem()
|
|
153
|
+
|
|
154
|
+
# 2x1 state vector with N + 1 timesteps (includes last state)
|
|
155
|
+
X = problem.decision_variable(2, N + 1)
|
|
156
|
+
|
|
157
|
+
# 1x1 input vector with N timesteps (input at last state doesn't matter)
|
|
158
|
+
U = problem.decision_variable(1, N)
|
|
159
|
+
|
|
160
|
+
# Kinematics constraint assuming constant acceleration between timesteps
|
|
161
|
+
for k in range(N):
|
|
162
|
+
t = dt
|
|
163
|
+
p_k1 = X[0, k + 1]
|
|
164
|
+
v_k1 = X[1, k + 1]
|
|
165
|
+
p_k = X[0, k]
|
|
166
|
+
v_k = X[1, k]
|
|
167
|
+
a_k = U[0, k]
|
|
168
|
+
|
|
169
|
+
# pₖ₊₁ = pₖ + vₖt + 1/2aₖt²
|
|
170
|
+
problem.subject_to(p_k1 == p_k + v_k * t + 0.5 * a_k * t**2)
|
|
171
|
+
|
|
172
|
+
# vₖ₊₁ = vₖ + aₖt
|
|
173
|
+
problem.subject_to(v_k1 == v_k + a_k * t)
|
|
174
|
+
|
|
175
|
+
# Start and end at rest
|
|
176
|
+
problem.subject_to(X[:, :1] == np.array([[0.0], [0.0]]))
|
|
177
|
+
problem.subject_to(X[:, N : N + 1] == np.array([[r], [0.0]]))
|
|
178
|
+
|
|
179
|
+
# Limit velocity
|
|
180
|
+
problem.subject_to(bounds(-1, X[1:2, :], 1))
|
|
181
|
+
|
|
182
|
+
# Limit acceleration
|
|
183
|
+
problem.subject_to(bounds(-1, U, 1))
|
|
184
|
+
|
|
185
|
+
# Cost function - minimize position error
|
|
186
|
+
problem.minimize(sum((r - X[0, k]) ** 2 for k in range(N + 1)))
|
|
187
|
+
|
|
188
|
+
assert problem.cost_function_type() == ExpressionType.QUADRATIC
|
|
189
|
+
assert problem.equality_constraint_type() == ExpressionType.LINEAR
|
|
190
|
+
assert problem.inequality_constraint_type() == ExpressionType.LINEAR
|
|
191
|
+
|
|
192
|
+
assert problem.solve(diagnostics=True) == ExitStatus.SUCCESS
|
|
193
|
+
|
|
194
|
+
A = np.array([[0.0, 1.0], [0.0, 0.0]])
|
|
195
|
+
B = np.array([[0.0], [1.0]])
|
|
196
|
+
A_d, B_d, *_ = cont2discrete((A, B, np.eye(2), np.zeros((2, 1))), dt, method="zoh")
|
|
197
|
+
|
|
198
|
+
U_ref = optimal_double_integrator_inputs(r, dt, N)
|
|
199
|
+
|
|
200
|
+
# Only position is in the cost, and vₖ affects it only through pₖ₊₁, so
|
|
201
|
+
# velocity is determined less precisely than position. uₖ affects only vₖ₊₁
|
|
202
|
+
# through the dt uₖ it adds, so U is determined 1/dt times less precisely
|
|
203
|
+
# than velocity.
|
|
204
|
+
p_tolerance = 1e-4
|
|
205
|
+
v_tolerance = 1e-3
|
|
206
|
+
u_tolerance = v_tolerance / dt
|
|
207
|
+
|
|
208
|
+
# Verify initial state
|
|
209
|
+
assert X.value(0, 0) == pytest.approx(0.0, abs=1e-8)
|
|
210
|
+
assert X.value(1, 0) == pytest.approx(0.0, abs=1e-8)
|
|
211
|
+
|
|
212
|
+
# Verify solution
|
|
213
|
+
x_ref = np.zeros((2, 1))
|
|
214
|
+
for k in range(N + 1):
|
|
215
|
+
assert X.value(0, k) == pytest.approx(x_ref[0, 0], abs=p_tolerance)
|
|
216
|
+
assert X.value(1, k) == pytest.approx(x_ref[1, 0], abs=v_tolerance)
|
|
217
|
+
|
|
218
|
+
if k < N:
|
|
219
|
+
assert U.value(0, k) == pytest.approx(U_ref[k], abs=u_tolerance)
|
|
220
|
+
x_ref = A_d @ x_ref + B_d * U_ref[k]
|
|
221
|
+
|
|
222
|
+
# Verify final state
|
|
223
|
+
assert X.value(0, N) == pytest.approx(r, abs=1e-8)
|
|
224
|
+
assert X.value(1, N) == pytest.approx(0.0, abs=1e-8)
|
|
225
|
+
|
|
226
|
+
# Log states for offline viewing
|
|
227
|
+
with open("Double integrator states.csv", "w") as f:
|
|
228
|
+
f.write("Time (s),Position (m),Velocity (rad/s)\n")
|
|
229
|
+
|
|
230
|
+
for k in range(N + 1):
|
|
231
|
+
f.write(f"{k * dt},{X.value(0, k)},{X.value(1, k)}\n")
|
|
232
|
+
|
|
233
|
+
# Log inputs for offline viewing
|
|
234
|
+
with open("Double integrator inputs.csv", "w") as f:
|
|
235
|
+
f.write("Time (s),Acceleration (m/s²)\n")
|
|
236
|
+
|
|
237
|
+
for k in range(N + 1):
|
|
238
|
+
if k < N:
|
|
239
|
+
f.write(f"{k * dt},{U.value(0, k)}\n")
|
|
240
|
+
else:
|
|
241
|
+
f.write(f"{k * dt},0.0\n")
|
|
@@ -3,7 +3,7 @@ from collections.abc import Callable
|
|
|
3
3
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
import pytest
|
|
6
|
-
from
|
|
6
|
+
from flywheel_util import optimal_flywheel_trajectory
|
|
7
7
|
from sleipnir.autodiff import ExpressionType, VariableMatrix
|
|
8
8
|
from sleipnir.optimization import (
|
|
9
9
|
OCP,
|
|
@@ -55,58 +55,29 @@ def flywheel_test(
|
|
|
55
55
|
|
|
56
56
|
assert problem.solve(diagnostics=True) == ExitStatus.SUCCESS
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
#
|
|
61
|
-
#
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
u_ss = 1.0 / B_discrete * (1.0 - A_discrete) * r
|
|
58
|
+
X_ref, U_ref = optimal_flywheel_trajectory(A_discrete, B_discrete, r, 12.0, N)
|
|
59
|
+
|
|
60
|
+
# The cost depends on uₖ only through the Buₖ it adds to xₖ₊₁, so U is
|
|
61
|
+
# determined 1/B times less precisely than X
|
|
62
|
+
x_tolerance = 1e-4
|
|
63
|
+
u_tolerance = x_tolerance / B_discrete
|
|
65
64
|
|
|
66
65
|
# Verify initial state
|
|
67
66
|
assert problem.X().value(0, 0) == pytest.approx(0.0, abs=1e-8)
|
|
68
67
|
|
|
69
68
|
# Verify solution
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
# Verify state
|
|
74
|
-
assert problem.X().value(0, k) == pytest.approx(x, abs=1e-2)
|
|
75
|
-
|
|
76
|
-
# Determine expected input for this timestep
|
|
77
|
-
error = r - x
|
|
78
|
-
if error > 1e-2:
|
|
79
|
-
# Max control input until the reference is reached
|
|
80
|
-
u = 12.0
|
|
81
|
-
else:
|
|
82
|
-
# Maintain speed
|
|
83
|
-
u = u_ss
|
|
84
|
-
|
|
85
|
-
# Verify input
|
|
86
|
-
if (
|
|
87
|
-
k > 0
|
|
88
|
-
and k < N - 1
|
|
89
|
-
and near(12.0, problem.U().value(0, k - 1), 1e-2)
|
|
90
|
-
and near(u_ss, problem.U().value(0, k + 1), 1e-2)
|
|
91
|
-
):
|
|
92
|
-
# If control input is transitioning between 12 and u_ss, ensure it's
|
|
93
|
-
# within (u_ss, 12)
|
|
94
|
-
assert problem.U().value(0, k) >= u_ss
|
|
95
|
-
assert problem.U().value(0, k) <= 12.0
|
|
96
|
-
else:
|
|
69
|
+
for k in range(N + 1):
|
|
70
|
+
assert problem.X().value(0, k) == pytest.approx(X_ref[k], abs=x_tolerance)
|
|
71
|
+
if k < N:
|
|
97
72
|
if transcription_method == TranscriptionMethod.DIRECT_COLLOCATION:
|
|
98
73
|
# The tolerance is large because the trajectory is represented by a
|
|
99
74
|
# spline, and splines chatter when transitioning quickly between
|
|
100
75
|
# steady-states.
|
|
101
|
-
assert problem.U().value(0, k) == pytest.approx(
|
|
76
|
+
assert problem.U().value(0, k) == pytest.approx(U_ref[k], abs=2.0)
|
|
102
77
|
else:
|
|
103
|
-
assert problem.U().value(0, k) == pytest.approx(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
x = A_discrete * x + B_discrete * u
|
|
107
|
-
|
|
108
|
-
# Verify final state
|
|
109
|
-
assert problem.X().value(0, N) == pytest.approx(r, abs=2e-6)
|
|
78
|
+
assert problem.U().value(0, k) == pytest.approx(
|
|
79
|
+
U_ref[k], abs=u_tolerance
|
|
80
|
+
)
|
|
110
81
|
|
|
111
82
|
# Log states for offline viewing
|
|
112
83
|
with open(f"{test_name} states.csv", "w") as file:
|
|
@@ -2,7 +2,7 @@ import math
|
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
import pytest
|
|
5
|
-
from
|
|
5
|
+
from flywheel_util import optimal_flywheel_trajectory
|
|
6
6
|
from sleipnir.autodiff import ExpressionType
|
|
7
7
|
from sleipnir.optimization import ExitStatus, Problem, bounds
|
|
8
8
|
|
|
@@ -44,52 +44,21 @@ def test_flywheel_problem() -> None:
|
|
|
44
44
|
|
|
45
45
|
assert problem.solve(diagnostics=True) == ExitStatus.SUCCESS
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
u_ss = 1.0 / B * (1.0 - A) * r[0, 0]
|
|
47
|
+
X_ref, U_ref = optimal_flywheel_trajectory(A, B, r[0, 0], 12.0, N)
|
|
48
|
+
|
|
49
|
+
# The cost depends on uₖ only through the Buₖ it adds to xₖ₊₁, so U is
|
|
50
|
+
# determined 1/B times less precisely than X
|
|
51
|
+
x_tolerance = 1e-4
|
|
52
|
+
u_tolerance = x_tolerance / B
|
|
54
53
|
|
|
55
54
|
# Verify initial state
|
|
56
55
|
assert X.value(0, 0) == pytest.approx(0.0, abs=1e-8)
|
|
57
56
|
|
|
58
57
|
# Verify solution
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
assert X.value(0, k) == pytest.approx(x, abs=1e-2)
|
|
64
|
-
|
|
65
|
-
# Determine expected input for this timestep
|
|
66
|
-
error = r[0, 0] - x
|
|
67
|
-
if error > 1e-2:
|
|
68
|
-
# Max control input until the reference is reached
|
|
69
|
-
u = 12.0
|
|
70
|
-
else:
|
|
71
|
-
# Maintain speed
|
|
72
|
-
u = u_ss
|
|
73
|
-
|
|
74
|
-
# Verify input
|
|
75
|
-
if (
|
|
76
|
-
k > 0
|
|
77
|
-
and k < N - 1
|
|
78
|
-
and near(12.0, U.value(0, k - 1), 1e-2)
|
|
79
|
-
and near(u_ss, U.value(0, k + 1), 1e-2)
|
|
80
|
-
):
|
|
81
|
-
# If control input is transitioning between 12 and u_ss, ensure it's
|
|
82
|
-
# within (u_ss, 12)
|
|
83
|
-
assert U.value(0, k) >= u_ss
|
|
84
|
-
assert U.value(0, k) <= 12.0
|
|
85
|
-
else:
|
|
86
|
-
assert U.value(0, k) == pytest.approx(u, abs=2e-4)
|
|
87
|
-
|
|
88
|
-
# Project state forward
|
|
89
|
-
x = A * x + B * u
|
|
90
|
-
|
|
91
|
-
# Verify final state
|
|
92
|
-
assert X.value(0, N) == pytest.approx(r[0, 0], abs=2e-7)
|
|
58
|
+
for k in range(N + 1):
|
|
59
|
+
assert X.value(0, k) == pytest.approx(X_ref[k], abs=x_tolerance)
|
|
60
|
+
if k < N:
|
|
61
|
+
assert U.value(0, k) == pytest.approx(U_ref[k], abs=u_tolerance)
|
|
93
62
|
|
|
94
63
|
# Log states for offline viewing
|
|
95
64
|
with open("Flywheel states.csv", "w") as f:
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import numpy.typing as npt
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def optimal_flywheel_trajectory(
|
|
6
|
+
A: float, B: float, r: float, u_max: float, N: int
|
|
7
|
+
) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
|
|
8
|
+
"""
|
|
9
|
+
Returns the states x₀, …, x_N and inputs u₀, …, u_N₋₁ that minimize
|
|
10
|
+
Σ(r − xₖ)² for k = 0, …, N subject to xₖ₊₁ = Axₖ + Buₖ, x₀ = 0, and
|
|
11
|
+
|uₖ| ≤ u_max, where 0 < A < 1, B > 0, r > 0, and u_max ≥ (1 − A)r/B
|
|
12
|
+
(the input that holds xₖ = r).
|
|
13
|
+
|
|
14
|
+
Parameter ``A``:
|
|
15
|
+
Discrete state transition.
|
|
16
|
+
|
|
17
|
+
Parameter ``B``:
|
|
18
|
+
Discrete input gain.
|
|
19
|
+
|
|
20
|
+
Parameter ``r``:
|
|
21
|
+
Reference state.
|
|
22
|
+
|
|
23
|
+
Parameter ``u_max``:
|
|
24
|
+
Input bound.
|
|
25
|
+
|
|
26
|
+
Parameter ``N``:
|
|
27
|
+
Number of timesteps.
|
|
28
|
+
"""
|
|
29
|
+
# Every xₖ increases with each of u₀, …, uₖ₋₁, so each cost term is
|
|
30
|
+
# minimized by driving xₖ as close to r as the input bound allows.
|
|
31
|
+
# Saturating the input until one step can land exactly on r, then holding it
|
|
32
|
+
# there, minimizes every term at once.
|
|
33
|
+
#
|
|
34
|
+
# Once xₖ = r, the landing input is uₖ = (r − Ar)/B = (1 − A)r/B, the
|
|
35
|
+
# steady-state input, so the landing branch also holds the reference.
|
|
36
|
+
|
|
37
|
+
X = np.zeros(N + 1)
|
|
38
|
+
U = np.zeros(N)
|
|
39
|
+
|
|
40
|
+
for k in range(N):
|
|
41
|
+
x = X[k]
|
|
42
|
+
|
|
43
|
+
if A * x + B * u_max < r:
|
|
44
|
+
# Saturate the input until the reference is within one step
|
|
45
|
+
U[k] = u_max
|
|
46
|
+
X[k + 1] = A * x + B * u_max
|
|
47
|
+
else:
|
|
48
|
+
# Land exactly on (or hold) the reference
|
|
49
|
+
U[k] = (r - A * x) / B
|
|
50
|
+
X[k + 1] = r
|
|
51
|
+
|
|
52
|
+
return X, U
|
sleipnirgroup_jormungandr-0.6.7.dev113/python/test/optimization/double_integrator_problem_test.py
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
import pytest
|
|
3
|
-
from sleipnir.autodiff import ExpressionType
|
|
4
|
-
from sleipnir.optimization import ExitStatus, Problem, bounds
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def test_double_integrator_problem() -> None:
|
|
8
|
-
TOTAL_TIME = 3.5
|
|
9
|
-
dt = 0.005
|
|
10
|
-
N = int(TOTAL_TIME / dt)
|
|
11
|
-
|
|
12
|
-
r = 2.0
|
|
13
|
-
|
|
14
|
-
problem = Problem()
|
|
15
|
-
|
|
16
|
-
# 2x1 state vector with N + 1 timesteps (includes last state)
|
|
17
|
-
X = problem.decision_variable(2, N + 1)
|
|
18
|
-
|
|
19
|
-
# 1x1 input vector with N timesteps (input at last state doesn't matter)
|
|
20
|
-
U = problem.decision_variable(1, N)
|
|
21
|
-
|
|
22
|
-
# Kinematics constraint assuming constant acceleration between timesteps
|
|
23
|
-
for k in range(N):
|
|
24
|
-
t = dt
|
|
25
|
-
p_k1 = X[0, k + 1]
|
|
26
|
-
v_k1 = X[1, k + 1]
|
|
27
|
-
p_k = X[0, k]
|
|
28
|
-
v_k = X[1, k]
|
|
29
|
-
a_k = U[0, k]
|
|
30
|
-
|
|
31
|
-
# pₖ₊₁ = pₖ + vₖt + 1/2aₖt²
|
|
32
|
-
problem.subject_to(p_k1 == p_k + v_k * t + 0.5 * a_k * t**2)
|
|
33
|
-
|
|
34
|
-
# vₖ₊₁ = vₖ + aₖt
|
|
35
|
-
problem.subject_to(v_k1 == v_k + a_k * t)
|
|
36
|
-
|
|
37
|
-
# Start and end at rest
|
|
38
|
-
problem.subject_to(X[:, :1] == np.array([[0.0], [0.0]]))
|
|
39
|
-
problem.subject_to(X[:, N : N + 1] == np.array([[r], [0.0]]))
|
|
40
|
-
|
|
41
|
-
# Limit velocity
|
|
42
|
-
problem.subject_to(bounds(-1, X[1:2, :], 1))
|
|
43
|
-
|
|
44
|
-
# Limit acceleration
|
|
45
|
-
problem.subject_to(bounds(-1, U, 1))
|
|
46
|
-
|
|
47
|
-
# Cost function - minimize position error
|
|
48
|
-
problem.minimize(sum((r - X[0, k]) ** 2 for k in range(N + 1)))
|
|
49
|
-
|
|
50
|
-
assert problem.cost_function_type() == ExpressionType.QUADRATIC
|
|
51
|
-
assert problem.equality_constraint_type() == ExpressionType.LINEAR
|
|
52
|
-
assert problem.inequality_constraint_type() == ExpressionType.LINEAR
|
|
53
|
-
|
|
54
|
-
assert problem.solve(diagnostics=True) == ExitStatus.SUCCESS
|
|
55
|
-
|
|
56
|
-
A = np.array([[1.0, dt], [0.0, 1.0]])
|
|
57
|
-
B = np.array([[0.5 * dt * dt], [dt]])
|
|
58
|
-
|
|
59
|
-
# Verify initial state
|
|
60
|
-
assert X.value(0, 0) == pytest.approx(0.0, abs=1e-8)
|
|
61
|
-
assert X.value(1, 0) == pytest.approx(0.0, abs=1e-8)
|
|
62
|
-
|
|
63
|
-
# Verify solution
|
|
64
|
-
x = np.zeros((2, 1))
|
|
65
|
-
u = np.zeros((1, 1))
|
|
66
|
-
for k in range(N):
|
|
67
|
-
# Verify state
|
|
68
|
-
assert X.value(0, k) == pytest.approx(x[0, 0], abs=1e-2)
|
|
69
|
-
assert X.value(1, k) == pytest.approx(x[1, 0], abs=1e-2)
|
|
70
|
-
|
|
71
|
-
# Determine expected input for this timestep
|
|
72
|
-
if k * dt < 1.0:
|
|
73
|
-
# Accelerate
|
|
74
|
-
u[0, 0] = 1.0
|
|
75
|
-
elif k * dt < 2.05:
|
|
76
|
-
# Maintain speed
|
|
77
|
-
u[0, 0] = 0.0
|
|
78
|
-
elif k * dt < 3.275:
|
|
79
|
-
# Decelerate
|
|
80
|
-
u[0, 0] = -1.0
|
|
81
|
-
else:
|
|
82
|
-
# Accelerate
|
|
83
|
-
u[0, 0] = 1.0
|
|
84
|
-
|
|
85
|
-
# Verify input
|
|
86
|
-
if (
|
|
87
|
-
k > 0
|
|
88
|
-
and k < N - 1
|
|
89
|
-
and abs(U.value(0, k - 1) - U.value(0, k + 1)) >= 1.0 - 1e-2
|
|
90
|
-
):
|
|
91
|
-
# If control input is transitioning between -1, 0, or 1, ensure it's
|
|
92
|
-
# within (-1, 1)
|
|
93
|
-
assert U.value(0, k) >= -1.0
|
|
94
|
-
assert U.value(0, k) <= 1.0
|
|
95
|
-
else:
|
|
96
|
-
assert U.value(0, k) == pytest.approx(u[0, 0], abs=1e-4)
|
|
97
|
-
|
|
98
|
-
# Project state forward
|
|
99
|
-
x = A @ x + B @ u
|
|
100
|
-
|
|
101
|
-
# Verify final state
|
|
102
|
-
assert X.value(0, N) == pytest.approx(r, abs=1e-8)
|
|
103
|
-
assert X.value(1, N) == pytest.approx(0.0, abs=1e-8)
|
|
104
|
-
|
|
105
|
-
# Log states for offline viewing
|
|
106
|
-
with open("Double integrator states.csv", "w") as f:
|
|
107
|
-
f.write("Time (s),Position (m),Velocity (rad/s)\n")
|
|
108
|
-
|
|
109
|
-
for k in range(N + 1):
|
|
110
|
-
f.write(f"{k * dt},{X.value(0, k)},{X.value(1, k)}\n")
|
|
111
|
-
|
|
112
|
-
# Log inputs for offline viewing
|
|
113
|
-
with open("Double integrator inputs.csv", "w") as f:
|
|
114
|
-
f.write("Time (s),Acceleration (m/s²)\n")
|
|
115
|
-
|
|
116
|
-
for k in range(N + 1):
|
|
117
|
-
if k < N:
|
|
118
|
-
f.write(f"{k * dt},{U.value(0, k)}\n")
|
|
119
|
-
else:
|
|
120
|
-
f.write(f"{k * dt},0.0\n")
|
{sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/CMakeLists.txt
RENAMED
|
File without changes
|
{sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/LICENSE.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/pyproject.toml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sleipnirgroup_jormungandr-0.6.7.dev113 → sleipnirgroup_jormungandr-0.6.7.dev114}/src/util/pool.cpp
RENAMED
|
File without changes
|