diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 9ec56c3..43757a3 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -2,7 +2,7 @@ name: Runic formatting on: push: branches: - - 'master' + - 'main' - 'release-' tags: - '*' @@ -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' diff --git a/.gitignore b/.gitignore index 51a6c34..8350d9f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ docs/build -docs/Manifest.toml -Manifest.toml docs/src/changelog.md +*Manifest.toml + +LocalPreferences.toml +JuliaLocalPreferences.toml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2978507 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/docs/make.jl b/docs/make.jl index eaacd7d..309a0fc 100755 --- a/docs/make.jl +++ b/docs/make.jl @@ -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] @@ -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 @@ -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() diff --git a/src/stopping_criterion.jl b/src/stopping_criterion.jl index 26a7dfa..af3981b 100644 --- a/src/stopping_criterion.jl +++ b/src/stopping_criterion.jl @@ -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 diff --git a/src/test_suite.jl b/src/test_suite.jl index 9574c86..e849418 100644 --- a/src/test_suite.jl +++ b/src/test_suite.jl @@ -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 stopping_criterion_state::S iteration::Int end + end diff --git a/test/stopping_criterion.jl b/test/stopping_criterion.jl index 486d8a0..e4551d2 100644 --- a/test/stopping_criterion.jl +++ b/test/stopping_criterion.jl @@ -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: @@ -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) @@ -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()) @@ -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)