Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit a3987a2e2a89c4c492ac418ef4df971338f13342
Author: Georges SARR <[email protected]>
Date:   Sun Aug 18 11:33:21 2024 +0200

    Added CI dev python on main branch.

commit d78e9c0a1032345cb244ac5ae2a13edbb9acfab7
Author: Georges SARR <[email protected]>
Date:   Sun Aug 18 11:21:55 2024 +0200

    Dropped pseudo args in the crate.

commit 5c050069f784972aac60ddf5301e3db14f4d6992
Author: Georges SARR <[email protected]>
Date:   Sat Aug 17 20:21:16 2024 +0200

    Added objective function and its gradient *args like arguments.

commit 77c257dfebc62ac701dbb8c464c992df9d2665bd
Author: Georges SARR <[email protected]>
Date:   Sat Aug 10 11:17:57 2024 +0200

    Updated python interface.

commit d5e03c70675da744d353257ecebba06dd9901ba7
Author: Georges SARR <[email protected]>
Date:   Sat Aug 10 10:57:37 2024 +0200

    Added output function of optimum.

commit bea4324aafbbaa734f4658972bb14376bb1eff96
Author: Georges SARR <[email protected]>
Date:   Sat Aug 10 10:29:12 2024 +0200

    Updated descent api.

commit d52d1313d7f2acdc15ca7580a0a3aac3a56e3fb4
Author: Georges SARR <[email protected]>
Date:   Mon Aug 5 12:58:12 2024 +0200

    Deleted old brent root finding algo.

commit c3c370da63242517016b89b38f3d07cbde7d1634
Author: geosarr <[email protected]>
Date:   Fri Aug 2 20:47:43 2024 +0200

    Fix README.md

commit f9a1e26
Author: Georges SARR <[email protected]>
Date:   Fri Aug 2 21:07:10 2024 +0200

    Dropped &str use in algorithms.

commit 4e660f2
Author: Georges SARR <[email protected]>
Date:   Fri Aug 2 20:45:30 2024 +0200

    Document readme.

commit 81bf9b4
Author: Georges SARR <[email protected]>
Date:   Fri Aug 2 20:36:18 2024 +0200

    Refacto api v3 with #![no_std]

commit fb29ec2
Author: Georges SARR <[email protected]>
Date:   Fri Aug 2 20:13:01 2024 +0200

    Refacto Api v2 with descent algorithms.

commit 6689100
Author: Georges SARR <[email protected]>
Date:   Fri Aug 2 18:53:31 2024 +0200

    Refacto of api v1.

commit e5cdae2
Author: Georges SARR <[email protected]>
Date:   Thu Aug 1 19:52:55 2024 +0200

    Separated scalar from vector step sizes.

commit 973175a
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 19:05:12 2024 +0200

    Added first zero order optimization and root finding solution.

commit 0bc7bb9
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 13:52:33 2024 +0200

    Added fake test.

commit 25090fa
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 13:41:54 2024 +0200

    Check list of packages before and after maturin.

commit a188d71
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 13:39:13 2024 +0200

    Added manifest path.

commit 628d71f
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 13:37:07 2024 +0200

    Added test dev environment

commit 9e1b344
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 13:20:48 2024 +0200

    Fix wheel ci file.

commit a12bef9
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 13:16:26 2024 +0200

    Test environment with miniconda.

commit b179e20
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 12:31:56 2024 +0200

    Fix test Ubuntu.

commit 2f5be61
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 12:28:50 2024 +0200

    Added test wheel on ubuntu x86_64.

commit 3ac786c
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 11:40:12 2024 +0200

    Added manifest path for sdist.

commit c1caa99
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 11:36:54 2024 +0200

    Test sdist.

commit b020351
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 11:29:17 2024 +0200

    Test build on windows and macos.

commit c039d00
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 11:20:50 2024 +0200

    Added musllinux.

commit cdf9163
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 11:10:27 2024 +0200

    Added interpreters to choose from.

commit d31ef48
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 10:57:04 2024 +0200

    Test other linux architecture. Run rust CI on push main.

commit 81e4af3
Author: Georges SARR <[email protected]>
Date:   Sun Jul 28 10:53:43 2024 +0200

    Added rust stable/nightly installations.

commit e25b208
Author: Georges SARR <[email protected]>
Date:   Sat Jul 27 17:01:25 2024 +0200

    Test cargo bench rust side CI.

commit 66f43d6
Author: Georges SARR <[email protected]>
Date:   Sat Jul 27 13:07:44 2024 +0200

    Added paths to python project.

commit c945bf8
Author: Georges SARR <[email protected]>
Date:   Sat Jul 27 13:03:24 2024 +0200

    Added python CI a nd minor change on python function arguments names.

commit b2bf945
Author: Georges SARR <[email protected]>
Date:   Sat Jul 27 11:44:19 2024 +0200

    RIP old logo, fix bench

commit e12ea2d
Author: Georges SARR <[email protected]>
Date:   Sat Jul 27 11:23:54 2024 +0200

    Added full no-std support v1.

commit 52b682f
Author: Georges SARR <[email protected]>
Date:   Sat Jul 27 09:54:36 2024 +0200

    Added initial #![no_std] setup.

commit 0fd1215
Author: Georges SARR <[email protected]>
Date:   Sat Jul 27 09:38:39 2024 +0200

    Changed some imports from std to core.

