sleipnirgroup-jormungandr 0.6.7.dev124__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.
Files changed (136) hide show
  1. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/CMakeLists.txt +40 -41
  2. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/PKG-INFO +1 -1
  3. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/ipm.hpp +3 -1
  4. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/options.hpp +7 -1
  5. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/dense_kkt_solver.hpp +21 -11
  6. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/filter.hpp +8 -2
  7. sleipnirgroup_jormungandr-0.6.7.dev125/include/sleipnir/optimization/solver/util/regularization_limits.hpp +93 -0
  8. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/sparse_kkt_solver.hpp +23 -11
  9. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/pyproject.toml +1 -1
  10. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/docstrings.hpp +4 -1
  11. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/src/sleipnir/__init__.py +1 -1
  12. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/autodiff/hessian_test.py +16 -6
  13. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/cart_pole_ocp_test.py +14 -9
  14. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/cart_pole_problem_test.py +24 -9
  15. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/differential_drive_ocp_test.py +14 -11
  16. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/differential_drive_problem_test.py +23 -22
  17. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/double_integrator_problem_test.py +7 -6
  18. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/flywheel_ocp_test.py +20 -13
  19. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/flywheel_problem_test.py +3 -2
  20. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/linear_problem_test.py +5 -4
  21. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/multistart_test.py +3 -2
  22. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/nonlinear_problem_test.py +50 -18
  23. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/problem_spy_test.py +3 -2
  24. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/quadratic_problem_test.py +12 -11
  25. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/solver/exit_status_test.py +32 -6
  26. sleipnirgroup_jormungandr-0.6.7.dev125/python/test/optimization/tolerance.py +81 -0
  27. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/LICENSE.txt +0 -0
  28. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/README.md +0 -0
  29. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/SleipnirConfig.cmake.in +0 -0
  30. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/BuildTypes.cmake +0 -0
  31. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/CompilerFlags.cmake +0 -0
  32. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/Pybind11Mkdoc.cmake +0 -0
  33. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/Pybind11MkdocPostprocess.cmake +0 -0
  34. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/SubdirList.cmake +0 -0
  35. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/aarch64-linux-gnu.cmake +0 -0
  36. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/cmake/arm-none-eabi.cmake +0 -0
  37. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/expression.hpp +0 -0
  38. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/expression_functions.hpp +0 -0
  39. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/expression_graph.hpp +0 -0
  40. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/expression_type.hpp +0 -0
  41. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/gradient.hpp +0 -0
  42. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/hessian.hpp +0 -0
  43. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/jacobian.hpp +0 -0
  44. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/sleipnir_base.hpp +0 -0
  45. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/slice.hpp +0 -0
  46. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/variable.hpp +0 -0
  47. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/variable_block.hpp +0 -0
  48. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/autodiff/variable_matrix.hpp +0 -0
  49. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/multistart.hpp +0 -0
  50. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/ocp/dynamics_type.hpp +0 -0
  51. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/ocp/timestep_method.hpp +0 -0
  52. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/ocp/transcription_method.hpp +0 -0
  53. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/ocp.hpp +0 -0
  54. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/problem.hpp +0 -0
  55. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/exit_status.hpp +0 -0
  56. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/ipm_matrix_callbacks.hpp +0 -0
  57. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/iteration_info.hpp +0 -0
  58. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/newton.hpp +0 -0
  59. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/newton_matrix_callbacks.hpp +0 -0
  60. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/sqp.hpp +0 -0
  61. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/sqp_matrix_callbacks.hpp +0 -0
  62. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/all_finite.hpp +0 -0
  63. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/append_as_triplets.hpp +0 -0
  64. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/bounds.hpp +0 -0
  65. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/constraint_violation.hpp +0 -0
  66. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/feasibility_restoration.hpp +0 -0
  67. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/feasibility_restoration_cycle_detector.hpp +0 -0
  68. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/fraction_to_the_boundary_rule.hpp +0 -0
  69. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/inertia.hpp +0 -0
  70. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/kkt_error.hpp +0 -0
  71. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/kkt_ordering.hpp +0 -0
  72. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/kkt_solver.hpp +0 -0
  73. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/problem_scaling.hpp +0 -0
  74. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/sparse_inf_norms.hpp +0 -0
  75. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/optimization/solver/util/time_trace.hpp +0 -0
  76. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/assert.hpp +0 -0
  77. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/concepts.hpp +0 -0
  78. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/empty.hpp +0 -0
  79. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/force_inline.hpp +0 -0
  80. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/function_ref.hpp +0 -0
  81. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/intrusive_shared_ptr.hpp +0 -0
  82. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/pool.hpp +0 -0
  83. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/print.hpp +0 -0
  84. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/print_diagnostics.hpp +0 -0
  85. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/scope_exit.hpp +0 -0
  86. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/spy.hpp +0 -0
  87. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/symbol_exports.hpp +0 -0
  88. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/include/sleipnir/util/time_tracer.hpp +0 -0
  89. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/arity.hpp +0 -0
  90. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_expression_type.cpp +0 -0
  91. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_gradient.cpp +0 -0
  92. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_hessian.cpp +0 -0
  93. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_jacobian.cpp +0 -0
  94. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_variable.cpp +0 -0
  95. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_variable_block.cpp +0 -0
  96. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/autodiff/bind_variable_matrix.cpp +0 -0
  97. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/binders.hpp +0 -0
  98. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/for_each_type.hpp +0 -0
  99. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/main.cpp +0 -0
  100. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/bind_equality_constraints.cpp +0 -0
  101. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/bind_inequality_constraints.cpp +0 -0
  102. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/bind_ocp.cpp +0 -0
  103. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/bind_problem.cpp +0 -0
  104. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/ocp/bind_dynamics_type.cpp +0 -0
  105. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/ocp/bind_timestep_method.cpp +0 -0
  106. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/ocp/bind_transcription_method.cpp +0 -0
  107. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/solver/bind_exit_status.cpp +0 -0
  108. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/optimization/solver/bind_iteration_info.cpp +0 -0
  109. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/slice_tuple.hpp +0 -0
  110. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/text_wrap.hpp +0 -0
  111. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/cpp/try_cast.hpp +0 -0
  112. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/postprocess_stubs.py +0 -0
  113. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/src/sleipnir/autodiff/__init__.py +0 -0
  114. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/src/sleipnir/optimization/__init__.py +0 -0
  115. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/autodiff/gradient_test.py +0 -0
  116. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/autodiff/jacobian_test.py +0 -0
  117. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/autodiff/variable_matrix_test.py +0 -0
  118. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/autodiff/variable_test.py +0 -0
  119. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/arm_on_elevator_problem_test.py +0 -0
  120. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/cart_pole_util.py +0 -0
  121. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/constraints_test.py +0 -0
  122. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/decision_variable_test.py +0 -0
  123. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/differential_drive_util.py +0 -0
  124. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/flywheel_util.py +0 -0
  125. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/rk4.py +0 -0
  126. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/python/test/optimization/trivial_problem_test.py +0 -0
  127. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/autodiff/gradient.cpp +0 -0
  128. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/autodiff/hessian.cpp +0 -0
  129. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/autodiff/jacobian.cpp +0 -0
  130. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/autodiff/variable_matrix.cpp +0 -0
  131. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/optimization/ocp.cpp +0 -0
  132. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/optimization/problem.cpp +0 -0
  133. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/optimization/solver/ipm.cpp +0 -0
  134. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/optimization/solver/newton.cpp +0 -0
  135. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/optimization/solver/sqp.cpp +0 -0
  136. {sleipnirgroup_jormungandr-0.6.7.dev124 → sleipnirgroup_jormungandr-0.6.7.dev125}/src/util/pool.cpp +0 -0
