Skip to content

Commit f72147d

Browse files
kellertuergithub-actions[bot]lkdvos
authored
Initial implementation of interfaces and types (#4)
* Start defining main types * Setup docs and first actions. * Setup tests. * Start with stopping criteria. * First steps towards stopping criterion. (docs incomplete) * Further on SC. * Towards the first plain interface. * fix compat. * Fix make.jl * Update docs/make.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Fix an emoji typo. * update README. * Small typo * Add simple test * Actually run tests * return `state` * Start redesign but forgot to pull, so interms commit to merge real quick. * finish redesign. * Implement most of StopWhenAny and StopWhenAll and their |, & operations. * Update src/stopping_criterion.jl Co-authored-by: Lukas Devos <ldevos98@gmail.com> * Apply suggestions from code review Co-authored-by: Lukas Devos <ldevos98@gmail.com> * Update src/stopping_criterion.jl Co-authored-by: Lukas Devos <ldevos98@gmail.com> * Update src/stopping_criterion.jl Co-authored-by: Lukas Devos <ldevos98@gmail.com> * Update src/stopping_criterion.jl Co-authored-by: Lukas Devos <ldevos98@gmail.com> * Update src/stopping_criterion.jl Co-authored-by: Lukas Devos <ldevos98@gmail.com> * Update src/stopping_criterion.jl Co-authored-by: Lukas Devos <ldevos98@gmail.com> * A few points from the discussions * remove _fast_any * get_reason now returns nothing if the stopping criterion is not finished * summary is now Base.summary. * add context. * Refactor interface to have `problem, algorithm, state` * longer argument names * Small fixes and adapt tests * Formatter * refatctor stopping criterion and is_finished. * Update src/stopping_criterion.jl Co-authored-by: Lukas Devos <ldevos98@gmail.com> * Replace `get_` with `getproperty` * remove some intermediate buffers * fix typo * Apply suggestions from formatter Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Fix indentation * Add Aqua tests * remove manifest from git * Add missing compat entry * Fix exports * Add readme badges * Add missing supertype * Add some tests for stopping criteria * fix tests * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Lukas Devos <ldevos98@gmail.com>
1 parent 5e5646a commit f72147d

39 files changed

Lines changed: 1395 additions & 21 deletions

.github/workflows/CompatHelper.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CompatHelper
2+
on:
3+
schedule:
4+
- cron: 0 0 * * *
5+
workflow_dispatch:
6+
jobs:
7+
CompatHelper:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: "Install CompatHelper"
11+
run: |
12+
import Pkg
13+
name = "CompatHelper"
14+
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
15+
version = "3"
16+
Pkg.add(; name, uuid, version)
17+
shell: julia --color=yes {0}
18+
- name: "Run CompatHelper"
19+
run: |
20+
import CompatHelper
21+
CompatHelper.main()
22+
shell: julia --color=yes {0}
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}