commit e3196ea
Author: Georges SARR <[email protected]>
Date:   Sat Jul 27 09:16:45 2024 +0200

    Use directly ndarray aliases for owned vectors and matrices.
  • Loading branch information
geosarr committed Aug 18, 2024
1 parent f669559 commit 60ca778
Show file tree
Hide file tree
Showing 38 changed files with 1,415 additions and 1,265 deletions.
203 changes: 203 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
name: Python

on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches: ["main"]
workflow_dispatch:

permissions:
contents: read

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
- runner: ubuntu-latest
target: s390x
- runner: ubuntu-latest
target: ppc64le
interpreter: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.interpreter }}
- uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
command: build
target: ${{ matrix.platform.target }}
args: >
--release
--manifest-path py-tuutal/Cargo.toml
--out dist
--interpreter ${{ matrix.interpreter }}
manylinux: auto
- name: Test wheel
run: |
pip install --force-reinstall --verbose dist/*.whl
python -c 'import tuutal'
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-linux-${{ matrix.platform.target }}
# path: dist

musllinux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
interpreter: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.interpreter }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: >
--release
--manifest-path py-tuutal/Cargo.toml
--out dist
--interpreter ${{ matrix.interpreter }}
# sccache: "true"
manylinux: musllinux_1_2
- name: Test wheel
run: |
pip install --force-reinstall --verbose dist/*.whl
python -c 'import tuutal'
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-musllinux-${{ matrix.platform.target }}
# path: dist

windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
interpreter: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.interpreter }}
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: >
--release
--manifest-path py-tuutal/Cargo.toml
--out dist
--interpreter ${{ matrix.interpreter }}
# sccache: "true"
- name: Test wheel
run: |
pip install --force-reinstall --verbose dist/*.whl
python -c 'import tuutal'
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-windows-${{ matrix.platform.target }}
# path: dist

macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-12
target: x86_64
- runner: macos-14
target: aarch64
interpreter: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.interpreter }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: >
--release
--manifest-path py-tuutal/Cargo.toml
--out dist
--interpreter ${{ matrix.interpreter }}
# sccache: "true"
- name: Test wheel
run: |
pip install --force-reinstall --verbose dist/*.whl
python -c 'import tuutal'
# - name: Upload wheels
# uses: actions/upload-artifact@v4
# with:
# name: wheels-macos-${{ matrix.platform.target }}
# path: dist

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: >
--manifest-path py-tuutal/Cargo.toml
--out dist
# - name: Upload sdist
# uses: actions/upload-artifact@v4
# with:
# name: wheels-sdist
# path: dist

# release:
# name: Release
# runs-on: ubuntu-latest
# if: "startsWith(github.ref, 'refs/tags/')"
# needs: [linux, musllinux, windows, macos, sdist]
# steps:
# - uses: actions/download-artifact@v4
# - name: Publish to PyPI
# uses: PyO3/maturin-action@v1
# env:
# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
# with:
# command: upload
# args: --non-interactive --skip-existing wheels-*/*
27 changes: 18 additions & 9 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,30 @@ name: Rust

on:
push:
branches: [ "main" ]
branches:
- main
pull_request:
branches: [ "main" ]
branches: ["main"]

env:
CARGO_TERM_COLOR: always

jobs:
build:

build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

bench:
name: Run benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v4
- name: install rust nightly
uses: dtolnay/rust-toolchain@nightly
- run: cargo bench
34 changes: 34 additions & 0 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test Python
on:
push:
branches: [dev, main]
tags:
- "*"
pull_request:
workflow_dispatch:

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: defaults
auto-update-conda: true

- name: Test environment
run: |
conda env create --file py-tuutal/environment.yml
conda activate tuutal
maturin develop --release --manifest-path py-tuutal/Cargo.toml
pytest py-tuutal/tests/
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/target
/Cargo.lock
*.py
*.ipynb
# py-tuutal/*
*.ipynb
10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ edition = "2021"


[dependencies]
ndarray = "0.15.6"
thiserror = "1.0.61"
num-traits = "0.2.19"
ndarray = { version = "0.15.6", default-features = false }
# thiserror = "1.0.61"
thiserror-no-std = "2.0.2"
hashbrown = "0.14"
num-traits = { version = "0.2.19", default-features = false, features = ["libm"] }


[dev-dependencies]
quickcheck = "1.0.0"
quickcheck = "1.0.0"
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ Optimization library for scalar or multidimensional inputs functions.
It aims at the moment to reproduce and improve if possible the optimization submodule of Python scipy 1.13.1.
It is backed by ndarray crate for multidimensional optimization. For compatibility purpose, some of ndarray's objects
are imported into this crate.

# Implementations

For now, the supported algorithms are:
- `Nelder-Mead`, `Powell` for multidimensional derivative-free optimization,
- `Unbounded and Bounded Brent`'s algorithms for unidimensional derivative-free optimization,
- `Brent`'s root finding algorithm for unidimensional functions
- `AdaGrad`, `AdaDelta` for adaptive step size,
- `Armijo` and `Powell-Wolfe` for steepest descent algorithms.
Binary file removed assets/logo.jpg
Binary file not shown.
Loading

0 comments on commit 60ca778

Please sign in to comment.