sleipnirgroup-jormungandr 0.6.7.dev134__tar.gz → 0.6.7.dev136__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.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/CMakeLists.txt +2 -2
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/PKG-INFO +1 -1
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/cmake/CompilerFlags.cmake +0 -10
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/ipm.hpp +1 -6
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/dense_kkt_solver.hpp +70 -97
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/kkt_solver.hpp +0 -16
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/regularization_limits.hpp +5 -21
- sleipnirgroup_jormungandr-0.6.7.dev136/include/sleipnir/optimization/solver/util/ruiz_equilibration.hpp +97 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/sparse_kkt_solver.hpp +143 -121
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/src/sleipnir/__init__.py +1 -1
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/cart_pole_ocp_test.py +4 -4
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/cart_pole_problem_test.py +4 -4
- sleipnirgroup_jormungandr-0.6.7.dev134/include/sleipnir/optimization/solver/util/inertia.hpp +0 -71
- sleipnirgroup_jormungandr-0.6.7.dev134/include/sleipnir/optimization/solver/util/kkt_ordering.hpp +0 -215
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/LICENSE.txt +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/README.md +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/SleipnirConfig.cmake.in +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/cmake/BuildTypes.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/cmake/Pybind11Mkdoc.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/cmake/Pybind11MkdocPostprocess.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/cmake/SubdirList.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/cmake/aarch64-linux-gnu.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/cmake/arm-none-eabi.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/autodiff/expression.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/autodiff/expression_functions.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/autodiff/expression_graph.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/autodiff/expression_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/autodiff/gradient.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/autodiff/hessian.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/autodiff/jacobian.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/autodiff/sleipnir_base.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/autodiff/slice.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/autodiff/variable.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/autodiff/variable_block.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/autodiff/variable_matrix.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/multistart.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/ocp/dynamics_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/ocp/timestep_method.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/ocp/transcription_method.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/ocp.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/problem.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/control_flow.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/exit_status.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/ipm_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/iteration_info.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/newton.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/newton_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/options.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/sqp.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/sqp_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/all_finite.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/append_as_triplets.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/bounds.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/constraint_violation.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/feasibility_restoration.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/feasibility_restoration_cycle_detector.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/filter.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/fraction_to_the_boundary_rule.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/kkt_error.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/problem_scaling.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/sparse_inf_norms.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/optimization/solver/util/time_trace.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/util/assert.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/util/concepts.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/util/empty.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/util/force_inline.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/util/function_ref.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/util/intrusive_shared_ptr.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/util/pool.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/util/print.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/util/print_diagnostics.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/util/scope_exit.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/util/spy.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/util/symbol_exports.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/include/sleipnir/util/time_tracer.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/pyproject.toml +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/arity.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/autodiff/bind_expression_type.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/autodiff/bind_gradient.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/autodiff/bind_hessian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/autodiff/bind_jacobian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/autodiff/bind_variable.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/autodiff/bind_variable_block.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/autodiff/bind_variable_matrix.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/binders.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/docstrings.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/for_each_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/main.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/optimization/bind_equality_constraints.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/optimization/bind_inequality_constraints.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/optimization/bind_ocp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/optimization/bind_problem.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/optimization/ocp/bind_dynamics_type.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/optimization/ocp/bind_timestep_method.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/optimization/ocp/bind_transcription_method.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/optimization/solver/bind_exit_status.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/optimization/solver/bind_iteration_info.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/slice_tuple.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/text_wrap.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/cpp/try_cast.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/postprocess_stubs.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/src/sleipnir/autodiff/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/src/sleipnir/optimization/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/autodiff/gradient_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/autodiff/hessian_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/autodiff/jacobian_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/autodiff/variable_matrix_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/autodiff/variable_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/arm_on_elevator_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/cart_pole_util.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/constraints_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/decision_variable_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/differential_drive_ocp_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/differential_drive_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/differential_drive_util.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/double_integrator_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/flywheel_ocp_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/flywheel_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/flywheel_util.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/linear_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/multistart_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/nonlinear_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/problem_spy_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/quadratic_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/rk4.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/solver/exit_status_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/tolerance.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/python/test/optimization/trivial_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/src/autodiff/gradient.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/src/autodiff/hessian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/src/autodiff/jacobian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/src/autodiff/variable_matrix.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/src/optimization/ocp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/src/optimization/problem.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/src/optimization/solver/ipm.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/src/optimization/solver/newton.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/src/optimization/solver/sqp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/src/util/pool.cpp +0 -0
{sleipnirgroup_jormungandr-0.6.7.dev134 → sleipnirgroup_jormungandr-0.6.7.dev136}/CMakeLists.txt
RENAMED
|
@@ -99,8 +99,8 @@ if(NOT SLEIPNIR_USE_SYSTEM_EIGEN)
|
|
|
99
99
|
FetchContent_Declare(
|
|
100
100
|
Eigen3
|
|
101
101
|
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
|
|
102
|
-
# master on 2026-
|
|
103
|
-
GIT_TAG
|
|
102
|
+
# master on 2026-11-16
|
|
103
|
+
GIT_TAG cc54e1fa13e1917c13813b741325d35eed5fc49f
|
|
104
104
|
SYSTEM
|
|
105
105
|
)
|
|
106
106
|
FetchContent_MakeAvailable(Eigen3)
|
|
@@ -19,15 +19,5 @@ function(compiler_flags target)
|
|
|
19
19
|
if(MSVC)
|
|
20
20
|
target_compile_options(${target} PUBLIC /utf-8 /bigobj)
|
|
21
21
|
target_compile_options(${target} PRIVATE /MP)
|
|
22
|
-
# /Zf is an MSVC argument not currently supported by clang-cl.
|
|
23
|
-
# See https://github.com/llvm/llvm-project/issues/51578.
|
|
24
|
-
if(
|
|
25
|
-
NOT (
|
|
26
|
-
${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"
|
|
27
|
-
AND ${CMAKE_CXX_COMPILER_FRONTEND_VARIANT} STREQUAL "MSVC"
|
|
28
|
-
)
|
|
29
|
-
)
|
|
30
|
-
target_compile_options(${target} PRIVATE /Zf)
|
|
31
|
-
endif()
|
|
32
22
|
endif()
|
|
33
23
|
endfunction()
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
#include "sleipnir/optimization/solver/util/fraction_to_the_boundary_rule.hpp"
|
|
29
29
|
#include "sleipnir/optimization/solver/util/kkt_error.hpp"
|
|
30
30
|
#include "sleipnir/optimization/solver/util/kkt_solver.hpp"
|
|
31
|
-
#include "sleipnir/optimization/solver/util/regularization_limits.hpp"
|
|
32
31
|
#include "sleipnir/optimization/solver/util/time_trace.hpp"
|
|
33
32
|
#include "sleipnir/util/assert.hpp"
|
|
34
33
|
#include "sleipnir/util/print_diagnostics.hpp"
|
|
@@ -351,11 +350,7 @@ ExitStatus ipm(
|
|
|
351
350
|
.nonZeros() +
|
|
352
351
|
A_e.nonZeros() <
|
|
353
352
|
0.25 * lhs_rows * lhs_rows,
|
|
354
|
-
matrices.num_decision_variables, matrices.num_equality_constraints
|
|
355
|
-
// Constraint regularization is forced to zero in feasibility restoration
|
|
356
|
-
// because the equality constraint Jacobian cannot be rank-deficient
|
|
357
|
-
in_feasibility_restoration ? Scalar(0)
|
|
358
|
-
: min_constraint_regularization<Scalar>()};
|
|
353
|
+
matrices.num_decision_variables, matrices.num_equality_constraints};
|
|
359
354
|
|
|
360
355
|
// Step size reduction factor
|
|
361
356
|
constexpr Scalar α_reduction_factor(0.5);
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
#include <Eigen/Cholesky>
|
|
10
10
|
#include <Eigen/Core>
|
|
11
11
|
|
|
12
|
-
#include "sleipnir/optimization/solver/util/inertia.hpp"
|
|
13
12
|
#include "sleipnir/optimization/solver/util/regularization_limits.hpp"
|
|
14
13
|
|
|
15
14
|
namespace slp {
|
|
@@ -37,19 +36,6 @@ class DenseKKTSolver {
|
|
|
37
36
|
: m_num_decision_variables{num_decision_variables},
|
|
38
37
|
m_num_equality_constraints{num_equality_constraints} {}
|
|
39
38
|
|
|
40
|
-
/// Constructs a DenseKKTSolver instance.
|
|
41
|
-
///
|
|
42
|
-
/// @param num_decision_variables The number of decision variables in the
|
|
43
|
-
/// system.
|
|
44
|
-
/// @param num_equality_constraints The number of equality constraints in the
|
|
45
|
-
/// system.
|
|
46
|
-
/// @param γ_min The minimum constraint regularization.
|
|
47
|
-
DenseKKTSolver(int num_decision_variables, int num_equality_constraints,
|
|
48
|
-
Scalar γ_min)
|
|
49
|
-
: m_num_decision_variables{num_decision_variables},
|
|
50
|
-
m_num_equality_constraints{num_equality_constraints},
|
|
51
|
-
m_γ_min{γ_min} {}
|
|
52
|
-
|
|
53
39
|
/// Reports whether previous computation was successful.
|
|
54
40
|
///
|
|
55
41
|
/// @return Whether previous computation was successful.
|
|
@@ -63,8 +49,8 @@ class DenseKKTSolver {
|
|
|
63
49
|
// Bunch-Kaufman pivoting is backward stable for indefinite matrices, so the
|
|
64
50
|
// unregularized system is accepted whenever its inertia is ideal
|
|
65
51
|
m_lhs = lhs;
|
|
66
|
-
|
|
67
|
-
if (m_info == Eigen::Success &&
|
|
52
|
+
factorize();
|
|
53
|
+
if (m_info == Eigen::Success && has_ideal_inertia()) {
|
|
68
54
|
m_prev_δ = Scalar(0);
|
|
69
55
|
m_prev_γ = Scalar(0);
|
|
70
56
|
return *this;
|
|
@@ -88,55 +74,49 @@ class DenseKKTSolver {
|
|
|
88
74
|
// because when regularization is needed, δ is the only curvature in some
|
|
89
75
|
// directions, so the KKT matrix's smallest eigenvalues shrink with δ. Too
|
|
90
76
|
// small a δ makes the matrix ill-conditioned, which amplifies the
|
|
91
|
-
// factorization's rounding error in the solution, and eventually
|
|
92
|
-
//
|
|
93
|
-
// zero.
|
|
77
|
+
// factorization's rounding error in the solution, and eventually makes the
|
|
78
|
+
// factorization's pivots near-singular.
|
|
94
79
|
Scalar δ = m_prev_δ == Scalar(0) ? Scalar(1e-4)
|
|
95
80
|
: std::max(m_prev_δ / Scalar(2), δ_min);
|
|
96
81
|
|
|
97
|
-
// Start γ at
|
|
98
|
-
//
|
|
99
|
-
Scalar γ
|
|
82
|
+
// Start γ at zero to avoid distorting the equality constraint Jacobian. It
|
|
83
|
+
// only needs to be nonzero if the Jacobian turns out to be rank-deficient.
|
|
84
|
+
Scalar γ(0);
|
|
100
85
|
|
|
101
86
|
while (true) {
|
|
102
87
|
m_lhs = lhs + regularization(δ, γ);
|
|
103
|
-
|
|
88
|
+
factorize();
|
|
104
89
|
|
|
105
90
|
if (m_info == Eigen::Success) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (inertia == ideal_inertia) {
|
|
109
|
-
// If the inertia is ideal, report success
|
|
110
|
-
m_prev_δ = δ;
|
|
111
|
-
m_prev_γ = γ;
|
|
112
|
-
return *this;
|
|
113
|
-
} else if (inertia.zero > 0) {
|
|
91
|
+
if (has_near_singular_pivot()) {
|
|
114
92
|
if (γ == Scalar(0)) {
|
|
115
|
-
// If there's
|
|
116
|
-
// compensate for a rank-deficient equality constraint
|
|
93
|
+
// If there's a near-singular pivot and γ = 0, increase γ to
|
|
94
|
+
// potentially compensate for a rank-deficient equality constraint
|
|
95
|
+
// Jacobian
|
|
117
96
|
γ = γ_initial;
|
|
118
97
|
} else {
|
|
119
|
-
// If there's
|
|
120
|
-
// all
|
|
98
|
+
// If there's a near-singular pivot and γ > 0, increase δ and γ to
|
|
99
|
+
// move all pivots away from singularity
|
|
121
100
|
δ *= Scalar(10);
|
|
122
101
|
γ = std::min(γ * Scalar(10), γ_max);
|
|
123
102
|
}
|
|
124
|
-
} else if (
|
|
103
|
+
} else if (m_solver.numNegative() > m_num_equality_constraints) {
|
|
125
104
|
// If there's too many negative eigenvalues, increase δ to add more
|
|
126
105
|
// positive eigenvalues
|
|
127
106
|
δ *= Scalar(10);
|
|
128
|
-
} else if (
|
|
107
|
+
} else if (m_solver.numPositive() > m_num_decision_variables) {
|
|
129
108
|
// The KKT matrix has at least as many negative eigenvalues as
|
|
130
109
|
// equality constraints if γ > 0 (from the −γI block) or if the
|
|
131
|
-
// equality constraint Jacobian has full row rank
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
// eigenvalues away from zero.
|
|
135
|
-
//
|
|
136
|
-
// Unlike LDLT, Bunch-Kaufman pivoting avoids small pivots, so
|
|
137
|
-
// there's no need to find which block the error came from.
|
|
110
|
+
// equality constraint Jacobian has full row rank. Too many positive
|
|
111
|
+
// eigenvalues can then only come from rounding error, so increase δ
|
|
112
|
+
// and γ to drive all eigenvalues away from zero.
|
|
138
113
|
δ *= Scalar(10);
|
|
139
|
-
γ = std::min(γ * Scalar(10), γ_max);
|
|
114
|
+
γ = γ == Scalar(0) ? γ_initial : std::min(γ * Scalar(10), γ_max);
|
|
115
|
+
} else {
|
|
116
|
+
// If the inertia is ideal, report success
|
|
117
|
+
m_prev_δ = δ;
|
|
118
|
+
m_prev_γ = γ;
|
|
119
|
+
return *this;
|
|
140
120
|
}
|
|
141
121
|
} else {
|
|
142
122
|
// If the decomposition failed, increase δ and γ to drive all
|
|
@@ -164,7 +144,7 @@ class DenseKKTSolver {
|
|
|
164
144
|
DenseVector solve(const Eigen::MatrixBase<Rhs>& rhs) const {
|
|
165
145
|
using std::pow;
|
|
166
146
|
|
|
167
|
-
DenseVector x =
|
|
147
|
+
DenseVector x = solve_factorized(rhs);
|
|
168
148
|
|
|
169
149
|
// The factorization is backward stable, but the matrix's conditioning
|
|
170
150
|
// amplifies its rounding error in the solution, so apply iterative
|
|
@@ -182,7 +162,7 @@ class DenseKKTSolver {
|
|
|
182
162
|
if (r.norm() <= refinement_tolerance * rhs.norm()) {
|
|
183
163
|
break;
|
|
184
164
|
}
|
|
185
|
-
x +=
|
|
165
|
+
x += solve_factorized(r);
|
|
186
166
|
}
|
|
187
167
|
|
|
188
168
|
return x;
|
|
@@ -223,93 +203,86 @@ class DenseKKTSolver {
|
|
|
223
203
|
/// The number of equality constraints in the system.
|
|
224
204
|
int m_num_equality_constraints = 0;
|
|
225
205
|
|
|
226
|
-
/// The minimum constraint regularization.
|
|
227
|
-
Scalar m_γ_min = min_constraint_regularization<Scalar>();
|
|
228
|
-
|
|
229
|
-
/// The ideal system inertia.
|
|
230
|
-
Inertia ideal_inertia{m_num_decision_variables, m_num_equality_constraints,
|
|
231
|
-
0};
|
|
232
|
-
|
|
233
206
|
/// The value of δ from the previous run of compute().
|
|
234
207
|
Scalar m_prev_δ{0};
|
|
235
208
|
|
|
236
209
|
/// The value of γ from the previous run of compute().
|
|
237
210
|
Scalar m_prev_γ{0};
|
|
238
211
|
|
|
239
|
-
///
|
|
212
|
+
/// Factorizes the KKT matrix in m_lhs.
|
|
213
|
+
void factorize() { m_info = m_solver.compute(m_lhs).info(); }
|
|
214
|
+
|
|
215
|
+
/// Solves the system of equations with the most recent factorization.
|
|
216
|
+
///
|
|
217
|
+
/// @param rhs Right-hand side of the system.
|
|
218
|
+
/// @return The solution.
|
|
219
|
+
DenseVector solve_factorized(const DenseVector& rhs) const {
|
|
220
|
+
return m_solver.solve(rhs);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/// Returns whether the most recently factorized KKT matrix has the ideal
|
|
224
|
+
/// inertia.
|
|
240
225
|
///
|
|
241
|
-
///
|
|
242
|
-
///
|
|
243
|
-
|
|
244
|
-
|
|
226
|
+
/// @return Whether the most recently factorized KKT matrix has the ideal
|
|
227
|
+
/// inertia.
|
|
228
|
+
bool has_ideal_inertia() const {
|
|
229
|
+
return !has_near_singular_pivot() &&
|
|
230
|
+
m_solver.numPositive() == m_num_decision_variables &&
|
|
231
|
+
m_solver.numNegative() == m_num_equality_constraints;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/// Returns whether the most recent factorization of the KKT matrix has a
|
|
235
|
+
/// near-singular pivot.
|
|
245
236
|
///
|
|
246
|
-
/// @return
|
|
247
|
-
|
|
237
|
+
/// @return Whether the most recent factorization of the KKT matrix has a
|
|
238
|
+
/// near-singular pivot.
|
|
239
|
+
bool has_near_singular_pivot() const {
|
|
248
240
|
using std::abs;
|
|
249
241
|
using std::hypot;
|
|
250
242
|
|
|
251
|
-
const Scalar threshold =
|
|
243
|
+
const Scalar threshold = near_singular_pivot_threshold<Scalar>();
|
|
252
244
|
|
|
253
|
-
const auto D = m_solver.vectorD();
|
|
245
|
+
const auto& D = m_solver.vectorD();
|
|
254
246
|
const auto& D_sub = m_solver.subDiagonal();
|
|
255
247
|
|
|
256
|
-
|
|
257
|
-
auto
|
|
258
|
-
if (λ > threshold) {
|
|
259
|
-
++inertia.positive;
|
|
260
|
-
} else if (λ < -threshold) {
|
|
261
|
-
++inertia.negative;
|
|
262
|
-
} else {
|
|
263
|
-
++inertia.zero;
|
|
264
|
-
}
|
|
265
|
-
};
|
|
248
|
+
// This treats NaN as near zero
|
|
249
|
+
auto is_near_zero = [&](Scalar λ) { return !(abs(λ) > threshold); };
|
|
266
250
|
|
|
251
|
+
// Check each of D's 1x1 and 2x2 pivots for near-singularity
|
|
267
252
|
for (int k = 0; k < D.size(); ++k) {
|
|
268
|
-
if (
|
|
253
|
+
if (D_sub[k] != Scalar(0)) {
|
|
269
254
|
// The eigenvalues of the 2x2 block [a b; b c] are the roots of its
|
|
270
255
|
// characteristic polynomial.
|
|
271
256
|
//
|
|
272
257
|
// det([a − λ b; b c − λ]) = (a − λ)(c − λ) − b²
|
|
273
|
-
// = ac − aλ − cλ + λ² − b²
|
|
274
258
|
// = λ² − (a + c)λ + (ac − b²)
|
|
275
259
|
//
|
|
276
260
|
// λ = (a + c)/2 ± r where r = √(((a − c)/2)² + b²)
|
|
277
261
|
//
|
|
278
|
-
// Let λ₁ be the root farther from zero
|
|
279
|
-
//
|
|
280
|
-
// have opposite signs, so λ₂ loses
|
|
281
|
-
// compute λ₂ from λ₁ and the product
|
|
262
|
+
// Let λ₁ be the root farther from zero, so only the other root λ₂ needs
|
|
263
|
+
// checking. λ₁'s two terms have the same sign, so it has no
|
|
264
|
+
// cancellation. The two terms of λ₂ have opposite signs, so λ₂ loses
|
|
265
|
+
// accuracy if |a| >> |c|. Instead, compute λ₂ from λ₁ and the product
|
|
266
|
+
// of the roots.
|
|
282
267
|
//
|
|
283
268
|
// λ₁λ₂ = ((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
269
|
// λ₂ = (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| ≤ |λ₁|.
|
|
298
270
|
const Scalar a = D[k];
|
|
299
271
|
const Scalar b = D_sub[k];
|
|
300
272
|
const Scalar c = D[k + 1];
|
|
301
273
|
const Scalar mid = (a + c) / Scalar(2);
|
|
302
274
|
const Scalar r = hypot((a - c) / Scalar(2), abs(b));
|
|
303
275
|
const Scalar λ = mid >= Scalar(0) ? mid + r : mid - r;
|
|
304
|
-
|
|
305
|
-
|
|
276
|
+
if (is_near_zero((a / λ) * c - (b / λ) * b)) {
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
306
279
|
++k;
|
|
307
|
-
} else {
|
|
308
|
-
|
|
280
|
+
} else if (is_near_zero(D[k])) {
|
|
281
|
+
return true;
|
|
309
282
|
}
|
|
310
283
|
}
|
|
311
284
|
|
|
312
|
-
return
|
|
285
|
+
return false;
|
|
313
286
|
}
|
|
314
287
|
|
|
315
288
|
/// Returns regularization matrix.
|
|
@@ -36,22 +36,6 @@ class KKTSolver {
|
|
|
36
36
|
m_sparse_solver{num_decision_variables, num_equality_constraints},
|
|
37
37
|
m_dense_solver{num_decision_variables, num_equality_constraints} {}
|
|
38
38
|
|
|
39
|
-
/// Constructs a KKTSolver instance.
|
|
40
|
-
///
|
|
41
|
-
/// @param use_sparse_solver Whether to use sparse or dense solver.
|
|
42
|
-
/// @param num_decision_variables The number of decision variables in the
|
|
43
|
-
/// system.
|
|
44
|
-
/// @param num_equality_constraints The number of equality constraints in the
|
|
45
|
-
/// system.
|
|
46
|
-
/// @param γ_min The minimum constraint regularization.
|
|
47
|
-
KKTSolver(bool use_sparse_solver, int num_decision_variables,
|
|
48
|
-
int num_equality_constraints, Scalar γ_min)
|
|
49
|
-
: m_use_sparse_solver{use_sparse_solver},
|
|
50
|
-
m_sparse_solver{num_decision_variables, num_equality_constraints,
|
|
51
|
-
γ_min},
|
|
52
|
-
m_dense_solver{num_decision_variables, num_equality_constraints,
|
|
53
|
-
γ_min} {}
|
|
54
|
-
|
|
55
39
|
/// Reports whether previous computation was successful.
|
|
56
40
|
///
|
|
57
41
|
/// @return Whether previous computation was successful.
|
|
@@ -16,7 +16,7 @@ template <typename Scalar>
|
|
|
16
16
|
Scalar min_hessian_regularization() {
|
|
17
17
|
using std::sqrt;
|
|
18
18
|
|
|
19
|
-
// This value keeps regularized pivots well above the
|
|
19
|
+
// This value keeps regularized pivots well above the near-singular pivot
|
|
20
20
|
// threshold
|
|
21
21
|
return sqrt(std::numeric_limits<Scalar>::epsilon()) / Scalar(100);
|
|
22
22
|
}
|
|
@@ -45,14 +45,13 @@ Scalar min_constraint_regularization() {
|
|
|
45
45
|
return sqrt(std::numeric_limits<Scalar>::epsilon()) / Scalar(3000);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
/// Returns the largest LDLT pivot magnitude
|
|
49
|
-
///
|
|
48
|
+
/// Returns the largest LDLT pivot magnitude counted as near-singular. A 2x2
|
|
49
|
+
/// pivot's magnitude is the smallest magnitude of its eigenvalues.
|
|
50
50
|
///
|
|
51
51
|
/// @tparam Scalar Scalar type.
|
|
52
|
-
/// @return The largest LDLT pivot magnitude
|
|
53
|
-
/// zero.
|
|
52
|
+
/// @return The largest LDLT pivot magnitude counted as near-singular.
|
|
54
53
|
template <typename Scalar>
|
|
55
|
-
Scalar
|
|
54
|
+
Scalar near_singular_pivot_threshold() {
|
|
56
55
|
using std::min;
|
|
57
56
|
|
|
58
57
|
// The threshold must be below the regularized pivots, or the regularization
|
|
@@ -75,19 +74,4 @@ Scalar max_constraint_regularization() {
|
|
|
75
74
|
return sqrt(std::numeric_limits<Scalar>::epsilon());
|
|
76
75
|
}
|
|
77
76
|
|
|
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
77
|
} // namespace slp
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Copyright (c) Sleipnir contributors
|
|
2
|
+
|
|
3
|
+
#pragma once
|
|
4
|
+
|
|
5
|
+
#include <algorithm>
|
|
6
|
+
#include <cmath>
|
|
7
|
+
|
|
8
|
+
#include <Eigen/Core>
|
|
9
|
+
#include <Eigen/SparseCore>
|
|
10
|
+
|
|
11
|
+
namespace slp {
|
|
12
|
+
|
|
13
|
+
/// Ruiz equilibration of a symmetric sparse matrix stored as its lower
|
|
14
|
+
/// triangle.
|
|
15
|
+
///
|
|
16
|
+
/// Computes a diagonal S such that every row of S A S has its largest entry
|
|
17
|
+
/// close to 1.
|
|
18
|
+
///
|
|
19
|
+
/// @tparam Scalar Scalar type.
|
|
20
|
+
template <typename Scalar>
|
|
21
|
+
class RuizEquilibration {
|
|
22
|
+
public:
|
|
23
|
+
/// Type alias for dense vector.
|
|
24
|
+
using DenseVector = Eigen::VectorX<Scalar>;
|
|
25
|
+
/// Type alias for sparse matrix.
|
|
26
|
+
using SparseMatrix = Eigen::SparseMatrix<Scalar>;
|
|
27
|
+
|
|
28
|
+
/// Computes the equilibration of a symmetric matrix.
|
|
29
|
+
///
|
|
30
|
+
/// @param lower The matrix's lower triangle.
|
|
31
|
+
void compute(const SparseMatrix& lower) {
|
|
32
|
+
using std::abs;
|
|
33
|
+
|
|
34
|
+
// Each sweep moves every row's largest entry closer to 1. A few are enough
|
|
35
|
+
// because the pivot tests only need rough scaling.
|
|
36
|
+
constexpr int num_sweeps = 3;
|
|
37
|
+
|
|
38
|
+
const int size = lower.rows();
|
|
39
|
+
const Scalar* values = lower.valuePtr();
|
|
40
|
+
const auto* outer = lower.outerIndexPtr();
|
|
41
|
+
const auto* inner = lower.innerIndexPtr();
|
|
42
|
+
|
|
43
|
+
m_scale.setOnes(size);
|
|
44
|
+
m_row_max.resize(size);
|
|
45
|
+
for (int sweep = 0; sweep < num_sweeps; ++sweep) {
|
|
46
|
+
m_row_max.setZero();
|
|
47
|
+
for (int col = 0; col < size; ++col) {
|
|
48
|
+
const Scalar col_scale = m_scale[col];
|
|
49
|
+
Scalar col_max{0};
|
|
50
|
+
for (auto k = outer[col]; k < outer[col + 1]; ++k) {
|
|
51
|
+
const int row = inner[k];
|
|
52
|
+
const Scalar value = abs(values[k]) * m_scale[row] * col_scale;
|
|
53
|
+
m_row_max[row] = std::max(m_row_max[row], value);
|
|
54
|
+
col_max = std::max(col_max, value);
|
|
55
|
+
}
|
|
56
|
+
m_row_max[col] = std::max(m_row_max[col], col_max);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Empty rows keep their scale
|
|
60
|
+
m_row_max = (m_row_max.array() > Scalar(0)).select(m_row_max, Scalar(1));
|
|
61
|
+
m_scale.array() /= m_row_max.array().sqrt();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/// Writes S A S into a matrix with the same sparsity pattern as A.
|
|
66
|
+
///
|
|
67
|
+
/// @param lower A's lower triangle.
|
|
68
|
+
/// @param scaled The lower triangle of S A S. Its sparsity pattern must
|
|
69
|
+
/// already match lower's.
|
|
70
|
+
void apply(const SparseMatrix& lower, SparseMatrix& scaled) const {
|
|
71
|
+
const Scalar* values = lower.valuePtr();
|
|
72
|
+
const auto* outer = lower.outerIndexPtr();
|
|
73
|
+
const auto* inner = lower.innerIndexPtr();
|
|
74
|
+
Scalar* scaled_values = scaled.valuePtr();
|
|
75
|
+
|
|
76
|
+
for (int col = 0; col < lower.cols(); ++col) {
|
|
77
|
+
const Scalar col_scale = m_scale[col];
|
|
78
|
+
for (auto k = outer[col]; k < outer[col + 1]; ++k) {
|
|
79
|
+
scaled_values[k] = values[k] * (m_scale[inner[k]] * col_scale);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/// Returns the diagonal of S.
|
|
85
|
+
///
|
|
86
|
+
/// @return The diagonal of S.
|
|
87
|
+
const DenseVector& scale() const { return m_scale; }
|
|
88
|
+
|
|
89
|
+
private:
|
|
90
|
+
/// The diagonal of S.
|
|
91
|
+
DenseVector m_scale;
|
|
92
|
+
|
|
93
|
+
/// Each row's largest entry during a sweep, kept to avoid reallocating.
|
|
94
|
+
DenseVector m_row_max;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
} // namespace slp
|