Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Sleipnir

C++ Python PyPI Downloads Website C++ API Python API Discord

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 python

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()

Sleipnir supports easy cross-compilation via CMake toolchain files, provides good performance by default, and contains clean reference implementations of various solvers with links to explanatory material.

The C++ API also supports arbitrary scalar types, so users can specify higher precision floating-point types at the cost of speed.

Install

The following platforms are supported:

  • Windows
  • 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.

Contributing

See the contributing docs.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sleipnirgroup_jormungandr-0.6.7.dev1.tar.gz (130.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-win_arm64.whl (933.0 kB view details)

Uploaded CPython 3.12+Windows ARM64

sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-win_amd64.whl (799.4 kB view details)

Uploaded CPython 3.12+Windows x86-64

sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-manylinux_2_39_x86_64.whl (556.4 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.39+ x86-64

sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-manylinux_2_39_aarch64.whl (501.8 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.39+ ARM64

sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-macosx_14_0_universal2.whl (1.0 MB view details)

Uploaded CPython 3.12+macOS 14.0+ universal2 (ARM64, x86-64)

File details

Details for the file sleipnirgroup_jormungandr-0.6.7.dev1.tar.gz.

File metadata

File hashes

Hashes for sleipnirgroup_jormungandr-0.6.7.dev1.tar.gz
Algorithm Hash digest
SHA256 5c740347451e0613a01359d57e321f882b106767c8269db6ae3bfe513e9216bd
MD5 d92eca0a286d2eabc616215456a9e0fe
BLAKE2b-256 79be2b64a43d890f302f785db72c4286492541f62f0adafd5cc8139c19a05d9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sleipnirgroup_jormungandr-0.6.7.dev1.tar.gz:

Publisher: python.yml on SleipnirGroup/Sleipnir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 47dcc42bd83dd622b407aa1c7a7ef0b06b4225436bae79c35b1501c72769d10e
MD5 cbb513b81826c680143c8f399d670477
BLAKE2b-256 43a3d693368a37b91edcb7586d9660b6a074a630dd2ee6a419323155f6fbcc52

See more details on using hashes here.

Provenance

The following attestation bundles were made for sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-win_arm64.whl:

Publisher: python.yml on SleipnirGroup/Sleipnir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 273004c2893d2cb2ea43e7de1edb084618eb9097ea1355cff2167590e3e44a28
MD5 8f6c231fe428169b1f37742dd3efaeb9
BLAKE2b-256 e1beb3bec01ac52f799ea57f83c9a5e428117b791b942a4fbedd6407203a4189

See more details on using hashes here.

Provenance

The following attestation bundles were made for sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-win_amd64.whl:

Publisher: python.yml on SleipnirGroup/Sleipnir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 48d654d5466600521c14162221b0941a7bee82e5c0a94fb8d18a851e4577e403
MD5 8e2257fae9b7557d63c76a5d7fbea405
BLAKE2b-256 00a8d01a32d037c624107b58d9405fdd32f785af12b06eb473c6aaa6ca5104ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-manylinux_2_39_x86_64.whl:

Publisher: python.yml on SleipnirGroup/Sleipnir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 35ac54a3021564e5768de50e79077919bb9b65ccd74ccb0a34f3c4e0006dc92c
MD5 75fbd2cd4892bc91fc774b9a849026a6
BLAKE2b-256 dcc0228ec05305e0070818f34c5e80cb38afaa4a9a60f6d07f71c2abc67d05b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-manylinux_2_39_aarch64.whl:

Publisher: python.yml on SleipnirGroup/Sleipnir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-macosx_14_0_universal2.whl.

File metadata

File hashes

Hashes for sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 c1a381b01c75ac46ec451db1366bd44064c3f340091cb366d45d33a2ab91277f
MD5 2f55dae79f797c3a6d4f3b8255d3eb7b
BLAKE2b-256 f8f3805ebf20efa13314cc281798a5ad24b0cd6e8ac120e81fd0d46be9c64186

See more details on using hashes here.

Provenance

The following attestation bundles were made for sleipnirgroup_jormungandr-0.6.7.dev1-cp312-abi3-macosx_14_0_universal2.whl:

Publisher: python.yml on SleipnirGroup/Sleipnir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.6.7.dev1 This release

6 files

0.6.6

6 files

0.6.5

6 files

0.6.4

6 files

0.6.3

6 files

0.6.2

6 files

0.6.1

6 files

0.6.0

6 files

0.5.5

6 files

0.5.4

6 files

0.5.3

6 files

0.5.2

6 files

0.5.1

6 files

0.5.0

6 files

0.4.0

6 files

0.3.5

6 files

0.3.4

6 files

0.3.3

6 files

0.3.2

6 files

0.3.1

6 files

0.3.0

6 files

0.2.2

6 files

0.2.1

6 files

0.2.0

6 files

0.1.0

12 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page