Skip to content

Commit d3fef25

Browse files
authored
1 parent feaa954 commit d3fef25

File tree

5 files changed

+26
-17
lines changed

5 files changed

+26
-17
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
name = "MiniZinc"
22
uuid = "a7f392d2-6c35-496e-b8cc-0974fbfcbf91"
33
authors = ["odow <[email protected]>"]
4-
version = "0.3.10"
4+
version = "0.3.11"
55

66
[deps]
77
Chuffed_jll = "77125aae-c893-5498-99e3-e30470bfa328"
88
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
99
MiniZinc_jll = "3677d96b-3d39-5184-a844-8e8b2839af35"
1010

1111
[compat]
12-
Chuffed_jll = "=0.10.4"
12+
Chuffed_jll = "=0.10.4, =0.13.2"
1313
MathOptInterface = "1.21"
1414
MiniZinc_jll = "=2.7.6"
1515
Test = "<0.0.1, 1.6"

src/optimize.jl

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@
33
# Use of this source code is governed by an MIT-style license that can be found
44
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
55

6-
Chuffed() = joinpath(Chuffed_jll.artifact_dir, "chuffed.msc")
6+
function Chuffed()
7+
for subdir in ["", joinpath("share", "minizinc", "solvers")]
8+
file = joinpath(Chuffed_jll.artifact_dir, subdir, "chuffed.msc")
9+
if isfile(file)
10+
return file
11+
end
12+
end
13+
end
714

815
function run_flatzinc(solver_cmd::F, filename, args = String[]) where {F}
9-
try
10-
return String(read(`$(solver_cmd()) $(vcat(args, filename))`))
11-
catch
12-
return ""
13-
end
16+
io = IOBuffer()
17+
run(pipeline(`$(solver_cmd()) $(vcat(args, filename))`; stdout = io))
18+
seekstart(io)
19+
return read(io, String)
1420
end
1521

1622
"""
@@ -91,6 +97,9 @@ function _run_minizinc(dest::Optimizer)
9197
end
9298
catch
9399
status = "=====ERROR=====\n"
100+
if isfile(_stdout)
101+
status *= read(_stdout, String)
102+
end
94103
if isfile(_stderr)
95104
status *= read(_stderr, String)
96105
end

test/assets/einstein.fzn

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ array [1..5] of var 1..5: c :: output_array([1..5]);
1111
array [1..5] of var 1..5: d :: output_array([1..5]);
1212
array [1..5] of var 1..5: k :: output_array([1..5]);
1313
array [1..5] of var 1..5: s :: output_array([1..5]);
14-
constraint all_different_int(a);
15-
constraint all_different_int(c);
16-
constraint all_different_int(d);
17-
constraint all_different_int(k);
18-
constraint all_different_int(s);
14+
constraint fzn_all_different_int(a);
15+
constraint fzn_all_different_int(c);
16+
constraint fzn_all_different_int(d);
17+
constraint fzn_all_different_int(k);
18+
constraint fzn_all_different_int(s);
1919
constraint int_abs(INT____00001, 1);
2020
constraint int_abs(INT____00003, 1);
2121
constraint int_abs(INT____00005, 1);

test/examples/nqueens_solveall.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ end
2424
function _test_nqueens_solve_num_solutions(
2525
model,
2626
q,
27-
actual_count = 92,
27+
actual_count = 52,
2828
termination_status = MOI.OPTIMAL,
2929
)
3030
n = 8

test/runtests.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,8 +1013,8 @@ function test_chuffed_basic()
10131013
end
10141014

10151015
function test_chuffed_one_solution()
1016-
@test _test_chuffed_asset("one_solution.fzn") ==
1017-
"x = 10;\n\n----------\n==========\n"
1016+
solution = "x = 10;\n\n----------\n==========\n"
1017+
@test startswith(_test_chuffed_asset("one_solution.fzn"), solution)
10181018
return
10191019
end
10201020

@@ -1170,7 +1170,7 @@ end
11701170
function test_moi_tests()
11711171
model = MOI.Utilities.CachingOptimizer(
11721172
MOI.Utilities.Model{Int}(),
1173-
MiniZinc.Optimizer{Int}("chuffed"),
1173+
MiniZinc.Optimizer{Int}("highs"),
11741174
)
11751175
config = MOI.Test.Config(Int)
11761176
MOI.Test.runtests(model, config, include = String["test_cpsat_"])

0 commit comments

Comments
 (0)