@@ -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
- if("ExplicitDouble" IN_LIST SLEIPNIR_TEST_SCALAR_TYPES)
264
- # Build autodiff explicit instantiations
265
- file(
266
- GLOB_RECURSE sleipnir_autodiff_explicit_src
267
- CONFIGURE_DEPENDS
268
- test/src/autodiff/*_explicit_double.cpp
269
- )
270
- add_library(
271
- sleipnir_autodiff_explicit
272
- OBJECT
273
- ${sleipnir_autodiff_explicit_src}
274
- )
275
- compiler_flags(sleipnir_autodiff_explicit)
276
- target_include_directories(
277
- sleipnir_autodiff_explicit
278
- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test/include
279
- )
280
- target_link_libraries(sleipnir_autodiff_explicit PUBLIC Sleipnir)
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
- # Build optimization explicit instantiations
283
- file(
284
- GLOB_RECURSE sleipnir_optimization_explicit_src
285
- CONFIGURE_DEPENDS
286
- test/src/optimization/*_explicit_double.cpp
287
- )
288
- add_library(
289
- sleipnir_optimization_explicit
290
- OBJECT
291
- ${sleipnir_optimization_explicit_src}
292
- )
293
- compiler_flags(sleipnir_optimization_explicit)
294
- target_include_directories(
295
- sleipnir_optimization_explicit
296
- PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test/include
297
- )
298
- target_link_libraries(sleipnir_optimization_explicit PUBLIC Sleipnir)
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
- $<TARGET_NAME_IF_EXISTS:sleipnir_autodiff_explicit>
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
- $<TARGET_NAME_IF_EXISTS:sleipnir_autodiff_explicit>
353
- $<TARGET_NAME_IF_EXISTS:sleipnir_optimization_explicit>
351
+ ${sleipnir_autodiff_explicit_targets}
352
+ ${sleipnir_optimization_explicit_targets}
354
353
  )
355
354
 
356
355
  # Build Sleipnir util tests
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sleipnirgroup-jormungandr
3
- Version: 0.6.7.dev124
3
+ Version: 0.6.7.dev125
4
4
  Summary: Reverse mode autodiff library and NLP solver DSL
5
5
  License-Expression: BSD-3-Clause
6
6
  License-File: LICENSE.txt
@@ -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) : Scalar(1e-10)};
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
- Scalar tolerance = Scalar(1e-8); // NOLINT(google-readability-casting)
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
- constexpr Scalar δ_min(1e-10);
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
- constexpr Scalar γ_max(1e-8);
81
+ const Scalar γ_max = max_constraint_regularization<Scalar>();
81
82
 
82
83
  // The initial nonzero constraint regularization
83
- constexpr Scalar γ_initial(1e-10);
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 within ε of zero, where the inertia check counts them as
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() <= Scalar(1e-12) * rhs.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{1e-10};
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
- constexpr Scalar ε = std::numeric_limits<Scalar>::epsilon();
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;
@@ -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
- constexpr Scalar η_ϕ(1e-8);
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 constexpr Scalar γ_cost{1e-8};
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() >= Scalar(1e-4)).all()) {
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
- constexpr Scalar δ_min(1e-10);
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
- constexpr Scalar γ_max(1e-8);
106
+ const Scalar γ_max = max_constraint_regularization<Scalar>();
104
107
 
105
108
  // The initial nonzero constraint regularization
106
- constexpr Scalar γ_initial(1e-10);
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() <= Scalar(1e-12) * rhs.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{1e-10};
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 ε of zero are counted as
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
- constexpr Scalar ε = std::numeric_limits<Scalar>::epsilon();
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;
@@ -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[] = R"doc(The solver will stop once the error is below this tolerance.)doc";
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
@@ -2,4 +2,4 @@
2
2
 
3
3
  from ._sleipnir import *
4
4
 
5
- __version__ = "0.6.7.dev124"
5
+ __version__ = "0.6.7.dev125"
@@ -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
- H = Hessian(y, x)
619
- expected_H = np.diag(
620
- [-p_1.value() / x[0].value() ** 2, -p_1.value() / x[1].value() ** 2]
621
- )
622
- assert (H.get().value() == expected_H).all()
623
- assert (H.value().todense() == expected_H).all()
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=1e-8)
84
- assert X.value(1, 0) == pytest.approx(x_initial[1, 0], abs=1e-8)
85
- assert X.value(2, 0) == pytest.approx(x_initial[2, 0], abs=1e-8)
86
- assert X.value(3, 0) == pytest.approx(x_initial[3, 0], abs=1e-8)
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(expected_xdot_c[row, 0], abs=1e-8)
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(x_final[0, 0], abs=1e-8)
122
- assert X.value(1, N) == pytest.approx(x_final[1, 0], abs=1e-8)
123
- assert X.value(2, N) == pytest.approx(x_final[2, 0], abs=1e-8)
124
- assert X.value(3, N) == pytest.approx(x_final[3, 0], abs=1e-8)
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:
@@ -9,6 +9,7 @@ from cart_pole_util import (
9
9
  from rk4 import rk4
10
10
  from sleipnir.autodiff import ExpressionType
11
11
  from sleipnir.optimization import ExitStatus, Problem, bounds
12
+ from tolerance import SolutionType, solution_tolerance
12
13
 
13
14
 
14
15
  def lerp(a: float, b: float, t: float) -> float:
@@ -70,10 +71,14 @@ def test_cart_pole_problem(dt: float) -> None:
70
71
  assert problem.solve(diagnostics=True) == ExitStatus.SUCCESS
71
72
 
72
73
  # Verify initial state
73
- assert X.value(0, 0) == pytest.approx(x_initial[0, 0], abs=1e-8)
74
- assert X.value(1, 0) == pytest.approx(x_initial[1, 0], abs=1e-8)
75
- assert X.value(2, 0) == pytest.approx(x_initial[2, 0], abs=1e-8)
76
- assert X.value(3, 0) == pytest.approx(x_initial[3, 0], abs=1e-8)
74
+ assert X.value(0, 0) == pytest.approx(x_initial[0, 0], abs=solution_tolerance(1))
75
+ assert X.value(1, 0) == pytest.approx(
76
+ x_initial[1, 0], abs=solution_tolerance(1, SolutionType.DEGENERATE)
77
+ )
78
+ assert X.value(2, 0) == pytest.approx(
79
+ x_initial[2, 0], abs=solution_tolerance(1, SolutionType.DEGENERATE)
80
+ )
81
+ assert X.value(3, 0) == pytest.approx(x_initial[3, 0], abs=solution_tolerance(1))
77
82
 
78
83
  # Verify solution
79
84
  for k in range(N):
@@ -94,13 +99,23 @@ def test_cart_pole_problem(dt: float) -> None:
94
99
  )
95
100
  actual_x_k1 = X[:, k + 1 : k + 2].value()
96
101
  for row in range(actual_x_k1.shape[0]):
97
- assert actual_x_k1[row, 0] == pytest.approx(expected_x_k1[row, 0], abs=1e-8)
102
+ assert actual_x_k1[row, 0] == pytest.approx(
103
+ expected_x_k1[row, 0], abs=solution_tolerance(1)
104
+ )
98
105
 
99
106
  # Verify final state
100
- assert X.value(0, N) == pytest.approx(x_final[0, 0], abs=1e-8)
101
- assert X.value(1, N) == pytest.approx(x_final[1, 0], abs=1e-8)
102
- assert X.value(2, N) == pytest.approx(x_final[2, 0], abs=1e-8)
103
- assert X.value(3, N) == pytest.approx(x_final[3, 0], abs=1e-8)
107
+ assert X.value(0, N) == pytest.approx(
108
+ x_final[0, 0], abs=solution_tolerance(1, SolutionType.DEGENERATE)
109
+ )
110
+ assert X.value(1, N) == pytest.approx(
111
+ x_final[1, 0], abs=solution_tolerance(1, SolutionType.DEGENERATE)
112
+ )
113
+ assert X.value(2, N) == pytest.approx(
114
+ x_final[2, 0], abs=solution_tolerance(1, SolutionType.DEGENERATE)
115
+ )
116
+ assert X.value(3, N) == pytest.approx(
117
+ x_final[3, 0], abs=solution_tolerance(1, SolutionType.DEGENERATE)
118
+ )
104
119
 
105
120
  # Log states for offline viewing
106
121
  with open("Cart-pole states.csv", "w") as f: