Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Runic formatting
on:
push:
branches:
- 'master'
- 'main'
- 'release-'
tags:
- '*'
Expand All @@ -13,10 +13,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
# - uses: julia-actions/setup-julia@v2
# with:
# version: '1'
# - uses: julia-actions/cache@v2
- uses: fredrikekre/runic-action@v1
with:
version: '1'
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
docs/build
docs/Manifest.toml
Manifest.toml
docs/src/changelog.md
*Manifest.toml

LocalPreferences.toml
JuliaLocalPreferences.toml
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Ronny Bergmann, Lukas Devos

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 4 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ run_on_CI = (get(ENV, "CI", nothing) == "true")
# Copy and reformat changelog

# (d) add contributing.md and changelog.md to the docs – and link to releases and issues
const base_repository = "github.com/JuliaManifolds/AlgorithmsInterface.jl"

function add_links(line::String, url::String = "https://github.com/JuliaManifolds/Manopt.jl")
function add_links(line::String, url::String = "https://$base_repository")
# replace issues (#XXXX) -> ([#XXXX](url/issue/XXXX))
while (m = match(r"\(\#([0-9]+)\)", line)) !== nothing
id = m.captures[1]
Expand All @@ -53,7 +54,7 @@ function add_links(line::String, url::String = "https://github.com/JuliaManifold
end

generated_path = joinpath(@__DIR__, "src")
base_url = "https://github.com/JuliaManifolds/Manopt.jl/blob/master/"
base_url = "https://$base_repository/blob/main/"
isdir(generated_path) || mkdir(generated_path)
for (md_file, doc_file) in [("Changelog.md", "changelog.md")]
open(joinpath(generated_path, doc_file), "w") do io
Expand Down Expand Up @@ -102,6 +103,6 @@ makedocs(;
expandfirst = ["interface.md", "stopping_criterion.md"],
plugins = [bib, links],
)
deploydocs(; repo = "github.com/JuliaManifolds/AlgorithmsInterface.jl", push_preview = true)
deploydocs(; repo = base_repository, push_preview = true)
#back to main env
Pkg.activate()
6 changes: 3 additions & 3 deletions src/stopping_criterion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ when _all_ of them indicate to stop.

# Constructor

StopWhenAll(c::NTuple{N, StoppingCriterion} where {N})
StopWhenAll(c::AbstractVector{<:StoppingCriterion})
StopWhenAll(c::StoppingCriterion...)
"""
struct StopWhenAll{TCriteria <: Tuple} <: StoppingCriterion
criteria::TCriteria
StopWhenAll(c::StoppingCriterion...) = new{typeof(c)}(c)
end
StopWhenAll(c::AbstractVector{<:StoppingCriterion}) = StopWhenAll(Tuple(c))
StopWhenAll(c...) = StopWhenAll(c)
StopWhenAll(c::AbstractVector{<:StoppingCriterion}) = StopWhenAll(c...)
function indicates_convergence(stop_when_all::StopWhenAll)
return any(indicates_convergence, stop_when_all.criteria)
end
Expand Down
6 changes: 5 additions & 1 deletion src/test_suite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ using ..AlgorithmsInterface
struct DummyAlgorithm{S <: AlgorithmsInterface.StoppingCriterion} <: AlgorithmsInterface.Algorithm
stopping_criterion::S
end

struct DummyProblem <: AlgorithmsInterface.Problem end
mutable struct DummyState{S <: AlgorithmsInterface.StoppingCriterionState} <: AlgorithmsInterface.State

mutable struct DummyState{V, S <: AlgorithmsInterface.StoppingCriterionState} <: AlgorithmsInterface.State
iterate::V
Comment thread
lkdvos marked this conversation as resolved.
stopping_criterion_state::S
iteration::Int
end

end
10 changes: 5 additions & 5 deletions test/stopping_criterion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ problem = AIT.DummyProblem()
algorithm = AIT.DummyAlgorithm(s1)
s1_state = initialize_state(problem, algorithm, s1)
@test !indicates_convergence(s1, s1_state)
state_finished = AIT.DummyState(s1_state, 2)
alg_state = AIT.DummyState(s1_state, 1)
state_finished = AIT.DummyState(nothing, s1_state, 2)
alg_state = AIT.DummyState(nothing, s1_state, 1)
@test is_finished(problem, algorithm, state_finished)
@test !is_finished(problem, algorithm, alg_state)
# Fake a stop:
Expand All @@ -31,7 +31,7 @@ end

algorithm = AIT.DummyAlgorithm(s1)
s1_state = initialize_state(problem, algorithm, s1)
alg_state = AIT.DummyState(s1_state, 0)
alg_state = AIT.DummyState(nothing, s1_state, 0)
# Iteration 0: Start timer
@test !is_finished!(problem, algorithm, alg_state)
@test !is_finished(problem, algorithm, alg_state)
Expand Down Expand Up @@ -63,7 +63,7 @@ end
@test contains(s1_str, "Overall: not reached")

@test isnothing(AlgorithmsInterface.get_reason(s1, s1_state))
alg_state = AIT.DummyState(s1_state, 1)
alg_state = AIT.DummyState(nothing, s1_state, 1)
@test !is_finished(problem, algorithm, alg_state)
# Fake start timer
s1_state.criteria_states[2].start = Nanosecond(time_ns())
Expand Down Expand Up @@ -109,7 +109,7 @@ end
@test contains(s1_str, "Overall: not reached")

@test isnothing(AlgorithmsInterface.get_reason(s1, s1_state))
alg_state = AIT.DummyState(s1_state, 1)
alg_state = AIT.DummyState(nothing, s1_state, 1)
@test !is_finished!(problem, algorithm, alg_state)
@test !is_finished(problem, algorithm, alg_state)
s1_state.criteria_states[2].time = Second(2)
Expand Down
Loading