diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25556ce..17c6c01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,15 @@ name: CI on: - - push - - pull_request + push: + branches: + - main + tags: '*' + pull_request: +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} jobs: test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} diff --git a/Project.toml b/Project.toml index d5547d6..2ecc531 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "LocalSearchSolvers" uuid = "2b10edaa-728d-4283-ac71-07e312d6ccf3" authors = ["Jean-Francois Baffier"] -version = "0.4.0" +version = "0.4.1" [deps] CompositionalNetworks = "4b67e4b5-442d-4ef5-b760-3f5df3a57537" diff --git a/src/LocalSearchSolvers.jl b/src/LocalSearchSolvers.jl index f25ae40..9214b99 100644 --- a/src/LocalSearchSolvers.jl +++ b/src/LocalSearchSolvers.jl @@ -1,8 +1,5 @@ module LocalSearchSolvers -using Dictionaries: include -using CompositionalNetworks: include -using Constraints: include using Base.Threads using CompositionalNetworks using ConstraintDomains diff --git a/src/constraint.jl b/src/constraint.jl index 231ad8c..28b914d 100644 --- a/src/constraint.jl +++ b/src/constraint.jl @@ -50,4 +50,13 @@ Base.in(var::Int, c::Constraint) = var ∈ c.vars DOCSTRING """ -constraint(f, vars) = Constraint(f, collect(Int == Int32 ? map(Int,vars) : vars)) +function constraint(f, vars) + b1 = hasmethod(f, NTuple{1, Any}, (:X,)) + b2 = hasmethod(f, NTuple{1, Any}, (:do_not_use_this_kwarg_name,)) + + g = f + if !b1 || b2 + g = (x; X=nothing) -> f(x) + end + return Constraint(g, collect(Int == Int32 ? map(Int,vars) : vars)) +end