.github/workflows/TagBot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: TagBot
2+
on:
3+
issue_comment:
4+
types:
5+
- created
6+
workflow_dispatch:
7+
jobs:
8+
TagBot:
9+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: JuliaRegistries/TagBot@v1
13+
with:
14+
token: ${{ secrets.GITHUB_TOKEN }}
15+
ssh: ${{ secrets.DOCUMENTER_KEY }}

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master]
5+
tags: [v*]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
name: Julia ${{ matrix.julia-version }}–${{ matrix.os }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
julia-version: ["lts", "1", "pre"]
15+
os: [ubuntu-latest, macOS-latest]
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: julia-actions/setup-julia@v2
19+
with:
20+
version: ${{ matrix.julia-version }}
21+
arch: x64
22+
- uses: julia-actions/cache@v2
23+
- uses: julia-actions/julia-buildpkg@latest
24+
- uses: julia-actions/julia-runtest@latest
25+
env:
26+
PYTHON: ""
27+
- uses: julia-actions/julia-processcoverage@v1
28+
- uses: codecov/codecov-action@v5
29+
with:
30+
token: ${{ secrets.CODECOV_TOKEN }}
31+
file: ./lcov.info
32+
name: codecov-umbrella
33+
fail_ci_if_error: false
34+
if: ${{ matrix.os =='ubuntu-latest' }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Doc Preview Cleanup
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
doc-preview-cleanup:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout gh-pages branch
12+
uses: actions/checkout@v4
13+
with:
14+
ref: gh-pages
15+
- name: Delete preview and history + push changes
16+
run: |
17+
if [ -d "previews/PR$PRNUM" ]; then
18+
git config user.name "Documenter.jl"
19+
git config user.email "documenter@juliadocs.github.io"
20+
git rm -rf "previews/PR$PRNUM"
21+
git commit -m "delete preview"
22+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
23+
git push --force origin gh-pages-new:gh-pages
24+
fi
25+
env:
26+
PRNUM: ${{ github.event.number }}

.github/workflows/documenter.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Documenter
2+
on:
3+
push:
4+
branches: [main]
5+
tags: [v*]
6+
pull_request:
7+
8+
jobs:
9+
docs:
10+
name: Documentation
11+
runs-on: ubuntu-latest
12+
# if: contains( github.event.pull_request.labels.*.name, 'preview docs') || github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tags/')
13+
steps:
14+
- uses: actions/checkout@v4
15+
# - uses: quarto-dev/quarto-actions/setup@v2
16+
# with:
17+
# version: "1.6.38"
18+
- uses: julia-actions/setup-julia@latest
19+
with:
20+
version: "1.11"
21+
- name: Julia Cache
22+
uses: julia-actions/cache@v2
23+
# - name: Cache Quarto
24+
# id: cache-quarto
25+
# uses: actions/cache@v4
26+
# env:
27+
# cache-name: cache-quarto
28+
# with:
29+
# path: tutorials/_freeze
30+
# key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('tutorials/*.qmd') }}
31+
# restore-keys: |
32+
# ${{ runner.os }}-${{ env.cache-name }}-
33+
# - name: Cache Documenter
34+
# id: cache-documenter
35+
# uses: actions/cache@v4
36+
# env:
37+
# cache-name: cache-documenter
38+
# with:
39+
# path: docs/src/tutorials
40+
# key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('tutorials/*.qmd') }}
41+
# restore-keys: |
42+
# ${{ runner.os }}-${{ env.cache-name }}-
43+
# - name: Cache CondaPkg
44+
# id: cache-condaPkg
45+
# uses: actions/cache@v4
46+
# env:
47+
# cache-name: cache-condapkg
48+
# with:
49+
# path: docs/.CondaPkg
50+
# key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('docs/CondaPkg.toml') }}
51+
# restore-keys: |
52+
# ${{ runner.os }}-${{ env.cache-name }}-
53+
- name: "Documenter rendering"
54+
run: "docs/make.jl --quarto"
55+
env:
56+
PYTHON: ""
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
59+
# note:
60+
# name: "Documentation deployment note."
61+
# runs-on: ubuntu-latest
62+
# if: "!contains( github.event.pull_request.labels.*.name, 'preview docs')"
63+
# steps:
64+
# - name: echo instructions
65+
# run: echo 'The Documentation is only generated and pushed on a PR if the “preview docs” label is added.'

.github/workflows/format.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Format
2+
on:
3+
push:
4+
branches: [master]
5+
tags: [v*]
6+
pull_request:
7+
8+
jobs:
9+
format:
10+
name: "Format Check"
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: julia-actions/setup-julia@v2
15+
with:
16+
version: 1
17+
- uses: julia-actions/cache@v2
18+
- name: Install JuliaFormatter and format
19+
run: |
20+
using Pkg
21+
Pkg.add(PackageSpec(name="JuliaFormatter", version="1"))
22+
using JuliaFormatter
23+
format("."; verbose=true)
24+
shell: julia --color=yes {0}
25+
- name: Suggest formatting changes
26+
uses: reviewdog/action-suggester@v1
27+
if: github.event_name == 'pull_request'
28+
with:
29+
tool_name: JuliaFormatter
30+
fail_on_error: true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
docs/build
2+
docs/Manifest.toml
3+
Manifest.toml

Project.toml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
1-
name = "AlgorithmInterface"
2-
uuid = "125df6b2-f2b1-44d3-9e4a-6c50c163a640"
1+
name = "AlgorithmsInterface"
2+
uuid = "d1e3940c-cd12-4505-8585-b0a4b322527d"
33
authors = ["Ronny Bergmann <git@ronnybergmann.net>"]
44
version = "0.1.0"
5+
6+
[deps]
7+
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
8+
9+
[compat]
10+
Aqua = "0.8"
11+
Dates = "1.10"
12+
SafeTestsets = "0.1"
13+
Test = "1.10"
14+
julia = "1.10"
15+
16+
[extras]
17+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
18+
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
19+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
20+
21+
[targets]
22+
test = ["Aqua", "Test", "SafeTestsets"]

Readme.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1-
# IterativeAlgorithmsInterface.jl
1+
# 🧮 AlgorithmsInterface.jl
22

3-
`IterativeAlgorithmsInterface.jl` is a Julia package to provide a common interface to run iterative tasks. **Algorithm** here refers to an iterative sequence of commands, that are run until a certain stopping criterion is met.
3+
`AlgorithmsInterface.jl` is a Julia package to provide a common interface to run iterative tasks.
4+
**Algorithm** here refers to an iterative sequence of commands, that are run until a certain stopping criterion is met.
5+
6+
[![docs][docs-dev-img]][docs-dev-url] ![CI][ci-url] [![codecov][codecov-img]][codecov-url]
7+
8+
[docs-dev-img]: https://img.shields.io/badge/docs-dev-blue.svg
9+
[docs-dev-url]: https://JuliaManifolds.github.io/AlgorithmsInterface.jl/dev/
10+
11+
[codecov-img]: https://codecov.io/gh/JuliaManifolds/AlgorithmsInterface.jl/graph/badge.svg?token=1OBDY03SUP
12+
[codecov-url]: https://codecov.io/gh/JuliaManifolds/AlgorithmsInterface.jl
13+
14+
[ci-url]: https://github.com/JuliaManifolds/AlgorithmsInterface.jl/workflows/ci/badge.svg
415

516
# Statement of need
617

@@ -13,20 +24,10 @@ Finally, a common interface also allows to easily combine existing algorithms, h
1324

1425
# Main features
1526

16-
We consider solving _Tasks_, which consist of
17-
18-
* An `AbstractProblem` to solve, which contains all information that is static to the problem and usually does not change during the iterations, this might for example be a cost function and its gradient in an optimisation problem.
19-
* An `AbstractAlgorithmState` that both specifies which algorithm to use to _solve_ the problem, but also stores all parameters that an algorithm needs as well as everything the algorithm needs to store between two iterations.
20-
21-
This generic data structures are accompanied by the methods
22-
23-
* `step!(problem::Problem, state::AlgorithmState, k)` to perform the `k`th iteration of the algorithm.
24-
* `solve!(problem::Problem, state::AlgorithmState)` to solve a problem with a given algorithm, which is identified by the `AlgorithmState`.
25-
* `stop(problem::Problem, state::AlgorithmState)` to check whether the algorithm should stop.
26-
27-
where the first is the main one to implement for a new algorithm.
27+
See the [intial discussion](https://github.com/JuliaManifolds/AlgorithmsInterface.jl/discussions/1)
28+
as well as the [overview on existing things](https://github.com/JuliaManifolds/AlgorithmsInterface.jl/discussions/2)
2829

29-
# Further ideas
30+
## Further ideas
3031

3132
* generic stopping criteria `<:AbstractStoppingCriterion`
3233
* `StopAfterIteration(i)` for example
@@ -35,7 +36,7 @@ where the first is the main one to implement for a new algorithm.
3536
* by default `stop()` from above would check such a stopping criterion
3637
* generic debug and record functionality – together with hooks even
3738

38-
# possible extensions
39+
## Possible extensions
3940

4041
* to `LineSearches.jl`
4142
*

docs/Project.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[deps]
2+
AlgorithmsInterface = "d1e3940c-cd12-4505-8585-b0a4b322527d"
3+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
4+
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
5+
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"

0 commit comments

Comments
 (0)