sleipnirgroup-jormungandr 0.6.7.dev123__tar.gz → 0.6.7.dev125__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.
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/CMakeLists.txt +40 -41
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/PKG-INFO +1 -1
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/ipm.hpp +3 -1
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/options.hpp +7 -1
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/dense_kkt_solver.hpp +53 -15
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/filter.hpp +8 -2
- sleipnirgroup_jormungandr-0.6.7.dev125/include/sleipnir/optimization/solver/util/regularization_limits.hpp +93 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/sparse_kkt_solver.hpp +23 -11
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/pyproject.toml +1 -1
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/docstrings.hpp +4 -1
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/src/sleipnir/__init__.py +1 -1
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/autodiff/hessian_test.py +16 -6
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/cart_pole_ocp_test.py +14 -9
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/cart_pole_problem_test.py +24 -9
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/differential_drive_ocp_test.py +14 -11
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/differential_drive_problem_test.py +23 -22
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/double_integrator_problem_test.py +7 -6
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/flywheel_ocp_test.py +20 -13
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/flywheel_problem_test.py +3 -2
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/linear_problem_test.py +5 -4
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/multistart_test.py +3 -2
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/nonlinear_problem_test.py +50 -18
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/problem_spy_test.py +3 -2
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/quadratic_problem_test.py +12 -11
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/solver/exit_status_test.py +32 -6
- sleipnirgroup_jormungandr-0.6.7.dev125/python/test/optimization/tolerance.py +81 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/LICENSE.txt +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/README.md +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/SleipnirConfig.cmake.in +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/BuildTypes.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/CompilerFlags.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/Pybind11Mkdoc.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/Pybind11MkdocPostprocess.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/SubdirList.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/aarch64-linux-gnu.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/arm-none-eabi.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/expression.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/expression_functions.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/expression_graph.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/expression_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/gradient.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/hessian.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/jacobian.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/sleipnir_base.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/slice.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/variable.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/variable_block.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/variable_matrix.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/multistart.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/ocp/dynamics_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/ocp/timestep_method.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/ocp/transcription_method.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/ocp.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/problem.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/exit_status.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/ipm_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/iteration_info.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/newton.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/newton_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/sqp.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/sqp_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/all_finite.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/append_as_triplets.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/bounds.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/constraint_violation.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/feasibility_restoration.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/feasibility_restoration_cycle_detector.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/fraction_to_the_boundary_rule.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/inertia.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/kkt_error.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/kkt_ordering.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/kkt_solver.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/problem_scaling.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/sparse_inf_norms.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/time_trace.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/assert.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/concepts.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/empty.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/force_inline.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/function_ref.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/intrusive_shared_ptr.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/pool.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/print.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/print_diagnostics.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/scope_exit.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/spy.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/symbol_exports.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/time_tracer.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/arity.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_expression_type.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_gradient.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_hessian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_jacobian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_variable.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_variable_block.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_variable_matrix.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/binders.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/for_each_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/main.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/bind_equality_constraints.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/bind_inequality_constraints.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/bind_ocp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/bind_problem.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/ocp/bind_dynamics_type.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/ocp/bind_timestep_method.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/ocp/bind_transcription_method.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/solver/bind_exit_status.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/solver/bind_iteration_info.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/slice_tuple.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/text_wrap.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/try_cast.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/postprocess_stubs.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/src/sleipnir/autodiff/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/src/sleipnir/optimization/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/autodiff/gradient_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/autodiff/jacobian_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/autodiff/variable_matrix_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/autodiff/variable_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/arm_on_elevator_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/cart_pole_util.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/constraints_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/decision_variable_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/differential_drive_util.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/flywheel_util.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/rk4.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/trivial_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/autodiff/gradient.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/autodiff/hessian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/autodiff/jacobian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/autodiff/variable_matrix.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/optimization/ocp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/optimization/problem.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/optimization/solver/ipm.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/optimization/solver/newton.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/optimization/solver/sqp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/util/pool.cpp +0 -0
{sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/CMakeLists.txt
RENAMED
|
@@ -57,7 +57,7 @@ option(
|
|
|
57
57
|
set(SLEIPNIR_TEST_SCALAR_TYPES
|
|
58
58
|
"double"
|
|
59
59
|
CACHE STRING
|
|
60
|
-
"Semicolon-separated list of scalar types to test (double, ExplicitDouble)"
|
|
60
|
+
"Semicolon-separated list of scalar types to test (float, double, ExplicitDouble)"
|
|
61
61
|
)
|
|
62
62
|
|
|
63
63
|
# Options for using a package manager (e.g., vcpkg) for certain dependencies
|
|
@@ -246,7 +246,7 @@ if(PROJECT_IS_TOP_LEVEL AND BUILD_TESTING)
|
|
|
246
246
|
list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/extras)
|
|
247
247
|
include(Catch)
|
|
248
248
|
|
|
249
|
-
set(sleipnir_allowed_test_scalar_types double ExplicitDouble)
|
|
249
|
+
set(sleipnir_allowed_test_scalar_types float double ExplicitDouble)
|
|
250
250
|
foreach(type IN LISTS SLEIPNIR_TEST_SCALAR_TYPES)
|
|
251
251
|
if(NOT type IN_LIST sleipnir_allowed_test_scalar_types)
|
|
252
252
|
message(
|
|
@@ -260,43 +260,42 @@ if(PROJECT_IS_TOP_LEVEL AND BUILD_TESTING)
|
|
|
260
260
|
endif()
|
|
261
261
|
list(JOIN SLEIPNIR_TEST_SCALAR_TYPES "," sleipnir_test_scalar_types)
|
|
262
262
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
263
|
+
# Build explicit template instantiations for each tested scalar type other
|
|
264
|
+
# than double (Sleipnir itself instantiates double). The instantiations for
|
|
265
|
+
# <type> are in test/src/<module>/*_<suffix>.cpp.
|
|
266
|
+
set(sleipnir_explicit_test_scalar_types float ExplicitDouble)
|
|
267
|
+
set(sleipnir_explicit_test_scalar_suffixes float explicit_double)
|
|
268
|
+
set(sleipnir_autodiff_explicit_targets)
|
|
269
|
+
set(sleipnir_optimization_explicit_targets)
|
|
270
|
+
foreach(
|
|
271
|
+
type
|
|
272
|
+
suffix
|
|
273
|
+
IN
|
|
274
|
+
ZIP_LISTS
|
|
275
|
+
sleipnir_explicit_test_scalar_types
|
|
276
|
+
sleipnir_explicit_test_scalar_suffixes
|
|
277
|
+
)
|
|
278
|
+
if(NOT type IN_LIST SLEIPNIR_TEST_SCALAR_TYPES)
|
|
279
|
+
continue()
|
|
280
|
+
endif()
|
|
281
281
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
)
|
|
298
|
-
|
|
299
|
-
endif()
|
|
282
|
+
foreach(module autodiff optimization)
|
|
283
|
+
file(
|
|
284
|
+
GLOB_RECURSE src
|
|
285
|
+
CONFIGURE_DEPENDS
|
|
286
|
+
test/src/${module}/*_${suffix}.cpp
|
|
287
|
+
)
|
|
288
|
+
set(target sleipnir_${module}_${suffix})
|
|
289
|
+
add_library(${target} OBJECT ${src})
|
|
290
|
+
compiler_flags(${target})
|
|
291
|
+
target_include_directories(
|
|
292
|
+
${target}
|
|
293
|
+
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test/include
|
|
294
|
+
)
|
|
295
|
+
target_link_libraries(${target} PUBLIC Sleipnir)
|
|
296
|
+
list(APPEND sleipnir_${module}_explicit_targets ${target})
|
|
297
|
+
endforeach()
|
|
298
|
+
endforeach()
|
|
300
299
|
|
|
301
300
|
# Adds a Catch2 test executable named <name> built from the source list
|
|
302
301
|
# <src>. Any further arguments are linked as extra libraries.
|
|
@@ -329,7 +328,7 @@ if(PROJECT_IS_TOP_LEVEL AND BUILD_TESTING)
|
|
|
329
328
|
sleipnir_add_test(
|
|
330
329
|
sleipnir_autodiff_test
|
|
331
330
|
"${sleipnir_autodiff_test_src}"
|
|
332
|
-
|
|
331
|
+
${sleipnir_autodiff_explicit_targets}
|
|
333
332
|
)
|
|
334
333
|
|
|
335
334
|
# Build Sleipnir optimization tests
|
|
@@ -349,8 +348,8 @@ if(PROJECT_IS_TOP_LEVEL AND BUILD_TESTING)
|
|
|
349
348
|
sleipnir_add_test(
|
|
350
349
|
sleipnir_optimization_test
|
|
351
350
|
"${sleipnir_optimization_test_src}"
|
|
352
|
-
|
|
353
|
-
|
|
351
|
+
${sleipnir_autodiff_explicit_targets}
|
|
352
|
+
${sleipnir_optimization_explicit_targets}
|
|
354
353
|
)
|
|
355
354
|
|
|
356
355
|
# Build Sleipnir util tests
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
#include "sleipnir/optimization/solver/util/fraction_to_the_boundary_rule.hpp"
|
|
28
28
|
#include "sleipnir/optimization/solver/util/kkt_error.hpp"
|
|
29
29
|
#include "sleipnir/optimization/solver/util/kkt_solver.hpp"
|
|
30
|
+
#include "sleipnir/optimization/solver/util/regularization_limits.hpp"
|
|
30
31
|
#include "sleipnir/optimization/solver/util/time_trace.hpp"
|
|
31
32
|
#include "sleipnir/util/assert.hpp"
|
|
32
33
|
#include "sleipnir/util/print_diagnostics.hpp"
|
|
@@ -350,7 +351,8 @@ ExitStatus ipm(const IPMMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
350
351
|
matrices.num_decision_variables, matrices.num_equality_constraints,
|
|
351
352
|
// Constraint regularization is forced to zero in feasibility restoration
|
|
352
353
|
// because the equality constraint Jacobian cannot be rank-deficient
|
|
353
|
-
in_feasibility_restoration ? Scalar(0)
|
|
354
|
+
in_feasibility_restoration ? Scalar(0)
|
|
355
|
+
: min_constraint_regularization<Scalar>()};
|
|
354
356
|
|
|
355
357
|
// Step size reduction factor
|
|
356
358
|
constexpr Scalar α_reduction_factor(0.5);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
#pragma once
|
|
4
4
|
|
|
5
5
|
#include <chrono>
|
|
6
|
+
#include <cmath>
|
|
6
7
|
#include <limits>
|
|
7
8
|
|
|
8
9
|
namespace slp {
|
|
@@ -13,7 +14,12 @@ namespace slp {
|
|
|
13
14
|
template <typename Scalar>
|
|
14
15
|
struct Options {
|
|
15
16
|
/// The solver will stop once the error is below this tolerance.
|
|
16
|
-
|
|
17
|
+
///
|
|
18
|
+
/// Defaults to the square root of the scalar type's machine epsilon.
|
|
19
|
+
Scalar tolerance = [] {
|
|
20
|
+
using std::sqrt;
|
|
21
|
+
return sqrt(std::numeric_limits<Scalar>::epsilon());
|
|
22
|
+
}();
|
|
17
23
|
|
|
18
24
|
/// The maximum number of solver iterations before returning a solution.
|
|
19
25
|
int max_iterations = 5000;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
#include <Eigen/Core>
|
|
11
11
|
|
|
12
12
|
#include "sleipnir/optimization/solver/util/inertia.hpp"
|
|
13
|
+
#include "sleipnir/optimization/solver/util/regularization_limits.hpp"
|
|
13
14
|
|
|
14
15
|
namespace slp {
|
|
15
16
|
|
|
@@ -73,14 +74,14 @@ class DenseKKTSolver {
|
|
|
73
74
|
// γ regularize the Hessian and equality constraint Jacobian respectively.
|
|
74
75
|
|
|
75
76
|
// The minimum nonzero Hessian regularization
|
|
76
|
-
|
|
77
|
+
const Scalar δ_min = min_hessian_regularization<Scalar>();
|
|
77
78
|
|
|
78
79
|
// The maximum constraint regularization. Larger values distort the equality
|
|
79
80
|
// constraint Jacobian more than they help a rank-deficient one.
|
|
80
|
-
|
|
81
|
+
const Scalar γ_max = max_constraint_regularization<Scalar>();
|
|
81
82
|
|
|
82
83
|
// The initial nonzero constraint regularization
|
|
83
|
-
|
|
84
|
+
const Scalar γ_initial = min_constraint_regularization<Scalar>();
|
|
84
85
|
|
|
85
86
|
// If the previous δ was zero, attempt a small value. Otherwise, attempt a
|
|
86
87
|
// smaller value than the previous δ so δ trends downward. δ has a floor
|
|
@@ -88,7 +89,7 @@ class DenseKKTSolver {
|
|
|
88
89
|
// directions, so the KKT matrix's smallest eigenvalues shrink with δ. Too
|
|
89
90
|
// small a δ makes the matrix ill-conditioned, which amplifies the
|
|
90
91
|
// factorization's rounding error in the solution, and eventually puts those
|
|
91
|
-
// eigenvalues
|
|
92
|
+
// eigenvalues near zero, where the inertia check counts them as
|
|
92
93
|
// zero.
|
|
93
94
|
Scalar δ = m_prev_δ == Scalar(0) ? Scalar(1e-4)
|
|
94
95
|
: std::max(m_prev_δ / Scalar(2), δ_min);
|
|
@@ -161,15 +162,24 @@ class DenseKKTSolver {
|
|
|
161
162
|
/// @return The solution.
|
|
162
163
|
template <typename Rhs>
|
|
163
164
|
DenseVector solve(const Eigen::MatrixBase<Rhs>& rhs) const {
|
|
165
|
+
using std::pow;
|
|
166
|
+
|
|
164
167
|
DenseVector x = m_solver.solve(rhs);
|
|
165
168
|
|
|
166
169
|
// The factorization is backward stable, but the matrix's conditioning
|
|
167
170
|
// amplifies its rounding error in the solution, so apply iterative
|
|
168
171
|
// refinement with the same factorization
|
|
169
172
|
constexpr int max_refinement_steps = 3;
|
|
173
|
+
|
|
174
|
+
// Stop once the relative residual is ε^(3/4), which is halfway (on a log
|
|
175
|
+
// scale) between the solver's default tolerance of √ε and the
|
|
176
|
+
// factorization's rounding error floor of a small multiple of ε
|
|
177
|
+
const Scalar refinement_tolerance =
|
|
178
|
+
pow(std::numeric_limits<Scalar>::epsilon(), Scalar(0.75));
|
|
179
|
+
|
|
170
180
|
for (int i = 0; i < max_refinement_steps; ++i) {
|
|
171
181
|
DenseVector r = rhs - m_lhs.template selfadjointView<Eigen::Lower>() * x;
|
|
172
|
-
if (r.norm() <=
|
|
182
|
+
if (r.norm() <= refinement_tolerance * rhs.norm()) {
|
|
173
183
|
break;
|
|
174
184
|
}
|
|
175
185
|
x += m_solver.solve(r);
|
|
@@ -214,7 +224,7 @@ class DenseKKTSolver {
|
|
|
214
224
|
int m_num_equality_constraints = 0;
|
|
215
225
|
|
|
216
226
|
/// The minimum constraint regularization.
|
|
217
|
-
Scalar m_γ_min
|
|
227
|
+
Scalar m_γ_min = min_constraint_regularization<Scalar>();
|
|
218
228
|
|
|
219
229
|
/// The ideal system inertia.
|
|
220
230
|
Inertia ideal_inertia{m_num_decision_variables, m_num_equality_constraints,
|
|
@@ -230,24 +240,24 @@ class DenseKKTSolver {
|
|
|
230
240
|
///
|
|
231
241
|
/// D from the Bunch-Kaufman factorization has 1x1 and 2x2 diagonal blocks.
|
|
232
242
|
/// By Sylvester's law of inertia, the KKT matrix's inertia is the inertia of
|
|
233
|
-
/// D, which is the inertia of the blocks' eigenvalues. Eigenvalues within
|
|
234
|
-
/// of zero are counted as zero.
|
|
243
|
+
/// D, which is the inertia of the blocks's eigenvalues. Eigenvalues within
|
|
244
|
+
/// zero_pivot_threshold() of zero are counted as zero.
|
|
235
245
|
///
|
|
236
246
|
/// @return The inertia of the most recently factorized KKT matrix.
|
|
237
247
|
Inertia inertia() const {
|
|
238
248
|
using std::abs;
|
|
239
249
|
using std::hypot;
|
|
240
250
|
|
|
241
|
-
|
|
251
|
+
const Scalar threshold = zero_pivot_threshold<Scalar>();
|
|
242
252
|
|
|
243
253
|
const auto D = m_solver.vectorD();
|
|
244
254
|
const auto& D_sub = m_solver.subDiagonal();
|
|
245
255
|
|
|
246
256
|
Inertia inertia;
|
|
247
257
|
auto count = [&](Scalar λ) {
|
|
248
|
-
if (λ >
|
|
258
|
+
if (λ > threshold) {
|
|
249
259
|
++inertia.positive;
|
|
250
|
-
} else if (λ <
|
|
260
|
+
} else if (λ < -threshold) {
|
|
251
261
|
++inertia.negative;
|
|
252
262
|
} else {
|
|
253
263
|
++inertia.zero;
|
|
@@ -256,15 +266,43 @@ class DenseKKTSolver {
|
|
|
256
266
|
|
|
257
267
|
for (int k = 0; k < D.size(); ++k) {
|
|
258
268
|
if (k + 1 < D.size() && D_sub[k] != Scalar(0)) {
|
|
259
|
-
// The 2x2 block [a b; b c]
|
|
260
|
-
//
|
|
269
|
+
// The eigenvalues of the 2x2 block [a b; b c] are the roots of its
|
|
270
|
+
// characteristic polynomial.
|
|
271
|
+
//
|
|
272
|
+
// det([a − λ b; b c − λ]) = (a − λ)(c − λ) − b²
|
|
273
|
+
// = ac − aλ − cλ + λ² − b²
|
|
274
|
+
// = λ² − (a + c)λ + (ac − b²)
|
|
275
|
+
//
|
|
276
|
+
// λ = (a + c)/2 ± r where r = √(((a − c)/2)² + b²)
|
|
277
|
+
//
|
|
278
|
+
// Let λ₁ be the root farther from zero. Its two terms have the same
|
|
279
|
+
// sign, so it has no cancellation. The two terms of the other root λ₂
|
|
280
|
+
// have opposite signs, so λ₂ loses accuracy if |a| >> |c|. Instead,
|
|
281
|
+
// compute λ₂ from λ₁ and the product of the roots.
|
|
282
|
+
//
|
|
283
|
+
// λ₁λ₂ = ((a + c)/2 + r)((a + c)/2 − r)
|
|
284
|
+
// λ₁λ₂ = ((a + c)/2)² − r²
|
|
285
|
+
// λ₁λ₂ = ((a + c)/2)² − (((a − c)/2)² + b²)
|
|
286
|
+
// λ₁λ₂ = (a + c)²/4 − (a − c)²/4 − b²
|
|
287
|
+
// λ₁λ₂ = ((a² + 2ac + c²) − (a² − 2ac + c²))/4 − b²
|
|
288
|
+
// λ₁λ₂ = 4ac/4 − b²
|
|
289
|
+
// λ₁λ₂ = ac − b²
|
|
290
|
+
// λ₂ = (ac − b²)/λ₁
|
|
291
|
+
// λ₂ = ac/λ₁ − b²/λ₁
|
|
292
|
+
// λ₂ = (a/λ₁)c − (b/λ₁)b
|
|
293
|
+
//
|
|
294
|
+
// Dividing first prevents ac and b² from overflowing. |λ₁| is the
|
|
295
|
+
// block's spectral radius (its largest eigenvalue magnitude), which for
|
|
296
|
+
// a symmetric matrix is the most it can stretch a unit vector. The
|
|
297
|
+
// block maps [1, 0]ᵀ to [a, b]ᵀ, so |a| ≤ |λ₁| and |b| ≤ |λ₁|.
|
|
261
298
|
const Scalar a = D[k];
|
|
262
299
|
const Scalar b = D_sub[k];
|
|
263
300
|
const Scalar c = D[k + 1];
|
|
264
301
|
const Scalar mid = (a + c) / Scalar(2);
|
|
265
302
|
const Scalar r = hypot((a - c) / Scalar(2), abs(b));
|
|
266
|
-
|
|
267
|
-
count(
|
|
303
|
+
const Scalar λ = mid >= Scalar(0) ? mid + r : mid - r;
|
|
304
|
+
count(λ);
|
|
305
|
+
count((a / λ) * c - (b / λ) * b);
|
|
268
306
|
++k;
|
|
269
307
|
} else {
|
|
270
308
|
count(D[k]);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
#include <algorithm>
|
|
6
6
|
#include <cmath>
|
|
7
|
+
#include <limits>
|
|
7
8
|
|
|
8
9
|
#include <Eigen/Core>
|
|
9
10
|
#include <gch/small_vector.hpp>
|
|
@@ -140,6 +141,7 @@ class Filter {
|
|
|
140
141
|
const FilterEntry<Scalar>& trial_entry, Scalar D_ϕ, Scalar α) {
|
|
141
142
|
using std::isfinite;
|
|
142
143
|
using std::pow;
|
|
144
|
+
using std::sqrt;
|
|
143
145
|
|
|
144
146
|
// Reject steps with nonfinite cost or constraint violation above maximum
|
|
145
147
|
if (!isfinite(trial_entry.cost) ||
|
|
@@ -153,7 +155,7 @@ class Filter {
|
|
|
153
155
|
α * pow(-D_ϕ, s_ϕ) > pow(current_entry.constraint_violation, s_θ);
|
|
154
156
|
|
|
155
157
|
// Armijo condition
|
|
156
|
-
|
|
158
|
+
const Scalar η_ϕ = sqrt(std::numeric_limits<Scalar>::epsilon());
|
|
157
159
|
bool armijo_condition =
|
|
158
160
|
trial_entry.cost <= current_entry.cost + η_ϕ * α * D_ϕ;
|
|
159
161
|
|
|
@@ -261,7 +263,11 @@ class Filter {
|
|
|
261
263
|
}
|
|
262
264
|
|
|
263
265
|
private:
|
|
264
|
-
static
|
|
266
|
+
static inline const Scalar γ_cost = [] {
|
|
267
|
+
using std::sqrt;
|
|
268
|
+
return sqrt(std::numeric_limits<Scalar>::epsilon());
|
|
269
|
+
}();
|
|
270
|
+
|
|
265
271
|
static constexpr Scalar γ_constraint{1e-5};
|
|
266
272
|
|
|
267
273
|
// Switching condition exponents
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Copyright (c) Sleipnir contributors
|
|
2
|
+
|
|
3
|
+
#pragma once
|
|
4
|
+
|
|
5
|
+
#include <algorithm>
|
|
6
|
+
#include <cmath>
|
|
7
|
+
#include <limits>
|
|
8
|
+
|
|
9
|
+
namespace slp {
|
|
10
|
+
|
|
11
|
+
/// Returns the minimum nonzero Hessian regularization.
|
|
12
|
+
///
|
|
13
|
+
/// @tparam Scalar Scalar type.
|
|
14
|
+
/// @return The minimum nonzero Hessian regularization.
|
|
15
|
+
template <typename Scalar>
|
|
16
|
+
Scalar min_hessian_regularization() {
|
|
17
|
+
using std::sqrt;
|
|
18
|
+
|
|
19
|
+
// This value keeps regularized pivots well above the inertia's zero-pivot
|
|
20
|
+
// threshold
|
|
21
|
+
return sqrt(std::numeric_limits<Scalar>::epsilon()) / Scalar(100);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/// Returns the minimum nonzero equality constraint Jacobian regularization.
|
|
25
|
+
///
|
|
26
|
+
/// @tparam Scalar Scalar type.
|
|
27
|
+
/// @return The minimum nonzero equality constraint Jacobian regularization.
|
|
28
|
+
template <typename Scalar>
|
|
29
|
+
Scalar min_constraint_regularization() {
|
|
30
|
+
using std::sqrt;
|
|
31
|
+
|
|
32
|
+
// γ is bounded on both sides:
|
|
33
|
+
//
|
|
34
|
+
// * From below by rounding. A dual pivot is −γ − aᵀD⁻¹a, where a is the
|
|
35
|
+
// constraint's row of the Jacobian, so γ smaller than the rounding error
|
|
36
|
+
// in aᵀD⁻¹a has no effect. Below about 100ε in double, nearly dependent
|
|
37
|
+
// constraints produce exact zero pivots.
|
|
38
|
+
// * From above by the distortion of the equality constraint Jacobian,
|
|
39
|
+
// which degrades steps once γ is around 1e-7 to 1e-6 regardless of
|
|
40
|
+
// Scalar.
|
|
41
|
+
//
|
|
42
|
+
// The upper bound doesn't scale with ε, so the window is narrow for float
|
|
43
|
+
// (about 0.25ε to 2.5ε) and wide for double (about 100ε to 1e-8). This value
|
|
44
|
+
// falls inside both windows.
|
|
45
|
+
return sqrt(std::numeric_limits<Scalar>::epsilon()) / Scalar(3000);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/// Returns the largest LDLT pivot magnitude the KKT matrix inertia counts as
|
|
49
|
+
/// zero.
|
|
50
|
+
///
|
|
51
|
+
/// @tparam Scalar Scalar type.
|
|
52
|
+
/// @return The largest LDLT pivot magnitude the KKT matrix inertia counts as
|
|
53
|
+
/// zero.
|
|
54
|
+
template <typename Scalar>
|
|
55
|
+
Scalar zero_pivot_threshold() {
|
|
56
|
+
using std::min;
|
|
57
|
+
|
|
58
|
+
// The threshold must be below the regularized pivots, or the regularization
|
|
59
|
+
// can never fix the inertia. For float, ε exceeds the minimum constraint
|
|
60
|
+
// regularization.
|
|
61
|
+
return min(std::numeric_limits<Scalar>::epsilon(),
|
|
62
|
+
min_constraint_regularization<Scalar>() / Scalar(100));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/// Returns the maximum equality constraint Jacobian regularization.
|
|
66
|
+
///
|
|
67
|
+
/// @tparam Scalar Scalar type.
|
|
68
|
+
/// @return The maximum equality constraint Jacobian regularization.
|
|
69
|
+
template <typename Scalar>
|
|
70
|
+
Scalar max_constraint_regularization() {
|
|
71
|
+
using std::sqrt;
|
|
72
|
+
|
|
73
|
+
// Larger values than this distort the equality constraint Jacobian more than
|
|
74
|
+
// they help a rank-deficient one
|
|
75
|
+
return sqrt(std::numeric_limits<Scalar>::epsilon());
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/// Returns the smallest LDLT pivot magnitude allowed without regularization.
|
|
79
|
+
///
|
|
80
|
+
/// @tparam Scalar Scalar type.
|
|
81
|
+
/// @return The smallest LDLT pivot magnitude allowed without regularization.
|
|
82
|
+
template <typename Scalar>
|
|
83
|
+
Scalar min_unregularized_pivot() {
|
|
84
|
+
using std::pow;
|
|
85
|
+
|
|
86
|
+
// In a well-scaled matrix, a pivot D magnifies the factorization's rounding
|
|
87
|
+
// error by roughly 1/|D|. Pivots of at least ε^(1/4) keep that error within
|
|
88
|
+
// the KKT solver's iterative refinement tolerance of ε^(3/4), so the
|
|
89
|
+
// unregularized factorization is accurate enough without regularization.
|
|
90
|
+
return pow(std::numeric_limits<Scalar>::epsilon(), Scalar(0.25));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
} // namespace slp
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
#include "sleipnir/optimization/solver/util/inertia.hpp"
|
|
13
13
|
#include "sleipnir/optimization/solver/util/kkt_ordering.hpp"
|
|
14
|
+
#include "sleipnir/optimization/solver/util/regularization_limits.hpp"
|
|
14
15
|
|
|
15
16
|
namespace slp {
|
|
16
17
|
|
|
@@ -84,7 +85,9 @@ class SparseKKTSolver {
|
|
|
84
85
|
// If the inertia is ideal and D from LDLT is sufficiently far from
|
|
85
86
|
// zero, don't regularize the system
|
|
86
87
|
if (inertia() == ideal_inertia &&
|
|
87
|
-
(m_solver.vectorD().cwiseAbs().array() >=
|
|
88
|
+
(m_solver.vectorD().cwiseAbs().array() >=
|
|
89
|
+
min_unregularized_pivot<Scalar>())
|
|
90
|
+
.all()) {
|
|
88
91
|
m_prev_δ = Scalar(0);
|
|
89
92
|
m_prev_γ = Scalar(0);
|
|
90
93
|
return *this;
|
|
@@ -96,14 +99,14 @@ class SparseKKTSolver {
|
|
|
96
99
|
// γ regularize the Hessian and equality constraint Jacobian respectively.
|
|
97
100
|
|
|
98
101
|
// The minimum nonzero Hessian regularization
|
|
99
|
-
|
|
102
|
+
const Scalar δ_min = min_hessian_regularization<Scalar>();
|
|
100
103
|
|
|
101
104
|
// The maximum constraint regularization. Larger values distort the equality
|
|
102
105
|
// constraint Jacobian more than they help a rank-deficient one.
|
|
103
|
-
|
|
106
|
+
const Scalar γ_max = max_constraint_regularization<Scalar>();
|
|
104
107
|
|
|
105
108
|
// The initial nonzero constraint regularization
|
|
106
|
-
|
|
109
|
+
const Scalar γ_initial = min_constraint_regularization<Scalar>();
|
|
107
110
|
|
|
108
111
|
// If the previous δ was zero, attempt a small value. Otherwise, attempt a
|
|
109
112
|
// smaller value than the previous δ so δ trends downward. δ has a floor
|
|
@@ -184,6 +187,8 @@ class SparseKKTSolver {
|
|
|
184
187
|
/// @return The solution.
|
|
185
188
|
template <typename Rhs>
|
|
186
189
|
DenseVector solve(const Eigen::MatrixBase<Rhs>& rhs) const {
|
|
190
|
+
using std::pow;
|
|
191
|
+
|
|
187
192
|
DenseVector x = m_ordering.inverse_permutation() *
|
|
188
193
|
m_solver.solve(m_ordering.permutation() * rhs);
|
|
189
194
|
|
|
@@ -191,9 +196,16 @@ class SparseKKTSolver {
|
|
|
191
196
|
// (e.g., from small Hessian pivots in rows with no curvature), so apply
|
|
192
197
|
// iterative refinement with the same factorization
|
|
193
198
|
constexpr int max_refinement_steps = 3;
|
|
199
|
+
|
|
200
|
+
// Stop once the relative residual is ε^(3/4), which is halfway (on a log
|
|
201
|
+
// scale) between the solver's default tolerance of √ε and the
|
|
202
|
+
// factorization's rounding error floor of a small multiple of ε
|
|
203
|
+
const Scalar refinement_tolerance =
|
|
204
|
+
pow(std::numeric_limits<Scalar>::epsilon(), Scalar(0.75));
|
|
205
|
+
|
|
194
206
|
for (int i = 0; i < max_refinement_steps; ++i) {
|
|
195
207
|
DenseVector r = rhs - m_lhs.template selfadjointView<Eigen::Lower>() * x;
|
|
196
|
-
if (r.norm() <=
|
|
208
|
+
if (r.norm() <= refinement_tolerance * rhs.norm()) {
|
|
197
209
|
break;
|
|
198
210
|
}
|
|
199
211
|
x += m_ordering.inverse_permutation() *
|
|
@@ -246,7 +258,7 @@ class SparseKKTSolver {
|
|
|
246
258
|
int m_num_equality_constraints = 0;
|
|
247
259
|
|
|
248
260
|
/// The minimum constraint regularization.
|
|
249
|
-
Scalar m_γ_min
|
|
261
|
+
Scalar m_γ_min = min_constraint_regularization<Scalar>();
|
|
250
262
|
|
|
251
263
|
/// The ideal system inertia.
|
|
252
264
|
Inertia ideal_inertia{m_num_decision_variables, m_num_equality_constraints,
|
|
@@ -261,18 +273,18 @@ class SparseKKTSolver {
|
|
|
261
273
|
/// Returns the inertia of the most recently factorized KKT matrix.
|
|
262
274
|
///
|
|
263
275
|
/// By Sylvester's law of inertia, the KKT matrix's inertia is the inertia of
|
|
264
|
-
/// D from its LDLT factorization. Pivots within
|
|
265
|
-
/// zero.
|
|
276
|
+
/// D from its LDLT factorization. Pivots within zero_pivot_threshold() of
|
|
277
|
+
/// zero are counted as zero.
|
|
266
278
|
///
|
|
267
279
|
/// @return The inertia of the most recently factorized KKT matrix.
|
|
268
280
|
Inertia inertia() const {
|
|
269
|
-
|
|
281
|
+
const Scalar threshold = zero_pivot_threshold<Scalar>();
|
|
270
282
|
|
|
271
283
|
Inertia inertia;
|
|
272
284
|
for (const auto& d : m_solver.vectorD()) {
|
|
273
|
-
if (d >
|
|
285
|
+
if (d > threshold) {
|
|
274
286
|
++inertia.positive;
|
|
275
|
-
} else if (d <
|
|
287
|
+
} else if (d < -threshold) {
|
|
276
288
|
++inertia.negative;
|
|
277
289
|
} else {
|
|
278
290
|
++inertia.zero;
|
{sleipnirgroup_jormungandr-0.6.7.dev123 → sleipnirgroup_jormungandr-0.6.7.dev125}/pyproject.toml
RENAMED
|
@@ -79,7 +79,7 @@ mypy_path = ["examples/current_manager", "python/test/optimization"]
|
|
|
79
79
|
|
|
80
80
|
[tool.pytest.ini_options]
|
|
81
81
|
minversion = "6.0"
|
|
82
|
-
pythonpath = ["examples/current_manager"]
|
|
82
|
+
pythonpath = ["examples/current_manager", "python/test/optimization"]
|
|
83
83
|
testpaths = ["python/test", "examples/current_manager/test"]
|
|
84
84
|
|
|
85
85
|
[tool.uv]
|
|
@@ -746,7 +746,10 @@ constexpr char mkd_doc_slp_Options_max_iterations[] = R"doc(The maximum number o
|
|
|
746
746
|
|
|
747
747
|
constexpr char mkd_doc_slp_Options_timeout[] = R"doc(The maximum elapsed wall clock time before returning a solution.)doc";
|
|
748
748
|
|
|
749
|
-
constexpr char mkd_doc_slp_Options_tolerance[] =
|
|
749
|
+
constexpr char mkd_doc_slp_Options_tolerance[] =
|
|
750
|
+
R"doc(The solver will stop once the error is below this tolerance.
|
|
751
|
+
|
|
752
|
+
Defaults to the square root of the scalar type's machine epsilon.)doc";
|
|
750
753
|
|
|
751
754
|
constexpr char mkd_doc_slp_Problem[] =
|
|
752
755
|
R"doc(This class allows the user to pose a constrained nonlinear
|
|
@@ -615,12 +615,22 @@ def test_edge_pushing_petro_figure_1() -> None:
|
|
|
615
615
|
|
|
616
616
|
# d²y/dx² = [−p₁/x₁² 0 ]
|
|
617
617
|
# [ 0 −p₁/x₂²]
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
)
|
|
622
|
-
|
|
623
|
-
|
|
618
|
+
hessian = Hessian(y, x)
|
|
619
|
+
p = p_1.value()
|
|
620
|
+
x0 = x[0].value()
|
|
621
|
+
x1 = x[1].value()
|
|
622
|
+
u = x0 * x1
|
|
623
|
+
|
|
624
|
+
# The mixed partial is −p₁/u + p₁/u for u = x₁x₂, which cancels to zero, so
|
|
625
|
+
# its rounding error scales with the terms instead of with the result (e.g.,
|
|
626
|
+
# when the compiler contracts the sum into an FMA)
|
|
627
|
+
mixed_margin = 8 * ε * (2 * p / u)
|
|
628
|
+
|
|
629
|
+
for H in [hessian.get().value(), hessian.value().todense()]:
|
|
630
|
+
assert H[0, 0] == pytest.approx(-p / (x0 * x0), rel=8 * ε, abs=0)
|
|
631
|
+
assert H[0, 1] == pytest.approx(0.0, abs=mixed_margin)
|
|
632
|
+
assert H[1, 0] == pytest.approx(0.0, abs=mixed_margin)
|
|
633
|
+
assert H[1, 1] == pytest.approx(-p / (x1 * x1), rel=8 * ε, abs=0)
|
|
624
634
|
|
|
625
635
|
|
|
626
636
|
def test_variable_reuse() -> None:
|
|
@@ -15,6 +15,7 @@ from sleipnir.optimization import (
|
|
|
15
15
|
TranscriptionMethod,
|
|
16
16
|
bounds,
|
|
17
17
|
)
|
|
18
|
+
from tolerance import SolutionType, solution_tolerance
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
def lerp(a: float, b: float, t: float) -> float:
|
|
@@ -80,10 +81,10 @@ def test_cart_pole_ocp() -> None:
|
|
|
80
81
|
assert problem.solve(diagnostics=True) == ExitStatus.SUCCESS
|
|
81
82
|
|
|
82
83
|
# Verify initial state
|
|
83
|
-
assert X.value(0, 0) == pytest.approx(x_initial[0, 0], abs=
|
|
84
|
-
assert X.value(1, 0) == pytest.approx(x_initial[1, 0], abs=
|
|
85
|
-
assert X.value(2, 0) == pytest.approx(x_initial[2, 0], abs=
|
|
86
|
-
assert X.value(3, 0) == pytest.approx(x_initial[3, 0], abs=
|
|
84
|
+
assert X.value(0, 0) == pytest.approx(x_initial[0, 0], abs=solution_tolerance(1))
|
|
85
|
+
assert X.value(1, 0) == pytest.approx(x_initial[1, 0], abs=solution_tolerance(1))
|
|
86
|
+
assert X.value(2, 0) == pytest.approx(x_initial[2, 0], abs=solution_tolerance(1))
|
|
87
|
+
assert X.value(3, 0) == pytest.approx(x_initial[3, 0], abs=solution_tolerance(1))
|
|
87
88
|
|
|
88
89
|
# Verify solution
|
|
89
90
|
for k in range(N):
|
|
@@ -115,13 +116,17 @@ def test_cart_pole_ocp() -> None:
|
|
|
115
116
|
|
|
116
117
|
expected_xdot_c = f(x_c, u_c)
|
|
117
118
|
for row in range(xdot_c.shape[0]):
|
|
118
|
-
assert xdot_c[row, 0] == pytest.approx(
|
|
119
|
+
assert xdot_c[row, 0] == pytest.approx(
|
|
120
|
+
expected_xdot_c[row, 0], abs=solution_tolerance(1)
|
|
121
|
+
)
|
|
119
122
|
|
|
120
123
|
# Verify final state
|
|
121
|
-
assert X.value(0, N) == pytest.approx(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
assert X.value(
|
|
124
|
+
assert X.value(0, N) == pytest.approx(
|
|
125
|
+
x_final[0, 0], abs=solution_tolerance(1, SolutionType.DEGENERATE)
|
|
126
|
+
)
|
|
127
|
+
assert X.value(1, N) == pytest.approx(x_final[1, 0], abs=solution_tolerance(1))
|
|
128
|
+
assert X.value(2, N) == pytest.approx(x_final[2, 0], abs=solution_tolerance(1))
|
|
129
|
+
assert X.value(3, N) == pytest.approx(x_final[3, 0], abs=solution_tolerance(1))
|
|
125
130
|
|
|
126
131
|
# Log states for offline viewing
|
|
127
132
|
with open("Cart-pole states.csv", "w") as f:
|