Skip to content

Commit

Permalink
Merge pull request #4 from JuliaConstraints/dev
Browse files Browse the repository at this point in the history
New release for the `check!` function
  • Loading branch information
Azzaare authored Oct 21, 2024
2 parents b1530ef + 812a750 commit 2484fb5
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 10 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
name: CI
on:
pull_request:
branches:
- main
- dev
paths-ignore:
- "docs/**"
push:
branches:
- main
tags: ["*"]
pull_request:
paths-ignore:
- "docs/**"
workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ConstraintExplorer"
uuid = "798c8aff-73f8-4b88-855c-426d3d936206"
authors = ["Jean-François BAFFIER (@Azzaare)"]
version = "0.0.1"
version = "0.0.2"

[deps]
ConstraintCommons = "e37357d9-0691-492f-a822-e5ea6a920954"
Expand All @@ -17,7 +17,7 @@ TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"
[compat]
Aqua = "0.8"
ConstraintCommons = "0.2"
ConstraintDomains = "0.3.14"
ConstraintDomains = "0.3.15"
Constraints = "0.5"
ExplicitImports = "1"
Intervals = "1"
Expand Down
21 changes: 19 additions & 2 deletions src/ConstraintExplorer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module ConstraintExplorer
import ConstraintCommons
import ConstraintDomains: AbstractDomain, RangeDomain
import ConstraintDomains: intersect_domains, domain
import ConstraintDomains: Explorer, ExploreSettings, ExplorerState, explore!
import ConstraintDomains: Explorer, ExploreSettings, ExplorerState, explore!, _check!
import Constraints: concept, USUAL_CONSTRAINTS
import JuMP
import MathOptInterface as MOI
Expand Down Expand Up @@ -56,7 +56,7 @@ export Regular
export Sum

#Exports: Explorer
export configurations, solutions, non_solutions
export configurations, solutions, non_solutions, check!

#SECTION - Includes
include("MOI_wrapper.jl")
Expand Down Expand Up @@ -103,6 +103,23 @@ include("constraints/sum.jl")

X, X̅ = configurations(explorer)
@info "All Different" X X̅

x = first(X)

checker = Model(ConstraintExplorer.Optimizer)

@variable(checker, 1X[1:4]4, Int)

@constraint(checker, X in AllDifferent())
@constraint(checker, X in DistDifferent())

check!(checker, [x])

Y, Y̅ = configurations(checker)

@test x Y
@test length(Y) == 1
@test isempty(Y̅)
end

#SECTION - Main function (optional)
Expand Down
5 changes: 5 additions & 0 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,8 @@ solutions(model) = model.moi_backend.optimizer.model.explorer.state.solutions
non_solutions(model) = model.moi_backend.optimizer.model.explorer.state.non_solutions

configurations(model) = solutions(model), non_solutions(model)

function check!(model, configurations)
checker = model.moi_backend.optimizer.model.explorer
return _check!(checker, configurations)
end
8 changes: 4 additions & 4 deletions test/Aqua.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# TODO: Fix the broken tests and remove the `broken = true` flag
Aqua.test_all(
ConstraintExplorer;
ambiguities = (broken = true,),
ambiguities = (broken = false,),
deps_compat = true,
piracies = (broken = false,),
)

@testset "Ambiguities: ConstraintExplorer" begin
Aqua.test_ambiguities(ConstraintExplorer;)
end
# @testset "Ambiguities: ConstraintExplorer" begin
# Aqua.test_ambiguities(ConstraintExplorer;)
# end

@testset "Piracies: ConstraintExplorer" begin
Aqua.test_piracies(ConstraintExplorer;)
Expand Down

0 comments on commit 2484fb5

Please sign in to comment.