Reverse mode autodiff library and NLP solver DSL
Project description
Sleipnir
Sparsity and Linearity-Exploiting Interior-Point solver - Now Internally Readable
Named after Odin's eight-legged horse from Norse mythology, Sleipnir is a reverse mode autodiff library, interior-point method, and NLP solver DSL for C++23 and Python. The DSL automatically chooses the best solver based on the problem structure.
#include <print>
#include <sleipnir/optimization/problem.hpp>
int main() {
// Find the x, y pair with the largest product for which x + 3y = 36
slp::Problem<double> problem;
auto x = problem.decision_variable();
auto y = problem.decision_variable();
problem.maximize(x * y);
problem.subject_to(x + 3 * y == 36);
problem.solve();
// x = 18.0, y = 6.0
std::println("x = {}, y = {}", x.value(), y.value());
}
#!/usr/bin/env python3
from sleipnir.optimization import Problem
def main():
# Find the x, y pair with the largest product for which x + 3y = 36
problem = Problem()
x, y = problem.decision_variable(2)
problem.maximize(x * y)
problem.subject_to(x + 3 * y == 36)
problem.solve()
# x = 18.0, y = 6.0
print(f"x = {x.value()}, y = {y.value()}")
if __name__ == "__main__":
main()
The C++ API also supports arbitrary scalar types, so users can specify higher precision floating-point types at the cost of speed.
Sleipnir's internals are intended to be readable by those who aren't domain experts with links to explanatory material for its algorithms.
Install
The following platforms are supported:
- Windows
- OS: Windows 11
- Runtime: Microsoft Visual C++ 2022 redistributable from Visual Studio 2022 17.13
- Linux
- OS: Ubuntu 24.04
- Runtime: GCC 14 libstdc++ (run
sudo apt install g++-14)
- macOS
- OS: macOS 14.5
- Runtime: Apple Clang 16.0.0 libc++ from Xcode 16.2 (run
xcode-select --install)
To use Sleipnir within a CMake project, add the following to CMakeLists.txt:
include(FetchContent)
FetchContent_Declare(
Sleipnir
GIT_REPOSITORY https://github.com/SleipnirGroup/Sleipnir.git
GIT_TAG main
EXCLUDE_FROM_ALL
SYSTEM
)
FetchContent_MakeAvailable(Sleipnir)
target_link_libraries(MyApp PUBLIC Sleipnir::Sleipnir)
To use Sleipnir in Python, install sleipnirgroup-jormungandr from PyPI:
pip install sleipnirgroup-jormungandr
If necessary, follow these instructions to build from source.
Docs
See the C++ API docs, Python API docs, and usage docs.
Examples
See the examples folder, C++ optimization unit tests, and Python optimization unit tests.
Benchmarks
See the benchmarks folder.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sleipnirgroup_jormungandr-0.5.0.tar.gz.
File metadata
- Download URL: sleipnirgroup_jormungandr-0.5.0.tar.gz
- Upload date:
- Size: 120.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edc3bcfbd366fc7837af80ac93604c05c4d0e68ebaea1a7913cc385495276408
|
|
| MD5 |
78d11516cab3fd768be1be24671de32d
|
|
| BLAKE2b-256 |
6b66a0cc8872272742b481c53bf437ee0834483048f3a4c698f8b32856a6847a
|
Provenance
The following attestation bundles were made for sleipnirgroup_jormungandr-0.5.0.tar.gz:
Publisher:
python.yml on SleipnirGroup/Sleipnir
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sleipnirgroup_jormungandr-0.5.0.tar.gz -
Subject digest:
edc3bcfbd366fc7837af80ac93604c05c4d0e68ebaea1a7913cc385495276408 - Sigstore transparency entry: 1195440487
- Sigstore integration time:
-
Permalink:
SleipnirGroup/Sleipnir@aa819e8eb68adf998248f4d5b0f9973c794d5aa9 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/SleipnirGroup
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@aa819e8eb68adf998248f4d5b0f9973c794d5aa9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sleipnirgroup_jormungandr-0.5.0-cp312-abi3-win_arm64.whl.
File metadata
- Download URL: sleipnirgroup_jormungandr-0.5.0-cp312-abi3-win_arm64.whl
- Upload date:
- Size: 511.8 kB
- Tags: CPython 3.12+, Windows ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4243f15191480c18686853b97c3aa6119fc01183eb8165b5a07379f4374ae70e
|
|
| MD5 |
7d041114878d38114850ff90f15f3d06
|
|
| BLAKE2b-256 |
305f198d2a689fe62f7f39791e48ad35fb45b0cc9f0f78b18b6a3fdbb55524c0
|
Provenance
The following attestation bundles were made for sleipnirgroup_jormungandr-0.5.0-cp312-abi3-win_arm64.whl:
Publisher:
python.yml on SleipnirGroup/Sleipnir
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sleipnirgroup_jormungandr-0.5.0-cp312-abi3-win_arm64.whl -
Subject digest:
4243f15191480c18686853b97c3aa6119fc01183eb8165b5a07379f4374ae70e - Sigstore transparency entry: 1195440722
- Sigstore integration time:
-
Permalink:
SleipnirGroup/Sleipnir@aa819e8eb68adf998248f4d5b0f9973c794d5aa9 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/SleipnirGroup
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@aa819e8eb68adf998248f4d5b0f9973c794d5aa9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sleipnirgroup_jormungandr-0.5.0-cp312-abi3-win_amd64.whl.
File metadata
- Download URL: sleipnirgroup_jormungandr-0.5.0-cp312-abi3-win_amd64.whl
- Upload date:
- Size: 542.0 kB
- Tags: CPython 3.12+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4a1335575478337faa480f08f44ca962674d99d3f499b56bcd86c2ec43e6e2e
|
|
| MD5 |
34b879f7a85963ad9fbcc54d40fdd4f6
|
|
| BLAKE2b-256 |
32d2f060f4384e4815264aa86d402d01d76d100ed5c873d956d5ad88c69d608f
|
Provenance
The following attestation bundles were made for sleipnirgroup_jormungandr-0.5.0-cp312-abi3-win_amd64.whl:
Publisher:
python.yml on SleipnirGroup/Sleipnir
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sleipnirgroup_jormungandr-0.5.0-cp312-abi3-win_amd64.whl -
Subject digest:
a4a1335575478337faa480f08f44ca962674d99d3f499b56bcd86c2ec43e6e2e - Sigstore transparency entry: 1195440808
- Sigstore integration time:
-
Permalink:
SleipnirGroup/Sleipnir@aa819e8eb68adf998248f4d5b0f9973c794d5aa9 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/SleipnirGroup
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@aa819e8eb68adf998248f4d5b0f9973c794d5aa9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sleipnirgroup_jormungandr-0.5.0-cp312-abi3-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: sleipnirgroup_jormungandr-0.5.0-cp312-abi3-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 490.9 kB
- Tags: CPython 3.12+, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e65326fe1955424e325dc8657d2daca58e32a04cd5d594b12726d79bcf60b31d
|
|
| MD5 |
9a21d3251f59491cb67add9c55972b91
|
|
| BLAKE2b-256 |
5c1f339685428fedc3d2128c70dfceb1d49db820ccfc866a557df60bc088faa5
|
Provenance
The following attestation bundles were made for sleipnirgroup_jormungandr-0.5.0-cp312-abi3-manylinux_2_39_x86_64.whl:
Publisher:
python.yml on SleipnirGroup/Sleipnir
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sleipnirgroup_jormungandr-0.5.0-cp312-abi3-manylinux_2_39_x86_64.whl -
Subject digest:
e65326fe1955424e325dc8657d2daca58e32a04cd5d594b12726d79bcf60b31d - Sigstore transparency entry: 1195440633
- Sigstore integration time:
-
Permalink:
SleipnirGroup/Sleipnir@aa819e8eb68adf998248f4d5b0f9973c794d5aa9 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/SleipnirGroup
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@aa819e8eb68adf998248f4d5b0f9973c794d5aa9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sleipnirgroup_jormungandr-0.5.0-cp312-abi3-manylinux_2_39_aarch64.whl.
File metadata
- Download URL: sleipnirgroup_jormungandr-0.5.0-cp312-abi3-manylinux_2_39_aarch64.whl
- Upload date:
- Size: 447.9 kB
- Tags: CPython 3.12+, manylinux: glibc 2.39+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12e589f130955ac4000f5bff361110b96ab7a00c3266181945f776ec0ce3802a
|
|
| MD5 |
8665690021a8d70d6310c3ec6b48ed20
|
|
| BLAKE2b-256 |
d07ab329b9c0862a73ac23b310636785d78821c39c4399ace3c801055c56b747
|
Provenance
The following attestation bundles were made for sleipnirgroup_jormungandr-0.5.0-cp312-abi3-manylinux_2_39_aarch64.whl:
Publisher:
python.yml on SleipnirGroup/Sleipnir
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sleipnirgroup_jormungandr-0.5.0-cp312-abi3-manylinux_2_39_aarch64.whl -
Subject digest:
12e589f130955ac4000f5bff361110b96ab7a00c3266181945f776ec0ce3802a - Sigstore transparency entry: 1195440911
- Sigstore integration time:
-
Permalink:
SleipnirGroup/Sleipnir@aa819e8eb68adf998248f4d5b0f9973c794d5aa9 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/SleipnirGroup
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@aa819e8eb68adf998248f4d5b0f9973c794d5aa9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sleipnirgroup_jormungandr-0.5.0-cp312-abi3-macosx_14_0_universal2.whl.
File metadata
- Download URL: sleipnirgroup_jormungandr-0.5.0-cp312-abi3-macosx_14_0_universal2.whl
- Upload date:
- Size: 914.4 kB
- Tags: CPython 3.12+, macOS 14.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5c9edd9f1d428151245b5105cc594a970ea604c6fc144c16d95ec61a8c6182f
|
|
| MD5 |
8fd1f9281099e814830863afd918dc8b
|
|
| BLAKE2b-256 |
d8eb2d8c67d7bddea34e08b558324183ee7aaf60b02ec769584bf5804da1fb03
|
Provenance
The following attestation bundles were made for sleipnirgroup_jormungandr-0.5.0-cp312-abi3-macosx_14_0_universal2.whl:
Publisher:
python.yml on SleipnirGroup/Sleipnir
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sleipnirgroup_jormungandr-0.5.0-cp312-abi3-macosx_14_0_universal2.whl -
Subject digest:
a5c9edd9f1d428151245b5105cc594a970ea604c6fc144c16d95ec61a8c6182f - Sigstore transparency entry: 1195441058
- Sigstore integration time:
-
Permalink:
SleipnirGroup/Sleipnir@aa819e8eb68adf998248f4d5b0f9973c794d5aa9 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/SleipnirGroup
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@aa819e8eb68adf998248f4d5b0f9973c794d5aa9 -
Trigger Event:
push
-
Statement type: