sleipnirgroup-jormungandr 0.0.1.dev474__tar.gz → 0.0.1.dev476__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.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/CMakeLists.txt +24 -1
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/PKG-INFO +3 -2
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/README.md +2 -1
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/cmake/modules/Pybind11Mkdoc.cmake +10 -1
- {sleipnirgroup_jormungandr-0.0.1.dev474/src → sleipnirgroup_jormungandr-0.0.1.dev476/include}/.styleguide +1 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/autodiff/adjoint_expression_graph.hpp +6 -5
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/autodiff/expression.hpp +3 -2
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/autodiff/expression_graph.hpp +7 -5
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/autodiff/hessian.hpp +4 -4
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/autodiff/jacobian.hpp +4 -4
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/autodiff/variable.hpp +6 -6
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/autodiff/variable_matrix.hpp +7 -6
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/optimization/multistart.hpp +4 -3
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/optimization/problem.hpp +5 -5
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/optimization/solver/exit_status.hpp +11 -6
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/optimization/solver/interior_point.hpp +5 -1
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/util/pool.hpp +4 -3
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/docstrings.hpp +4 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/optimization/solver/bind_exit_status.cpp +2 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/optimization/nonlinear_problem_test.py +19 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/pyproject.toml +1 -1
- {sleipnirgroup_jormungandr-0.0.1.dev474/include → sleipnirgroup_jormungandr-0.0.1.dev476/src}/.styleguide +1 -4
- sleipnirgroup_jormungandr-0.0.1.dev476/src/optimization/bounds.hpp +220 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/optimization/problem.cpp +35 -16
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/optimization/solver/interior_point.cpp +12 -4
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/optimization/solver/newton.cpp +2 -1
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/optimization/solver/sqp.cpp +3 -3
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/optimization/solver/util/filter.hpp +2 -3
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/util/print_diagnostics.hpp +23 -4
- sleipnirgroup_jormungandr-0.0.1.dev474/include/sleipnir/util/small_vector.hpp +0 -4380
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/LICENSE.txt +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/SleipnirConfig.cmake.in +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/cmake/modules/BuildTypes.cmake +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/cmake/modules/CompilerFlags.cmake +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/cmake/modules/SubdirList.cmake +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/autodiff/expression_type.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/autodiff/gradient.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/autodiff/slice.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/autodiff/variable_block.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/control/ocp.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/optimization/solver/iteration_info.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/optimization/solver/newton.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/optimization/solver/options.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/optimization/solver/sqp.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/util/assert.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/util/concepts.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/util/function_ref.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/util/intrusive_shared_ptr.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/util/print.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/util/spy.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/include/sleipnir/util/symbol_exports.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/autodiff/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/control/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/autodiff/bind_expression_type.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/autodiff/bind_gradient.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/autodiff/bind_hessian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/autodiff/bind_jacobian.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/autodiff/bind_variable.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/autodiff/bind_variable_block.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/autodiff/bind_variable_matrix.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/binders.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/control/bind_ocp.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/main.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/optimization/bind_equality_constraints.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/optimization/bind_inequality_constraints.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/optimization/bind_problem.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/optimization/solver/bind_iteration_info.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/cpp/try_cast.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/optimization/__init__.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/autodiff/gradient_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/autodiff/hessian_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/autodiff/jacobian_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/autodiff/variable_matrix_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/autodiff/variable_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/cart_pole_util.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/control/cart_pole_ocp_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/control/differential_drive_ocp_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/control/flywheel_ocp_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/differential_drive_util.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/optimization/arm_on_elevator_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/optimization/cart_pole_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/optimization/constraints_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/optimization/decision_variable_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/optimization/differential_drive_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/optimization/double_integrator_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/optimization/exit_status_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/optimization/flywheel_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/optimization/linear_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/optimization/multistart_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/optimization/quadratic_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/optimization/trivial_problem_test.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/jormungandr/test/rk4.py +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/autodiff/variable_matrix.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/optimization/inertia.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/optimization/regularized_ldlt.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/optimization/solver/util/error_estimate.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/optimization/solver/util/fraction_to_the_boundary_rule.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/optimization/solver/util/is_locally_infeasible.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/optimization/solver/util/kkt_error.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/util/pool.cpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/util/scope_exit.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/util/scoped_profiler.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/util/setup_profiler.hpp +0 -0
- {sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/src/util/solve_profiler.hpp +0 -0
{sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/CMakeLists.txt
RENAMED
@@ -71,6 +71,11 @@ option(BUILD_BENCHMARKS "Build CasADi and Sleipnir benchmarks" OFF)
|
|
71
71
|
option(BUILD_EXAMPLES "Build examples" OFF)
|
72
72
|
option(BUILD_PYTHON "Build Python module" OFF)
|
73
73
|
option(DISABLE_DIAGNOSTICS "Disable diagnostics support at compile-time" OFF)
|
74
|
+
option(
|
75
|
+
ENABLE_BOUND_PROJECTION
|
76
|
+
"Enable projecting the state onto bound inequality constraints inside problem setup"
|
77
|
+
OFF
|
78
|
+
)
|
74
79
|
|
75
80
|
include(CompilerFlags)
|
76
81
|
|
@@ -104,6 +109,10 @@ if(DISABLE_DIAGNOSTICS)
|
|
104
109
|
target_compile_definitions(Sleipnir PUBLIC SLEIPNIR_DISABLE_DIAGNOSTICS)
|
105
110
|
endif()
|
106
111
|
|
112
|
+
if(ENABLE_BOUND_PROJECTION)
|
113
|
+
target_compile_definitions(Sleipnir PUBLIC SLEIPNIR_ENABLE_BOUND_PROJECTION)
|
114
|
+
endif()
|
115
|
+
|
107
116
|
# Eigen dependency
|
108
117
|
if(NOT USE_SYSTEM_EIGEN)
|
109
118
|
set(EIGEN_BUILD_CMAKE_PACKAGE TRUE)
|
@@ -120,6 +129,17 @@ endif()
|
|
120
129
|
|
121
130
|
target_link_libraries(Sleipnir PUBLIC Eigen3::Eigen)
|
122
131
|
|
132
|
+
# small_vector dependency
|
133
|
+
fetchcontent_declare(
|
134
|
+
small_vector
|
135
|
+
GIT_REPOSITORY https://github.com/gharveymn/small_vector.git
|
136
|
+
# main on 2025-05-15
|
137
|
+
GIT_TAG b19a9c477cad5e58f8aed59dbe9be1c30e4b9826
|
138
|
+
)
|
139
|
+
fetchcontent_makeavailable(small_vector)
|
140
|
+
|
141
|
+
target_link_libraries(Sleipnir PUBLIC small_vector)
|
142
|
+
|
123
143
|
if(BUILD_TESTING AND NOT CMAKE_CROSSCOMPILING)
|
124
144
|
# Catch2 dependency
|
125
145
|
fetchcontent_declare(
|
@@ -325,7 +345,10 @@ if(BUILD_PYTHON)
|
|
325
345
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
326
346
|
${CMAKE_CURRENT_SOURCE_DIR}/jormungandr/cpp
|
327
347
|
)
|
328
|
-
target_link_libraries(
|
348
|
+
target_link_libraries(
|
349
|
+
_jormungandr
|
350
|
+
PUBLIC Threads::Threads Eigen3::Eigen small_vector
|
351
|
+
)
|
329
352
|
|
330
353
|
# Suppress compiler warnings in nanobind
|
331
354
|
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sleipnirgroup-jormungandr
|
3
|
-
Version: 0.0.1.
|
3
|
+
Version: 0.0.1.dev476
|
4
4
|
Summary: A linearity-exploiting sparse nonlinear constrained optimization problem solver that uses the interior-point method.
|
5
5
|
License: Copyright (c) Sleipnir contributors
|
6
6
|
|
@@ -187,6 +187,7 @@ See the [examples](https://github.com/SleipnirGroup/Sleipnir/tree/main/examples)
|
|
187
187
|
* On Linux, install via `sudo apt install python`
|
188
188
|
* On macOS, install via `brew install python`
|
189
189
|
* [Eigen](https://gitlab.com/libeigen/eigen)
|
190
|
+
* [small_vector](https://github.com/gharveymn/small_vector)
|
190
191
|
* [nanobind](https://github.com/wjakob/nanobind) (build only)
|
191
192
|
* [Catch2](https://github.com/catchorg/Catch2) (tests only)
|
192
193
|
|
@@ -293,7 +294,7 @@ For quadratic problems, we compute the Lagrangian Hessian and constraint Jacobia
|
|
293
294
|
|
294
295
|
#### Use a performant linear algebra library with fast sparse solvers
|
295
296
|
|
296
|
-
[Eigen](https://gitlab.com/libeigen/eigen
|
297
|
+
[Eigen](https://gitlab.com/libeigen/eigen) provides these. It also has no required dependencies, which makes cross compilation much easier.
|
297
298
|
|
298
299
|
#### Use a pool allocator for autodiff expression nodes
|
299
300
|
|
@@ -165,6 +165,7 @@ See the [examples](https://github.com/SleipnirGroup/Sleipnir/tree/main/examples)
|
|
165
165
|
* On Linux, install via `sudo apt install python`
|
166
166
|
* On macOS, install via `brew install python`
|
167
167
|
* [Eigen](https://gitlab.com/libeigen/eigen)
|
168
|
+
* [small_vector](https://github.com/gharveymn/small_vector)
|
168
169
|
* [nanobind](https://github.com/wjakob/nanobind) (build only)
|
169
170
|
* [Catch2](https://github.com/catchorg/Catch2) (tests only)
|
170
171
|
|
@@ -271,7 +272,7 @@ For quadratic problems, we compute the Lagrangian Hessian and constraint Jacobia
|
|
271
272
|
|
272
273
|
#### Use a performant linear algebra library with fast sparse solvers
|
273
274
|
|
274
|
-
[Eigen](https://gitlab.com/libeigen/eigen
|
275
|
+
[Eigen](https://gitlab.com/libeigen/eigen) provides these. It also has no required dependencies, which makes cross compilation much easier.
|
275
276
|
|
276
277
|
#### Use a pool allocator for autodiff expression nodes
|
277
278
|
|
@@ -32,13 +32,22 @@ function(pybind11_mkdoc target headers)
|
|
32
32
|
list(FILTER eigen_dirs INCLUDE REGEX "\\$<BUILD_INTERFACE:.*>")
|
33
33
|
list(TRANSFORM eigen_dirs PREPEND "-I")
|
34
34
|
|
35
|
+
get_target_property(
|
36
|
+
small_vector_dirs
|
37
|
+
small_vector
|
38
|
+
INTERFACE_INCLUDE_DIRECTORIES
|
39
|
+
)
|
40
|
+
list(FILTER small_vector_dirs INCLUDE REGEX "\\$<BUILD_INTERFACE:.*>")
|
41
|
+
list(TRANSFORM small_vector_dirs PREPEND "-I")
|
42
|
+
|
35
43
|
add_custom_command(
|
36
44
|
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/jormungandr/cpp/docstrings.hpp
|
37
45
|
COMMAND
|
38
46
|
${env_vars} ${Python3_EXECUTABLE} -m pybind11_mkdoc ${headers} -o
|
39
47
|
${CMAKE_CURRENT_SOURCE_DIR}/jormungandr/cpp/docstrings.hpp
|
40
48
|
-I/usr/lib/clang/`clang++ --version | grep -E -o '[0-9]+' | head
|
41
|
-
-1`/include ${target_dirs} ${eigen_dirs}
|
49
|
+
-1`/include ${target_dirs} ${eigen_dirs} ${small_vector_dirs}
|
50
|
+
-std=c++23
|
42
51
|
DEPENDS ${headers}
|
43
52
|
USES_TERMINAL
|
44
53
|
)
|
@@ -6,11 +6,11 @@
|
|
6
6
|
#include <utility>
|
7
7
|
|
8
8
|
#include <Eigen/SparseCore>
|
9
|
+
#include <gch/small_vector.hpp>
|
9
10
|
|
10
11
|
#include "sleipnir/autodiff/expression_graph.hpp"
|
11
12
|
#include "sleipnir/autodiff/variable.hpp"
|
12
13
|
#include "sleipnir/autodiff/variable_matrix.hpp"
|
13
|
-
#include "sleipnir/util/small_vector.hpp"
|
14
14
|
|
15
15
|
namespace slp::detail {
|
16
16
|
|
@@ -101,8 +101,9 @@ class AdjointExpressionGraph {
|
|
101
101
|
* @param wrt Vector of variables with respect to which to compute the
|
102
102
|
* Jacobian.
|
103
103
|
*/
|
104
|
-
void append_adjoint_triplets(
|
105
|
-
|
104
|
+
void append_adjoint_triplets(
|
105
|
+
gch::small_vector<Eigen::Triplet<double>>& triplets, int row,
|
106
|
+
const VariableMatrix& wrt) const {
|
106
107
|
// Read docs/algorithms.md#Reverse_accumulation_automatic_differentiation
|
107
108
|
// for background on reverse accumulation automatic differentiation.
|
108
109
|
|
@@ -165,10 +166,10 @@ class AdjointExpressionGraph {
|
|
165
166
|
|
166
167
|
private:
|
167
168
|
// Topological sort of graph from parent to child
|
168
|
-
small_vector<Expression*> m_top_list;
|
169
|
+
gch::small_vector<Expression*> m_top_list;
|
169
170
|
|
170
171
|
// List that maps nodes to their respective column
|
171
|
-
small_vector<int> m_col_list;
|
172
|
+
gch::small_vector<int> m_col_list;
|
172
173
|
};
|
173
174
|
|
174
175
|
} // namespace slp::detail
|
@@ -11,10 +11,11 @@
|
|
11
11
|
#include <numbers>
|
12
12
|
#include <utility>
|
13
13
|
|
14
|
+
#include <gch/small_vector.hpp>
|
15
|
+
|
14
16
|
#include "sleipnir/autodiff/expression_type.hpp"
|
15
17
|
#include "sleipnir/util/intrusive_shared_ptr.hpp"
|
16
18
|
#include "sleipnir/util/pool.hpp"
|
17
|
-
#include "sleipnir/util/small_vector.hpp"
|
18
19
|
|
19
20
|
namespace slp::detail {
|
20
21
|
|
@@ -694,7 +695,7 @@ inline constexpr void dec_ref_count(Expression* expr) {
|
|
694
695
|
// Expression destructor when expr's refcount reaches zero can cause a stack
|
695
696
|
// overflow. Instead, we iterate over its children to decrement their
|
696
697
|
// refcounts and deallocate them.
|
697
|
-
small_vector<Expression*> stack;
|
698
|
+
gch::small_vector<Expression*> stack;
|
698
699
|
stack.emplace_back(expr);
|
699
700
|
|
700
701
|
while (!stack.empty()) {
|
@@ -4,8 +4,9 @@
|
|
4
4
|
|
5
5
|
#include <ranges>
|
6
6
|
|
7
|
+
#include <gch/small_vector.hpp>
|
8
|
+
|
7
9
|
#include "sleipnir/autodiff/expression.hpp"
|
8
|
-
#include "sleipnir/util/small_vector.hpp"
|
9
10
|
|
10
11
|
namespace slp::detail {
|
11
12
|
|
@@ -16,8 +17,9 @@ namespace slp::detail {
|
|
16
17
|
*
|
17
18
|
* @param root The root node of the expression.
|
18
19
|
*/
|
19
|
-
inline small_vector<Expression*> topological_sort(
|
20
|
-
|
20
|
+
inline gch::small_vector<Expression*> topological_sort(
|
21
|
+
const ExpressionPtr& root) {
|
22
|
+
gch::small_vector<Expression*> list;
|
21
23
|
|
22
24
|
// If the root type is a constant, Update() is a no-op, so there's no work
|
23
25
|
// to do
|
@@ -26,7 +28,7 @@ inline small_vector<Expression*> topological_sort(const ExpressionPtr& root) {
|
|
26
28
|
}
|
27
29
|
|
28
30
|
// Stack of nodes to explore
|
29
|
-
small_vector<Expression*> stack;
|
31
|
+
gch::small_vector<Expression*> stack;
|
30
32
|
|
31
33
|
// Enumerate incoming edges for each node via depth-first search
|
32
34
|
stack.emplace_back(root.get());
|
@@ -73,7 +75,7 @@ inline small_vector<Expression*> topological_sort(const ExpressionPtr& root) {
|
|
73
75
|
*
|
74
76
|
* @param list Topological sort of graph from parent to child.
|
75
77
|
*/
|
76
|
-
inline void update_values(const small_vector<Expression*>& list) {
|
78
|
+
inline void update_values(const gch::small_vector<Expression*>& list) {
|
77
79
|
// Traverse graph from child to parent and update values
|
78
80
|
for (auto& node : list | std::views::reverse) {
|
79
81
|
auto& lhs = node->args[0];
|
@@ -5,12 +5,12 @@
|
|
5
5
|
#include <utility>
|
6
6
|
|
7
7
|
#include <Eigen/SparseCore>
|
8
|
+
#include <gch/small_vector.hpp>
|
8
9
|
|
9
10
|
#include "sleipnir/autodiff/adjoint_expression_graph.hpp"
|
10
11
|
#include "sleipnir/autodiff/variable.hpp"
|
11
12
|
#include "sleipnir/autodiff/variable_matrix.hpp"
|
12
13
|
#include "sleipnir/util/concepts.hpp"
|
13
|
-
#include "sleipnir/util/small_vector.hpp"
|
14
14
|
#include "sleipnir/util/symbol_exports.hpp"
|
15
15
|
|
16
16
|
namespace slp {
|
@@ -154,16 +154,16 @@ class SLEIPNIR_DLLEXPORT Hessian {
|
|
154
154
|
VariableMatrix m_variables;
|
155
155
|
VariableMatrix m_wrt;
|
156
156
|
|
157
|
-
small_vector<detail::AdjointExpressionGraph> m_graphs;
|
157
|
+
gch::small_vector<detail::AdjointExpressionGraph> m_graphs;
|
158
158
|
|
159
159
|
Eigen::SparseMatrix<double> m_H{m_variables.rows(), m_wrt.rows()};
|
160
160
|
|
161
161
|
// Cached triplets for gradients of linear rows
|
162
|
-
small_vector<Eigen::Triplet<double>> m_cached_triplets;
|
162
|
+
gch::small_vector<Eigen::Triplet<double>> m_cached_triplets;
|
163
163
|
|
164
164
|
// List of row indices for nonlinear rows whose graients will be computed in
|
165
165
|
// Value()
|
166
|
-
small_vector<int> m_nonlinear_rows;
|
166
|
+
gch::small_vector<int> m_nonlinear_rows;
|
167
167
|
};
|
168
168
|
|
169
169
|
} // namespace slp
|
@@ -5,12 +5,12 @@
|
|
5
5
|
#include <utility>
|
6
6
|
|
7
7
|
#include <Eigen/SparseCore>
|
8
|
+
#include <gch/small_vector.hpp>
|
8
9
|
|
9
10
|
#include "sleipnir/autodiff/adjoint_expression_graph.hpp"
|
10
11
|
#include "sleipnir/autodiff/variable.hpp"
|
11
12
|
#include "sleipnir/autodiff/variable_matrix.hpp"
|
12
13
|
#include "sleipnir/util/concepts.hpp"
|
13
|
-
#include "sleipnir/util/small_vector.hpp"
|
14
14
|
#include "sleipnir/util/symbol_exports.hpp"
|
15
15
|
|
16
16
|
namespace slp {
|
@@ -143,16 +143,16 @@ class SLEIPNIR_DLLEXPORT Jacobian {
|
|
143
143
|
VariableMatrix m_variables;
|
144
144
|
VariableMatrix m_wrt;
|
145
145
|
|
146
|
-
small_vector<detail::AdjointExpressionGraph> m_graphs;
|
146
|
+
gch::small_vector<detail::AdjointExpressionGraph> m_graphs;
|
147
147
|
|
148
148
|
Eigen::SparseMatrix<double> m_J{m_variables.rows(), m_wrt.rows()};
|
149
149
|
|
150
150
|
// Cached triplets for gradients of linear rows
|
151
|
-
small_vector<Eigen::Triplet<double>> m_cached_triplets;
|
151
|
+
gch::small_vector<Eigen::Triplet<double>> m_cached_triplets;
|
152
152
|
|
153
153
|
// List of row indices for nonlinear rows whose graients will be computed in
|
154
154
|
// Value()
|
155
|
-
small_vector<int> m_nonlinear_rows;
|
155
|
+
gch::small_vector<int> m_nonlinear_rows;
|
156
156
|
};
|
157
157
|
|
158
158
|
} // namespace slp
|
@@ -11,12 +11,12 @@
|
|
11
11
|
#include <vector>
|
12
12
|
|
13
13
|
#include <Eigen/Core>
|
14
|
+
#include <gch/small_vector.hpp>
|
14
15
|
|
15
16
|
#include "sleipnir/autodiff/expression.hpp"
|
16
17
|
#include "sleipnir/autodiff/expression_graph.hpp"
|
17
18
|
#include "sleipnir/util/assert.hpp"
|
18
19
|
#include "sleipnir/util/concepts.hpp"
|
19
|
-
#include "sleipnir/util/small_vector.hpp"
|
20
20
|
#include "sleipnir/util/symbol_exports.hpp"
|
21
21
|
|
22
22
|
#ifndef SLEIPNIR_DISABLE_DIAGNOSTICS
|
@@ -256,7 +256,7 @@ class SLEIPNIR_DLLEXPORT Variable {
|
|
256
256
|
|
257
257
|
/// Used to update the value of this variable based on the values of its
|
258
258
|
/// dependent variables
|
259
|
-
small_vector<detail::Expression*> m_graph;
|
259
|
+
gch::small_vector<detail::Expression*> m_graph;
|
260
260
|
|
261
261
|
/// Used for lazy initialization of m_graph
|
262
262
|
bool m_graph_initialized = false;
|
@@ -495,8 +495,8 @@ template <typename LHS, typename RHS>
|
|
495
495
|
requires(ScalarLike<LHS> || MatrixLike<LHS>) &&
|
496
496
|
(ScalarLike<RHS> || MatrixLike<RHS>) &&
|
497
497
|
(SleipnirType<LHS> || SleipnirType<RHS>)
|
498
|
-
small_vector<Variable> make_constraints(LHS&& lhs, RHS&& rhs) {
|
499
|
-
small_vector<Variable> constraints;
|
498
|
+
gch::small_vector<Variable> make_constraints(LHS&& lhs, RHS&& rhs) {
|
499
|
+
gch::small_vector<Variable> constraints;
|
500
500
|
|
501
501
|
if constexpr (ScalarLike<LHS> && ScalarLike<RHS>) {
|
502
502
|
constraints.emplace_back(lhs - rhs);
|
@@ -558,7 +558,7 @@ small_vector<Variable> make_constraints(LHS&& lhs, RHS&& rhs) {
|
|
558
558
|
*/
|
559
559
|
struct SLEIPNIR_DLLEXPORT EqualityConstraints {
|
560
560
|
/// A vector of scalar equality constraints.
|
561
|
-
small_vector<Variable> constraints;
|
561
|
+
gch::small_vector<Variable> constraints;
|
562
562
|
|
563
563
|
/**
|
564
564
|
* Concatenates multiple equality constraints.
|
@@ -619,7 +619,7 @@ struct SLEIPNIR_DLLEXPORT EqualityConstraints {
|
|
619
619
|
*/
|
620
620
|
struct SLEIPNIR_DLLEXPORT InequalityConstraints {
|
621
621
|
/// A vector of scalar inequality constraints.
|
622
|
-
small_vector<Variable> constraints;
|
622
|
+
gch::small_vector<Variable> constraints;
|
623
623
|
|
624
624
|
/**
|
625
625
|
* Concatenates multiple inequality constraints.
|
@@ -11,6 +11,7 @@
|
|
11
11
|
#include <vector>
|
12
12
|
|
13
13
|
#include <Eigen/Core>
|
14
|
+
#include <gch/small_vector.hpp>
|
14
15
|
|
15
16
|
#include "sleipnir/autodiff/slice.hpp"
|
16
17
|
#include "sleipnir/autodiff/variable.hpp"
|
@@ -18,7 +19,6 @@
|
|
18
19
|
#include "sleipnir/util/assert.hpp"
|
19
20
|
#include "sleipnir/util/concepts.hpp"
|
20
21
|
#include "sleipnir/util/function_ref.hpp"
|
21
|
-
#include "sleipnir/util/small_vector.hpp"
|
22
22
|
#include "sleipnir/util/symbol_exports.hpp"
|
23
23
|
|
24
24
|
namespace slp {
|
@@ -1029,7 +1029,8 @@ class SLEIPNIR_DLLEXPORT VariableMatrix {
|
|
1029
1029
|
|
1030
1030
|
constexpr iterator() noexcept = default;
|
1031
1031
|
|
1032
|
-
explicit constexpr iterator(
|
1032
|
+
explicit constexpr iterator(
|
1033
|
+
gch::small_vector<Variable>::iterator it) noexcept
|
1033
1034
|
: m_it{it} {}
|
1034
1035
|
|
1035
1036
|
constexpr iterator& operator++() noexcept {
|
@@ -1048,7 +1049,7 @@ class SLEIPNIR_DLLEXPORT VariableMatrix {
|
|
1048
1049
|
constexpr reference operator*() const noexcept { return *m_it; }
|
1049
1050
|
|
1050
1051
|
private:
|
1051
|
-
small_vector<Variable>::iterator m_it;
|
1052
|
+
gch::small_vector<Variable>::iterator m_it;
|
1052
1053
|
};
|
1053
1054
|
|
1054
1055
|
class const_iterator {
|
@@ -1062,7 +1063,7 @@ class SLEIPNIR_DLLEXPORT VariableMatrix {
|
|
1062
1063
|
constexpr const_iterator() noexcept = default;
|
1063
1064
|
|
1064
1065
|
explicit constexpr const_iterator(
|
1065
|
-
small_vector<Variable>::const_iterator it) noexcept
|
1066
|
+
gch::small_vector<Variable>::const_iterator it) noexcept
|
1066
1067
|
: m_it{it} {}
|
1067
1068
|
|
1068
1069
|
constexpr const_iterator& operator++() noexcept {
|
@@ -1081,7 +1082,7 @@ class SLEIPNIR_DLLEXPORT VariableMatrix {
|
|
1081
1082
|
constexpr const_reference operator*() const noexcept { return *m_it; }
|
1082
1083
|
|
1083
1084
|
private:
|
1084
|
-
small_vector<Variable>::const_iterator m_it;
|
1085
|
+
gch::small_vector<Variable>::const_iterator m_it;
|
1085
1086
|
};
|
1086
1087
|
|
1087
1088
|
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
@@ -1170,7 +1171,7 @@ class SLEIPNIR_DLLEXPORT VariableMatrix {
|
|
1170
1171
|
}
|
1171
1172
|
|
1172
1173
|
private:
|
1173
|
-
small_vector<Variable> m_storage;
|
1174
|
+
gch::small_vector<Variable> m_storage;
|
1174
1175
|
int m_rows = 0;
|
1175
1176
|
int m_cols = 0;
|
1176
1177
|
};
|
@@ -6,9 +6,10 @@
|
|
6
6
|
#include <future>
|
7
7
|
#include <span>
|
8
8
|
|
9
|
+
#include <gch/small_vector.hpp>
|
10
|
+
|
9
11
|
#include "sleipnir/optimization/solver/exit_status.hpp"
|
10
12
|
#include "sleipnir/util/function_ref.hpp"
|
11
|
-
#include "sleipnir/util/small_vector.hpp"
|
12
13
|
|
13
14
|
namespace slp {
|
14
15
|
|
@@ -48,14 +49,14 @@ MultistartResult<DecisionVariables> Multistart(
|
|
48
49
|
const DecisionVariables& initial_guess)>
|
49
50
|
solve,
|
50
51
|
std::span<const DecisionVariables> initial_guesses) {
|
51
|
-
small_vector<std::future<MultistartResult<DecisionVariables>>> futures;
|
52
|
+
gch::small_vector<std::future<MultistartResult<DecisionVariables>>> futures;
|
52
53
|
futures.reserve(initial_guesses.size());
|
53
54
|
|
54
55
|
for (const auto& initial_guess : initial_guesses) {
|
55
56
|
futures.emplace_back(std::async(std::launch::async, solve, initial_guess));
|
56
57
|
}
|
57
58
|
|
58
|
-
small_vector<MultistartResult<DecisionVariables>> results;
|
59
|
+
gch::small_vector<MultistartResult<DecisionVariables>> results;
|
59
60
|
results.reserve(futures.size());
|
60
61
|
|
61
62
|
for (auto& future : futures) {
|
@@ -11,6 +11,7 @@
|
|
11
11
|
#include <utility>
|
12
12
|
|
13
13
|
#include <Eigen/Core>
|
14
|
+
#include <gch/small_vector.hpp>
|
14
15
|
|
15
16
|
#include "sleipnir/autodiff/expression_type.hpp"
|
16
17
|
#include "sleipnir/autodiff/variable.hpp"
|
@@ -18,7 +19,6 @@
|
|
18
19
|
#include "sleipnir/optimization/solver/exit_status.hpp"
|
19
20
|
#include "sleipnir/optimization/solver/iteration_info.hpp"
|
20
21
|
#include "sleipnir/optimization/solver/options.hpp"
|
21
|
-
#include "sleipnir/util/small_vector.hpp"
|
22
22
|
#include "sleipnir/util/symbol_exports.hpp"
|
23
23
|
|
24
24
|
namespace slp {
|
@@ -320,19 +320,19 @@ class SLEIPNIR_DLLEXPORT Problem {
|
|
320
320
|
private:
|
321
321
|
// The list of decision variables, which are the root of the problem's
|
322
322
|
// expression tree
|
323
|
-
small_vector<Variable> m_decision_variables;
|
323
|
+
gch::small_vector<Variable> m_decision_variables;
|
324
324
|
|
325
325
|
// The cost function: f(x)
|
326
326
|
std::optional<Variable> m_f;
|
327
327
|
|
328
328
|
// The list of equality constraints: cₑ(x) = 0
|
329
|
-
small_vector<Variable> m_equality_constraints;
|
329
|
+
gch::small_vector<Variable> m_equality_constraints;
|
330
330
|
|
331
331
|
// The list of inequality constraints: cᵢ(x) ≥ 0
|
332
|
-
small_vector<Variable> m_inequality_constraints;
|
332
|
+
gch::small_vector<Variable> m_inequality_constraints;
|
333
333
|
|
334
334
|
// The iteration callbacks
|
335
|
-
small_vector<std::function<bool(const IterationInfo& info)>>
|
335
|
+
gch::small_vector<std::function<bool(const IterationInfo& info)>>
|
336
336
|
m_iteration_callbacks;
|
337
337
|
|
338
338
|
void print_exit_conditions([[maybe_unused]] const Options& options);
|
@@ -22,21 +22,24 @@ enum class ExitStatus : int8_t {
|
|
22
22
|
TOO_FEW_DOFS = -1,
|
23
23
|
/// The solver determined the problem to be locally infeasible and gave up.
|
24
24
|
LOCALLY_INFEASIBLE = -2,
|
25
|
+
/// The problem setup frontend determined the problem to have an empty
|
26
|
+
/// feasible region.
|
27
|
+
GLOBALLY_INFEASIBLE = -3,
|
25
28
|
/// The linear system factorization failed.
|
26
|
-
FACTORIZATION_FAILED = -
|
29
|
+
FACTORIZATION_FAILED = -4,
|
27
30
|
/// The backtracking line search failed, and the problem isn't locally
|
28
31
|
/// infeasible.
|
29
|
-
LINE_SEARCH_FAILED = -
|
32
|
+
LINE_SEARCH_FAILED = -5,
|
30
33
|
/// The solver encountered nonfinite initial cost or constraints and gave up.
|
31
|
-
NONFINITE_INITIAL_COST_OR_CONSTRAINTS = -
|
34
|
+
NONFINITE_INITIAL_COST_OR_CONSTRAINTS = -6,
|
32
35
|
/// The solver encountered diverging primal iterates xₖ and/or sₖ and gave up.
|
33
|
-
DIVERGING_ITERATES = -
|
36
|
+
DIVERGING_ITERATES = -7,
|
34
37
|
/// The solver returned its solution so far after exceeding the maximum number
|
35
38
|
/// of iterations.
|
36
|
-
MAX_ITERATIONS_EXCEEDED = -
|
39
|
+
MAX_ITERATIONS_EXCEEDED = -8,
|
37
40
|
/// The solver returned its solution so far after exceeding the maximum
|
38
41
|
/// elapsed wall clock time.
|
39
|
-
TIMEOUT = -
|
42
|
+
TIMEOUT = -9,
|
40
43
|
};
|
41
44
|
|
42
45
|
/**
|
@@ -57,6 +60,8 @@ SLEIPNIR_DLLEXPORT constexpr std::string_view to_message(
|
|
57
60
|
return "too few degrees of freedom";
|
58
61
|
case LOCALLY_INFEASIBLE:
|
59
62
|
return "locally infeasible";
|
63
|
+
case GLOBALLY_INFEASIBLE:
|
64
|
+
return "globally infeasible";
|
60
65
|
case FACTORIZATION_FAILED:
|
61
66
|
return "factorization failed";
|
62
67
|
case LINE_SEARCH_FAILED:
|
@@ -223,6 +223,10 @@ SLEIPNIR_DLLEXPORT ExitStatus
|
|
223
223
|
interior_point(const InteriorPointMatrixCallbacks& matrix_callbacks,
|
224
224
|
std::span<std::function<bool(const IterationInfo& info)>>
|
225
225
|
iteration_callbacks,
|
226
|
-
const Options& options,
|
226
|
+
const Options& options,
|
227
|
+
#ifdef SLEIPNIR_ENABLE_BOUND_PROJECTION
|
228
|
+
const Eigen::ArrayX<bool>& bound_constraint_mask,
|
229
|
+
#endif
|
230
|
+
Eigen::VectorXd& x);
|
227
231
|
|
228
232
|
} // namespace slp
|
@@ -5,7 +5,8 @@
|
|
5
5
|
#include <cstddef>
|
6
6
|
#include <memory>
|
7
7
|
|
8
|
-
#include
|
8
|
+
#include <gch/small_vector.hpp>
|
9
|
+
|
9
10
|
#include "sleipnir/util/symbol_exports.hpp"
|
10
11
|
|
11
12
|
namespace slp {
|
@@ -103,8 +104,8 @@ class SLEIPNIR_DLLEXPORT PoolResource {
|
|
103
104
|
}
|
104
105
|
|
105
106
|
private:
|
106
|
-
small_vector<std::unique_ptr<std::byte[]>> m_buffer;
|
107
|
-
small_vector<void*> m_free_list;
|
107
|
+
gch::small_vector<std::unique_ptr<std::byte[]>> m_buffer;
|
108
|
+
gch::small_vector<void*> m_free_list;
|
108
109
|
size_t blocks_per_chunk;
|
109
110
|
|
110
111
|
/**
|
@@ -78,6 +78,10 @@ up.)doc";
|
|
78
78
|
|
79
79
|
static const char *__doc_slp_ExitStatus_FACTORIZATION_FAILED = R"doc(The linear system factorization failed.)doc";
|
80
80
|
|
81
|
+
static const char *__doc_slp_ExitStatus_GLOBALLY_INFEASIBLE =
|
82
|
+
R"doc(The problem setup frontend determined the problem to have an empty
|
83
|
+
feasible region.)doc";
|
84
|
+
|
81
85
|
static const char *__doc_slp_ExitStatus_LINE_SEARCH_FAILED =
|
82
86
|
R"doc(The backtracking line search failed, and the problem isn't locally
|
83
87
|
infeasible.)doc";
|
@@ -17,6 +17,8 @@ void bind_exit_status(nb::enum_<ExitStatus>& e) {
|
|
17
17
|
DOC(slp, ExitStatus, TOO_FEW_DOFS));
|
18
18
|
e.value("LOCALLY_INFEASIBLE", ExitStatus::LOCALLY_INFEASIBLE,
|
19
19
|
DOC(slp, ExitStatus, LOCALLY_INFEASIBLE));
|
20
|
+
e.value("GLOBALLY_INFEASIBLE", ExitStatus::GLOBALLY_INFEASIBLE,
|
21
|
+
DOC(slp, ExitStatus, GLOBALLY_INFEASIBLE));
|
20
22
|
e.value("FACTORIZATION_FAILED", ExitStatus::FACTORIZATION_FAILED,
|
21
23
|
DOC(slp, ExitStatus, FACTORIZATION_FAILED));
|
22
24
|
e.value("LINE_SEARCH_FAILED", ExitStatus::LINE_SEARCH_FAILED,
|
@@ -116,6 +116,25 @@ def test_minimum_2d_distance_with_linear_constraint():
|
|
116
116
|
assert y.value() == pytest.approx(2.5, abs=1e-2)
|
117
117
|
|
118
118
|
|
119
|
+
def test_conflicting_bounds():
|
120
|
+
problem = Problem()
|
121
|
+
|
122
|
+
x = problem.decision_variable()
|
123
|
+
y = problem.decision_variable()
|
124
|
+
|
125
|
+
problem.minimize(autodiff.hypot(x, y))
|
126
|
+
|
127
|
+
problem.subject_to(autodiff.hypot(x, y) <= 1)
|
128
|
+
problem.subject_to(x >= 0.5)
|
129
|
+
problem.subject_to(x <= -0.5)
|
130
|
+
|
131
|
+
assert problem.cost_function_type() == ExpressionType.NONLINEAR
|
132
|
+
assert problem.equality_constraint_type() == ExpressionType.NONE
|
133
|
+
assert problem.inequality_constraint_type() == ExpressionType.NONLINEAR
|
134
|
+
|
135
|
+
assert problem.solve(diagnostics=True) == ExitStatus.GLOBALLY_INFEASIBLE
|
136
|
+
|
137
|
+
|
119
138
|
def test_wachter_and_biegler_line_search_failure():
|
120
139
|
# See example 19.2 of [1]
|
121
140
|
|
{sleipnirgroup_jormungandr-0.0.1.dev474 → sleipnirgroup_jormungandr-0.0.1.dev476}/pyproject.toml
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
[project]
|
2
2
|
name = "sleipnirgroup-jormungandr"
|
3
3
|
description = "A linearity-exploiting sparse nonlinear constrained optimization problem solver that uses the interior-point method."
|
4
|
-
version = "0.0.1.
|
4
|
+
version = "0.0.1.dev476"
|
5
5
|
readme = "README.md"
|
6
6
|
requires-python = ">=3.9"
|
7
7
|
dependencies = [ "matplotlib", "numpy", "scipy" ]
|