sleipnirgroup-jormungandr 0.6.7.dev85__tar.gz → 0.6.7.dev87__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sleipnirgroup-jormungandr might be problematic. Click here for more details.
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/PKG-INFO +1 -1
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/ocp.hpp +29 -2
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/ipm.hpp +88 -29
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/newton.hpp +43 -11
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/sqp.hpp +68 -20
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/feasibility_restoration.hpp +10 -7
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/filter.hpp +100 -21
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/docstrings.hpp +2 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/src/sleipnir/__init__.py +1 -1
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/flywheel_ocp_test.py +5 -1
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/CMakeLists.txt +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/LICENSE.txt +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/README.md +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/SleipnirConfig.cmake.in +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/cmake/BuildTypes.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/cmake/CompilerFlags.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/cmake/Pybind11Mkdoc.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/cmake/Pybind11MkdocPostprocess.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/cmake/SubdirList.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/cmake/arm-none-eabi.cmake +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/autodiff/expression.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/autodiff/expression_graph.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/autodiff/expression_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/autodiff/gradient.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/autodiff/hessian.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/autodiff/jacobian.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/autodiff/sleipnir_base.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/autodiff/slice.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/autodiff/variable.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/autodiff/variable_block.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/autodiff/variable_matrix.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/multistart.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/ocp/dynamics_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/ocp/timestep_method.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/ocp/transcription_method.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/problem.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/exit_status.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/ipm_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/iteration_info.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/newton_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/options.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/sqp_matrix_callbacks.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/all_finite.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/append_as_triplets.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/bounds.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/constraint_violation.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/dense_kkt_solver.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/feasibility_restoration_cycle_detector.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/fraction_to_the_boundary_rule.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/inertia.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/kkt_error.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/kkt_solver.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/problem_scaling.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/sparse_inf_norms.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/sparse_kkt_solver.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/optimization/solver/util/time_trace.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/util/assert.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/util/concepts.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/util/empty.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/util/function_ref.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/util/intrusive_shared_ptr.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/util/pool.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/util/print.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/util/print_diagnostics.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/util/scope_exit.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/util/spy.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/util/symbol_exports.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/include/sleipnir/util/time_tracer.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/pyproject.toml +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/arity.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/autodiff/bind_expression_type.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/autodiff/bind_gradient.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/autodiff/bind_hessian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/autodiff/bind_jacobian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/autodiff/bind_variable.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/autodiff/bind_variable_block.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/autodiff/bind_variable_matrix.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/binders.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/for_each_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/main.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/optimization/bind_equality_constraints.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/optimization/bind_inequality_constraints.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/optimization/bind_ocp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/optimization/bind_problem.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/optimization/ocp/bind_dynamics_type.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/optimization/ocp/bind_timestep_method.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/optimization/ocp/bind_transcription_method.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/optimization/solver/bind_exit_status.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/optimization/solver/bind_iteration_info.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/slice_tuple.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/text_wrap.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/cpp/try_cast.hpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/postprocess_stubs.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/src/sleipnir/autodiff/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/src/sleipnir/optimization/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/autodiff/gradient_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/autodiff/hessian_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/autodiff/jacobian_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/autodiff/variable_matrix_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/autodiff/variable_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/arm_on_elevator_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/cart_pole_ocp_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/cart_pole_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/cart_pole_util.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/constraints_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/decision_variable_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/differential_drive_ocp_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/differential_drive_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/differential_drive_util.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/double_integrator_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/flywheel_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/linear_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/multistart_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/near.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/nonlinear_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/problem_spy_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/quadratic_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/rk4.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/solver/exit_status_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/python/test/optimization/trivial_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/src/autodiff/gradient.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/src/autodiff/hessian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/src/autodiff/jacobian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/src/autodiff/variable_matrix.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/src/optimization/ocp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/src/optimization/problem.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/src/optimization/solver/ipm.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/src/optimization/solver/newton.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/src/optimization/solver/sqp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.6.7.dev85 → sleipnirgroup_jormungandr-0.6.7.dev87}/src/util/pool.cpp +0 -0
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
#include <stdint.h>
|
|
6
6
|
|
|
7
|
+
#include <algorithm>
|
|
7
8
|
#include <chrono>
|
|
8
9
|
#include <utility>
|
|
9
10
|
|
|
11
|
+
#include "sleipnir/autodiff/expression_type.hpp"
|
|
10
12
|
#include "sleipnir/autodiff/variable.hpp"
|
|
11
13
|
#include "sleipnir/autodiff/variable_matrix.hpp"
|
|
12
14
|
#include "sleipnir/optimization/ocp/dynamics_type.hpp"
|
|
@@ -15,6 +17,7 @@
|
|
|
15
17
|
#include "sleipnir/optimization/problem.hpp"
|
|
16
18
|
#include "sleipnir/util/assert.hpp"
|
|
17
19
|
#include "sleipnir/util/concepts.hpp"
|
|
20
|
+
#include "sleipnir/util/empty.hpp"
|
|
18
21
|
#include "sleipnir/util/function_ref.hpp"
|
|
19
22
|
#include "sleipnir/util/symbol_exports.hpp"
|
|
20
23
|
|
|
@@ -117,7 +120,8 @@ class OCP : public Problem<Scalar> {
|
|
|
117
120
|
TranscriptionMethod::DIRECT_TRANSCRIPTION)
|
|
118
121
|
: m_num_steps{num_steps},
|
|
119
122
|
m_dynamics{std::move(dynamics)},
|
|
120
|
-
m_dynamics_type{dynamics_type}
|
|
123
|
+
m_dynamics_type{dynamics_type},
|
|
124
|
+
m_transcription_method{transcription_method} {
|
|
121
125
|
// u is num_steps + 1 so that the final constraint function evaluation works
|
|
122
126
|
m_U = this->decision_variable(num_inputs, m_num_steps + 1);
|
|
123
127
|
|
|
@@ -163,7 +167,29 @@ class OCP : public Problem<Scalar> {
|
|
|
163
167
|
template <typename T>
|
|
164
168
|
requires ScalarLike<T> || MatrixLike<T>
|
|
165
169
|
void constrain_initial_state(const T& initial_state) {
|
|
166
|
-
this->
|
|
170
|
+
auto x_0 = this->initial_state();
|
|
171
|
+
|
|
172
|
+
// Broadcast scalars to the initial state's shape
|
|
173
|
+
VariableMatrix<Scalar> x_0_value;
|
|
174
|
+
if constexpr (ScalarLike<T>) {
|
|
175
|
+
x_0_value = VariableMatrix<Scalar>{detail::empty, x_0.rows(), x_0.cols()};
|
|
176
|
+
for (auto& elem : x_0_value) {
|
|
177
|
+
elem = initial_state;
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
x_0_value = VariableMatrix<Scalar>{initial_state};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// In single-shooting, the initial state isn't a decision variable, so set
|
|
184
|
+
// its value instead if it's constant
|
|
185
|
+
if (m_transcription_method == TranscriptionMethod::SINGLE_SHOOTING &&
|
|
186
|
+
std::ranges::all_of(x_0_value, [](const auto& elem) {
|
|
187
|
+
return elem.type() == ExpressionType::CONSTANT;
|
|
188
|
+
})) {
|
|
189
|
+
x_0.set_value(x_0_value.value());
|
|
190
|
+
} else {
|
|
191
|
+
this->subject_to(x_0 == x_0_value);
|
|
192
|
+
}
|
|
167
193
|
}
|
|
168
194
|
|
|
169
195
|
/// Constrains the final state.
|
|
@@ -296,6 +322,7 @@ class OCP : public Problem<Scalar> {
|
|
|
296
322
|
const VariableMatrix<Scalar>& u, const Variable<Scalar>& dt)>
|
|
297
323
|
m_dynamics;
|
|
298
324
|
DynamicsType m_dynamics_type;
|
|
325
|
+
TranscriptionMethod m_transcription_method;
|
|
299
326
|
|
|
300
327
|
VariableMatrix<Scalar> m_X;
|
|
301
328
|
VariableMatrix<Scalar> m_U;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
#include <chrono>
|
|
7
7
|
#include <cmath>
|
|
8
8
|
#include <functional>
|
|
9
|
+
#include <limits>
|
|
9
10
|
#include <optional>
|
|
10
11
|
#include <span>
|
|
11
12
|
|
|
@@ -167,6 +168,37 @@ ExitStatus ipm(const IPMMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
167
168
|
return std::max(p_y.template lpNorm<Eigen::Infinity>(),
|
|
168
169
|
p_z.template lpNorm<Eigen::Infinity>());
|
|
169
170
|
}
|
|
171
|
+
|
|
172
|
+
/// Returns the step size below which the primal step is negligible
|
|
173
|
+
/// relative to the iterate.
|
|
174
|
+
///
|
|
175
|
+
/// @param x The decision variables.
|
|
176
|
+
/// @param s The inequality constraint slack variables.
|
|
177
|
+
/// @return The step size below which the primal step is negligible
|
|
178
|
+
/// relative to the iterate.
|
|
179
|
+
Scalar tiny_step_size(const DenseVector& x, const DenseVector& s) const {
|
|
180
|
+
using std::max;
|
|
181
|
+
|
|
182
|
+
// A primal step α[pˣ pˢ] is negligible if
|
|
183
|
+
//
|
|
184
|
+
// max(‖αpˣ/(1 + |x|)‖_∞, ‖αpˢ/(1 + |s|)‖_∞) < 10ε
|
|
185
|
+
//
|
|
186
|
+
// where the absolute values and division are elementwise. Since α > 0,
|
|
187
|
+
// it factors out of the norms and max.
|
|
188
|
+
//
|
|
189
|
+
// α max(‖pˣ/(1 + |x|)‖_∞, ‖pˢ/(1 + |s|)‖_∞) < 10ε
|
|
190
|
+
//
|
|
191
|
+
// Dividing both sides by the max gives
|
|
192
|
+
//
|
|
193
|
+
// α < 10ε / max(‖pˣ/(1 + |x|)‖_∞, ‖pˢ/(1 + |s|)‖_∞)
|
|
194
|
+
return Scalar(10) * std::numeric_limits<Scalar>::epsilon() /
|
|
195
|
+
max((p_x.array().abs() / (Scalar(1) + x.array().abs()))
|
|
196
|
+
.matrix()
|
|
197
|
+
.template lpNorm<Eigen::Infinity>(),
|
|
198
|
+
(p_s.array().abs() / (Scalar(1) + s.array().abs()))
|
|
199
|
+
.matrix()
|
|
200
|
+
.template lpNorm<Eigen::Infinity>());
|
|
201
|
+
}
|
|
170
202
|
};
|
|
171
203
|
|
|
172
204
|
using std::isfinite;
|
|
@@ -268,6 +300,12 @@ ExitStatus ipm(const IPMMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
268
300
|
|
|
269
301
|
Filter<Scalar> filter{constraint_violation(c_e, c_i, s)};
|
|
270
302
|
|
|
303
|
+
// The smallest KKT error of a step accepted by the KKT error reduction
|
|
304
|
+
// fallback for the current barrier parameter. Each fallback step must improve
|
|
305
|
+
// on it, so finitely many fallback steps are taken before the barrier
|
|
306
|
+
// subproblem converges.
|
|
307
|
+
Scalar fallback_kkt_error = std::numeric_limits<Scalar>::infinity();
|
|
308
|
+
|
|
271
309
|
// This should be run when the error is below a desired threshold for the
|
|
272
310
|
// current barrier parameter
|
|
273
311
|
auto update_barrier_parameter_and_reset_filter = [&] {
|
|
@@ -295,6 +333,7 @@ ExitStatus ipm(const IPMMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
295
333
|
|
|
296
334
|
// Reset the filter when the barrier parameter is updated
|
|
297
335
|
filter.reset();
|
|
336
|
+
fallback_kkt_error = std::numeric_limits<Scalar>::infinity();
|
|
298
337
|
};
|
|
299
338
|
|
|
300
339
|
// Kept outside the loop so its storage can be reused
|
|
@@ -316,9 +355,8 @@ ExitStatus ipm(const IPMMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
316
355
|
// because the equality constraint Jacobian cannot be rank-deficient
|
|
317
356
|
in_feasibility_restoration ? Scalar(0) : Scalar(1e-10)};
|
|
318
357
|
|
|
319
|
-
//
|
|
358
|
+
// Step size reduction factor
|
|
320
359
|
constexpr Scalar α_reduction_factor(0.5);
|
|
321
|
-
constexpr Scalar α_min(1e-7);
|
|
322
360
|
|
|
323
361
|
int full_step_rejected_counter = 0;
|
|
324
362
|
|
|
@@ -431,11 +469,6 @@ ExitStatus ipm(const IPMMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
431
469
|
α_max = fraction_to_the_boundary_rule<Scalar>(s, step.p_s, τ);
|
|
432
470
|
α = α_max;
|
|
433
471
|
|
|
434
|
-
// If maximum step size is below minimum, invoke feasibility restoration
|
|
435
|
-
if (α < α_min) {
|
|
436
|
-
call_feasibility_restoration = true;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
472
|
// αₖᶻ = max(α ∈ (0, 1] : zₖ + αpₖᶻ ≥ (1−τⱼ)zₖ)
|
|
440
473
|
α_z = fraction_to_the_boundary_rule<Scalar>(z, step.p_z, τ);
|
|
441
474
|
|
|
@@ -451,8 +484,20 @@ ExitStatus ipm(const IPMMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
451
484
|
const Scalar D_ϕ =
|
|
452
485
|
g.transpose() * step.p_x - μ * s.cwiseInverse().dot(step.p_s);
|
|
453
486
|
|
|
487
|
+
const Scalar α_min = filter.min_step_size(current_entry, D_ϕ);
|
|
488
|
+
|
|
489
|
+
// If maximum step size is below minimum, invoke feasibility restoration
|
|
490
|
+
if (α < α_min) {
|
|
491
|
+
call_feasibility_restoration = true;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// α_min can be zero (e.g., when the constraint violation is zero), so also
|
|
495
|
+
// end the line search when the step becomes negligible relative to the
|
|
496
|
+
// iterate. This bounds the number of step size reductions.
|
|
497
|
+
const Scalar α_tiny = step.tiny_step_size(x, s);
|
|
498
|
+
|
|
454
499
|
// Loop until a step is accepted
|
|
455
|
-
while (
|
|
500
|
+
while (!call_feasibility_restoration) {
|
|
456
501
|
trial_x = x + α * step.p_x;
|
|
457
502
|
trial_c_i = matrices.c_i(trial_x);
|
|
458
503
|
if (options.feasible_ipm && c_i.cwiseGreater(Scalar(0)).all()) {
|
|
@@ -477,7 +522,7 @@ ExitStatus ipm(const IPMMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
477
522
|
// Reduce step size
|
|
478
523
|
α *= α_reduction_factor;
|
|
479
524
|
|
|
480
|
-
if (α < α_min) {
|
|
525
|
+
if (α < α_min || α < α_tiny) {
|
|
481
526
|
call_feasibility_restoration = true;
|
|
482
527
|
break;
|
|
483
528
|
}
|
|
@@ -606,24 +651,17 @@ ExitStatus ipm(const IPMMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
606
651
|
}
|
|
607
652
|
|
|
608
653
|
// If the full step was rejected enough times in a row, reset the filter
|
|
609
|
-
//
|
|
610
|
-
|
|
611
|
-
// See section 3.2 case I of [2].
|
|
612
|
-
if (full_step_rejected_counter >= 4 &&
|
|
613
|
-
filter.max_constraint_violation >
|
|
614
|
-
current_entry.constraint_violation / Scalar(10) &&
|
|
615
|
-
filter.last_rejection_due_to_filter()) {
|
|
616
|
-
filter.max_constraint_violation *= Scalar(0.1);
|
|
617
|
-
filter.reset();
|
|
654
|
+
// if it may be impeding progress
|
|
655
|
+
if (full_step_rejected_counter >= 4 && filter.try_reset(current_entry)) {
|
|
618
656
|
continue;
|
|
619
657
|
}
|
|
620
658
|
|
|
621
659
|
// Reduce step size
|
|
622
660
|
α *= α_reduction_factor;
|
|
623
661
|
|
|
624
|
-
// If step size hit a minimum
|
|
625
|
-
// wasn't, invoke feasibility restoration.
|
|
626
|
-
if (α < α_min) {
|
|
662
|
+
// If step size hit a minimum or the step became negligible, check if the
|
|
663
|
+
// KKT error was reduced. If it wasn't, invoke feasibility restoration.
|
|
664
|
+
if (α < α_min || α < α_tiny) {
|
|
627
665
|
Scalar current_kkt_error = kkt_error<Scalar, KKTErrorType::ONE_NORM>(
|
|
628
666
|
g, A_e, c_e, A_i, c_i, s, y, z, μ);
|
|
629
667
|
|
|
@@ -640,11 +678,14 @@ ExitStatus ipm(const IPMMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
640
678
|
matrices.g(trial_x), matrices.A_e(trial_x), trial_c_e,
|
|
641
679
|
matrices.A_i(trial_x), trial_c_i, trial_s, trial_y, trial_z, μ);
|
|
642
680
|
|
|
643
|
-
// If the step using αᵐᵃˣ reduced the KKT error
|
|
644
|
-
|
|
681
|
+
// If the step using αᵐᵃˣ reduced the KKT error below the current
|
|
682
|
+
// iterate's and every previous fallback step's, accept it anyway
|
|
683
|
+
if (next_kkt_error <= Scalar(0.999) * std::min(current_kkt_error,
|
|
684
|
+
fallback_kkt_error) &&
|
|
645
685
|
constraint_violation(trial_c_e, trial_c_i, trial_s) <=
|
|
646
686
|
filter.max_constraint_violation) {
|
|
647
687
|
// Accept step
|
|
688
|
+
fallback_kkt_error = next_kkt_error;
|
|
648
689
|
α = α_max;
|
|
649
690
|
break;
|
|
650
691
|
}
|
|
@@ -676,6 +717,10 @@ ExitStatus ipm(const IPMMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
676
717
|
|
|
677
718
|
FilterEntry initial_entry{matrices.f(x), s, c_e, c_i, μ};
|
|
678
719
|
|
|
720
|
+
// Augment the filter with the current iterate so the normal phase can't
|
|
721
|
+
// return to it
|
|
722
|
+
filter.add(initial_entry);
|
|
723
|
+
|
|
679
724
|
feasibility_restoration_cycle_detector.record_entry(
|
|
680
725
|
initial_entry.constraint_violation);
|
|
681
726
|
const bool run_feasibility_restoration_to_convergence =
|
|
@@ -694,22 +739,24 @@ ExitStatus ipm(const IPMMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
694
739
|
|
|
695
740
|
DenseVector trial_x =
|
|
696
741
|
info.x.segment(0, matrices.num_decision_variables);
|
|
697
|
-
DenseVector trial_s =
|
|
698
|
-
info.s.segment(0, matrices.num_inequality_constraints);
|
|
699
742
|
|
|
700
743
|
DenseVector trial_c_e = matrices.c_e(trial_x);
|
|
701
744
|
DenseVector trial_c_i = matrices.c_i(trial_x);
|
|
702
745
|
|
|
746
|
+
// Feasibility restoration re-centers the slacks when it returns, so
|
|
747
|
+
// check the iterate the normal phase will resume from
|
|
748
|
+
DenseVector trial_s =
|
|
749
|
+
(trial_c_i.array() >= Scalar(1e-2))
|
|
750
|
+
.select(trial_c_i,
|
|
751
|
+
info.s.segment(0, matrices.num_inequality_constraints));
|
|
752
|
+
|
|
703
753
|
// If the current iterate sufficiently reduces constraint violation and
|
|
704
754
|
// is accepted by the normal filter, stop feasibility restoration
|
|
705
755
|
FilterEntry trial_entry{matrices.f(trial_x), trial_s, trial_c_e,
|
|
706
756
|
trial_c_i, μ};
|
|
707
|
-
const Scalar D_ϕ_restoration = g.transpose() * (trial_x - x) -
|
|
708
|
-
μ * s.cwiseInverse().dot(trial_s - s);
|
|
709
757
|
return trial_entry.constraint_violation <
|
|
710
758
|
Scalar(0.9) * initial_entry.constraint_violation &&
|
|
711
|
-
filter.
|
|
712
|
-
Scalar(1));
|
|
759
|
+
filter.is_acceptable(trial_entry);
|
|
713
760
|
});
|
|
714
761
|
auto status =
|
|
715
762
|
feasibility_restoration<Scalar>(matrices, callbacks, options,
|
|
@@ -726,6 +773,18 @@ ExitStatus ipm(const IPMMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
726
773
|
f = matrices.f(x);
|
|
727
774
|
c_e = matrices.c_e(x);
|
|
728
775
|
c_i = matrices.c_i(x);
|
|
776
|
+
|
|
777
|
+
// Resuming from an iterate the filter rejects would break the filter's
|
|
778
|
+
// convergence guarantee, and continuing feasibility restoration from its
|
|
779
|
+
// converged point would return that point again, so report failure.
|
|
780
|
+
//
|
|
781
|
+
// The returned iterate can be rejected because feasibility restoration
|
|
782
|
+
// stops at its own convergence tolerance instead of driving constraint
|
|
783
|
+
// violation to zero, so the filter can still hold entries with lower cost
|
|
784
|
+
// and constraint violation.
|
|
785
|
+
if (!filter.is_acceptable(FilterEntry{f, s, c_e, c_i, μ})) {
|
|
786
|
+
return ExitStatus::FEASIBILITY_RESTORATION_FAILED;
|
|
787
|
+
}
|
|
729
788
|
} else {
|
|
730
789
|
// If full step was accepted, reset full-step rejected counter
|
|
731
790
|
if (α == α_max) {
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
#pragma once
|
|
4
4
|
|
|
5
|
+
#include <algorithm>
|
|
5
6
|
#include <chrono>
|
|
6
7
|
#include <cmath>
|
|
7
8
|
#include <functional>
|
|
9
|
+
#include <limits>
|
|
8
10
|
#include <optional>
|
|
9
11
|
#include <span>
|
|
10
12
|
|
|
@@ -110,9 +112,13 @@ ExitStatus newton(
|
|
|
110
112
|
// Use sparse solver if lower triangle fills < 25% of system
|
|
111
113
|
H.nonZeros() < 0.25 * H.size(), matrices.num_decision_variables, 0};
|
|
112
114
|
|
|
113
|
-
//
|
|
115
|
+
// Step size reduction factor
|
|
114
116
|
constexpr Scalar α_reduction_factor(0.5);
|
|
115
|
-
|
|
117
|
+
|
|
118
|
+
// The smallest KKT error of a step accepted by the KKT error reduction
|
|
119
|
+
// fallback. Each fallback step must improve on it, so finitely many fallback
|
|
120
|
+
// steps are taken before the solver converges.
|
|
121
|
+
Scalar fallback_kkt_error = std::numeric_limits<Scalar>::infinity();
|
|
116
122
|
|
|
117
123
|
// Error
|
|
118
124
|
Scalar E_0 = unscaled_kkt_error<Scalar, KKTErrorType::INF_NORM_SCALED>(
|
|
@@ -157,10 +163,33 @@ ExitStatus newton(
|
|
|
157
163
|
|
|
158
164
|
constexpr Scalar α_max(1);
|
|
159
165
|
Scalar α = α_max;
|
|
166
|
+
const FilterEntry<Scalar> current_entry{f};
|
|
160
167
|
const Scalar D_ϕ = g.transpose() * p_x;
|
|
161
168
|
|
|
162
|
-
|
|
163
|
-
|
|
169
|
+
const Scalar α_min = filter.min_step_size(current_entry, D_ϕ);
|
|
170
|
+
|
|
171
|
+
// α_min is zero when the search direction is a descent direction, so also
|
|
172
|
+
// end the line search when the step becomes negligible relative to the
|
|
173
|
+
// iterate. This bounds the number of step size reductions.
|
|
174
|
+
//
|
|
175
|
+
// A step αpˣ is negligible if
|
|
176
|
+
//
|
|
177
|
+
// ‖αpˣ/(1 + |x|)‖_∞ < 10ε
|
|
178
|
+
//
|
|
179
|
+
// where the absolute value and division are elementwise. Since α > 0, it
|
|
180
|
+
// factors out of the norm.
|
|
181
|
+
//
|
|
182
|
+
// α‖pˣ/(1 + |x|)‖_∞ < 10ε
|
|
183
|
+
//
|
|
184
|
+
// Dividing both sides by the norm gives
|
|
185
|
+
//
|
|
186
|
+
// α < 10ε / ‖pˣ/(1 + |x|)‖_∞
|
|
187
|
+
const Scalar α_tiny = Scalar(10) * std::numeric_limits<Scalar>::epsilon() /
|
|
188
|
+
(p_x.array().abs() / (Scalar(1) + x.array().abs()))
|
|
189
|
+
.matrix()
|
|
190
|
+
.template lpNorm<Eigen::Infinity>();
|
|
191
|
+
|
|
192
|
+
// Loop until a step is accepted
|
|
164
193
|
while (1) {
|
|
165
194
|
trial_x = x + α * p_x;
|
|
166
195
|
|
|
@@ -171,14 +200,14 @@ ExitStatus newton(
|
|
|
171
200
|
// Reduce step size
|
|
172
201
|
α *= α_reduction_factor;
|
|
173
202
|
|
|
174
|
-
if (α < α_min) {
|
|
203
|
+
if (α < α_min || α < α_tiny) {
|
|
175
204
|
return ExitStatus::LINE_SEARCH_FAILED;
|
|
176
205
|
}
|
|
177
206
|
continue;
|
|
178
207
|
}
|
|
179
208
|
|
|
180
209
|
// Check whether filter accepts trial iterate
|
|
181
|
-
if (filter.try_add(
|
|
210
|
+
if (filter.try_add(current_entry, FilterEntry{trial_f}, D_ϕ, α)) {
|
|
182
211
|
// Accept step
|
|
183
212
|
break;
|
|
184
213
|
}
|
|
@@ -186,9 +215,9 @@ ExitStatus newton(
|
|
|
186
215
|
// Reduce step size
|
|
187
216
|
α *= α_reduction_factor;
|
|
188
217
|
|
|
189
|
-
// If step size hit a minimum
|
|
190
|
-
// wasn't, report
|
|
191
|
-
if (α < α_min) {
|
|
218
|
+
// If step size hit a minimum or the step became negligible, check if the
|
|
219
|
+
// KKT error was reduced. If it wasn't, report line search failure.
|
|
220
|
+
if (α < α_min || α < α_tiny) {
|
|
192
221
|
Scalar current_kkt_error = kkt_error<Scalar, KKTErrorType::ONE_NORM>(g);
|
|
193
222
|
|
|
194
223
|
trial_x = x + α_max * p_x;
|
|
@@ -198,9 +227,12 @@ ExitStatus newton(
|
|
|
198
227
|
Scalar next_kkt_error =
|
|
199
228
|
kkt_error<Scalar, KKTErrorType::ONE_NORM>(matrices.g(trial_x));
|
|
200
229
|
|
|
201
|
-
// If the step using αᵐᵃˣ reduced the KKT error
|
|
202
|
-
|
|
230
|
+
// If the step using αᵐᵃˣ reduced the KKT error below the current
|
|
231
|
+
// iterate's and every previous fallback step's, accept it anyway
|
|
232
|
+
if (next_kkt_error <=
|
|
233
|
+
Scalar(0.999) * std::min(current_kkt_error, fallback_kkt_error)) {
|
|
203
234
|
// Accept step
|
|
235
|
+
fallback_kkt_error = next_kkt_error;
|
|
204
236
|
α = α_max;
|
|
205
237
|
break;
|
|
206
238
|
}
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
#pragma once
|
|
4
4
|
|
|
5
|
+
#include <algorithm>
|
|
5
6
|
#include <chrono>
|
|
6
7
|
#include <cmath>
|
|
7
8
|
#include <functional>
|
|
9
|
+
#include <limits>
|
|
8
10
|
#include <optional>
|
|
9
11
|
#include <span>
|
|
10
12
|
|
|
@@ -120,6 +122,31 @@ ExitStatus sqp(const SQPMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
120
122
|
Scalar dual_inf_norm() const {
|
|
121
123
|
return p_y.template lpNorm<Eigen::Infinity>();
|
|
122
124
|
}
|
|
125
|
+
|
|
126
|
+
/// Returns the step size below which the primal step is negligible
|
|
127
|
+
/// relative to the iterate.
|
|
128
|
+
///
|
|
129
|
+
/// @param x The decision variables.
|
|
130
|
+
/// @return The step size below which the primal step is negligible
|
|
131
|
+
/// relative to the iterate.
|
|
132
|
+
Scalar tiny_step_size(const DenseVector& x) const {
|
|
133
|
+
// A primal step αpˣ is negligible if
|
|
134
|
+
//
|
|
135
|
+
// ‖αpˣ/(1 + |x|)‖_∞ < 10ε
|
|
136
|
+
//
|
|
137
|
+
// where the absolute value and division are elementwise. Since α > 0, it
|
|
138
|
+
// factors out of the norm.
|
|
139
|
+
//
|
|
140
|
+
// α‖pˣ/(1 + |x|)‖_∞ < 10ε
|
|
141
|
+
//
|
|
142
|
+
// Dividing both sides by the norm gives
|
|
143
|
+
//
|
|
144
|
+
// α < 10ε / ‖pˣ/(1 + |x|)‖_∞
|
|
145
|
+
return Scalar(10) * std::numeric_limits<Scalar>::epsilon() /
|
|
146
|
+
(p_x.array().abs() / (Scalar(1) + x.array().abs()))
|
|
147
|
+
.matrix()
|
|
148
|
+
.template lpNorm<Eigen::Infinity>();
|
|
149
|
+
}
|
|
123
150
|
};
|
|
124
151
|
|
|
125
152
|
using std::isfinite;
|
|
@@ -203,12 +230,16 @@ ExitStatus sqp(const SQPMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
203
230
|
H.nonZeros() + A_e.nonZeros() < 0.25 * lhs_rows * lhs_rows,
|
|
204
231
|
matrices.num_decision_variables, matrices.num_equality_constraints};
|
|
205
232
|
|
|
206
|
-
//
|
|
233
|
+
// Step size reduction factor
|
|
207
234
|
constexpr Scalar α_reduction_factor(0.5);
|
|
208
|
-
constexpr Scalar α_min(1e-7);
|
|
209
235
|
|
|
210
236
|
int full_step_rejected_counter = 0;
|
|
211
237
|
|
|
238
|
+
// The smallest KKT error of a step accepted by the KKT error reduction
|
|
239
|
+
// fallback. Each fallback step must improve on it, so finitely many fallback
|
|
240
|
+
// steps are taken before the solver converges.
|
|
241
|
+
Scalar fallback_kkt_error = std::numeric_limits<Scalar>::infinity();
|
|
242
|
+
|
|
212
243
|
StallDetector<Scalar> stall_detector;
|
|
213
244
|
|
|
214
245
|
FeasibilityRestorationCycleDetector<Scalar>
|
|
@@ -296,6 +327,13 @@ ExitStatus sqp(const SQPMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
296
327
|
const FilterEntry<Scalar> current_entry{f, c_e};
|
|
297
328
|
const Scalar D_ϕ = g.transpose() * step.p_x;
|
|
298
329
|
|
|
330
|
+
const Scalar α_min = filter.min_step_size(current_entry, D_ϕ);
|
|
331
|
+
|
|
332
|
+
// α_min can be zero (e.g., when the constraint violation is zero), so also
|
|
333
|
+
// end the line search when the step becomes negligible relative to the
|
|
334
|
+
// iterate. This bounds the number of step size reductions.
|
|
335
|
+
const Scalar α_tiny = step.tiny_step_size(x);
|
|
336
|
+
|
|
299
337
|
// Loop until a step is accepted
|
|
300
338
|
while (1) {
|
|
301
339
|
trial_x = x + α * step.p_x;
|
|
@@ -310,7 +348,7 @@ ExitStatus sqp(const SQPMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
310
348
|
// Reduce step size
|
|
311
349
|
α *= α_reduction_factor;
|
|
312
350
|
|
|
313
|
-
if (α < α_min) {
|
|
351
|
+
if (α < α_min || α < α_tiny) {
|
|
314
352
|
call_feasibility_restoration = true;
|
|
315
353
|
break;
|
|
316
354
|
}
|
|
@@ -417,24 +455,17 @@ ExitStatus sqp(const SQPMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
417
455
|
}
|
|
418
456
|
|
|
419
457
|
// If the full step was rejected enough times in a row, reset the filter
|
|
420
|
-
//
|
|
421
|
-
|
|
422
|
-
// See section 3.2 case I of [2].
|
|
423
|
-
if (full_step_rejected_counter >= 4 &&
|
|
424
|
-
filter.max_constraint_violation >
|
|
425
|
-
current_entry.constraint_violation / Scalar(10) &&
|
|
426
|
-
filter.last_rejection_due_to_filter()) {
|
|
427
|
-
filter.max_constraint_violation *= Scalar(0.1);
|
|
428
|
-
filter.reset();
|
|
458
|
+
// if it may be impeding progress
|
|
459
|
+
if (full_step_rejected_counter >= 4 && filter.try_reset(current_entry)) {
|
|
429
460
|
continue;
|
|
430
461
|
}
|
|
431
462
|
|
|
432
463
|
// Reduce step size
|
|
433
464
|
α *= α_reduction_factor;
|
|
434
465
|
|
|
435
|
-
// If step size hit a minimum
|
|
436
|
-
// wasn't, invoke feasibility restoration.
|
|
437
|
-
if (α < α_min) {
|
|
466
|
+
// If step size hit a minimum or the step became negligible, check if the
|
|
467
|
+
// KKT error was reduced. If it wasn't, invoke feasibility restoration.
|
|
468
|
+
if (α < α_min || α < α_tiny) {
|
|
438
469
|
Scalar current_kkt_error =
|
|
439
470
|
kkt_error<Scalar, KKTErrorType::ONE_NORM>(g, A_e, c_e, y);
|
|
440
471
|
|
|
@@ -447,11 +478,14 @@ ExitStatus sqp(const SQPMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
447
478
|
Scalar next_kkt_error = kkt_error<Scalar, KKTErrorType::ONE_NORM>(
|
|
448
479
|
matrices.g(trial_x), matrices.A_e(trial_x), trial_c_e, trial_y);
|
|
449
480
|
|
|
450
|
-
// If the step using αᵐᵃˣ reduced the KKT error
|
|
451
|
-
|
|
481
|
+
// If the step using αᵐᵃˣ reduced the KKT error below the current
|
|
482
|
+
// iterate's and every previous fallback step's, accept it anyway
|
|
483
|
+
if (next_kkt_error <= Scalar(0.999) * std::min(current_kkt_error,
|
|
484
|
+
fallback_kkt_error) &&
|
|
452
485
|
constraint_violation(trial_c_e) <=
|
|
453
486
|
filter.max_constraint_violation) {
|
|
454
487
|
// Accept step
|
|
488
|
+
fallback_kkt_error = next_kkt_error;
|
|
455
489
|
α = α_max;
|
|
456
490
|
break;
|
|
457
491
|
}
|
|
@@ -478,6 +512,10 @@ ExitStatus sqp(const SQPMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
478
512
|
|
|
479
513
|
FilterEntry initial_entry{matrices.f(x), c_e};
|
|
480
514
|
|
|
515
|
+
// Augment the filter with the current iterate so the normal phase can't
|
|
516
|
+
// return to it
|
|
517
|
+
filter.add(initial_entry);
|
|
518
|
+
|
|
481
519
|
feasibility_restoration_cycle_detector.record_entry(
|
|
482
520
|
initial_entry.constraint_violation);
|
|
483
521
|
const bool run_feasibility_restoration_to_convergence =
|
|
@@ -500,14 +538,12 @@ ExitStatus sqp(const SQPMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
500
538
|
DenseVector trial_c_e = matrices.c_e(trial_x);
|
|
501
539
|
|
|
502
540
|
FilterEntry trial_entry{matrices.f(trial_x), trial_c_e};
|
|
503
|
-
const Scalar D_ϕ_restoration = g.transpose() * (trial_x - x);
|
|
504
541
|
|
|
505
542
|
// If the current iterate sufficiently reduces constraint violation and
|
|
506
543
|
// is accepted by the normal filter, stop feasibility restoration
|
|
507
544
|
return trial_entry.constraint_violation <
|
|
508
545
|
Scalar(0.9) * initial_entry.constraint_violation &&
|
|
509
|
-
filter.
|
|
510
|
-
Scalar(1));
|
|
546
|
+
filter.is_acceptable(trial_entry);
|
|
511
547
|
});
|
|
512
548
|
auto status = feasibility_restoration<Scalar>(matrices, callbacks,
|
|
513
549
|
options, x, y, iterations);
|
|
@@ -519,6 +555,18 @@ ExitStatus sqp(const SQPMatrixCallbacks<Scalar>& matrix_callbacks,
|
|
|
519
555
|
|
|
520
556
|
f = matrices.f(x);
|
|
521
557
|
c_e = matrices.c_e(x);
|
|
558
|
+
|
|
559
|
+
// Resuming from an iterate the filter rejects would break the filter's
|
|
560
|
+
// convergence guarantee, and continuing feasibility restoration from its
|
|
561
|
+
// converged point would return that point again, so report failure.
|
|
562
|
+
//
|
|
563
|
+
// The returned iterate can be rejected because feasibility restoration
|
|
564
|
+
// stops at its own convergence tolerance instead of driving constraint
|
|
565
|
+
// violation to zero, so the filter can still hold entries with lower cost
|
|
566
|
+
// and constraint violation.
|
|
567
|
+
if (!filter.is_acceptable(FilterEntry{f, c_e})) {
|
|
568
|
+
return ExitStatus::FEASIBILITY_RESTORATION_FAILED;
|
|
569
|
+
}
|
|
522
570
|
} else {
|
|
523
571
|
// If full step was accepted, reset full-step rejected counter
|
|
524
572
|
if (α == α_max) {
|
|
@@ -678,15 +678,18 @@ ExitStatus feasibility_restoration(
|
|
|
678
678
|
const DenseVector s_old = s;
|
|
679
679
|
|
|
680
680
|
// Re-center the slacks on the original constraints cᵢ(x) if they're
|
|
681
|
-
// sufficiently feasible,
|
|
681
|
+
// sufficiently feasible, which zeroes their constraint violation.
|
|
682
|
+
// Otherwise, keep feasibility restoration's slacks.
|
|
682
683
|
//
|
|
683
|
-
//
|
|
684
|
-
//
|
|
685
|
-
//
|
|
686
|
-
//
|
|
687
|
-
//
|
|
684
|
+
// Note that those slacks can make Σ = S⁻¹Z and μS⁻¹e very large because
|
|
685
|
+
// fr_μ drives them toward 0 independently of μ, so they can end up much
|
|
686
|
+
// smaller than μ. We can't fix that by raising the slacks because the added
|
|
687
|
+
// constraint violation would make the filter reject more returned iterates.
|
|
688
|
+
//
|
|
689
|
+
// The normal phase's early-exit callback computes the slacks the same way,
|
|
690
|
+
// so the returned iterate is the one the filter accepted.
|
|
688
691
|
const DenseVector c_i = matrices.c_i(x);
|
|
689
|
-
s = (c_i.array() >= Scalar(1e-2)).select(c_i,
|
|
692
|
+
s = (c_i.array() >= Scalar(1e-2)).select(c_i, fr_s.segment(0, s.rows()));
|
|
690
693
|
|
|
691
694
|
// Reset the equality constraint duals since feasibility restoration didn't
|
|
692
695
|
// account for the cost function
|