Skip to content

Commit bbf0574

Browse files
committed
Add instances.jl file in test.
1 parent 8eb8ae0 commit bbf0574

File tree

3 files changed

+48
-13
lines changed

3 files changed

+48
-13
lines changed

test/instances.jl

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
sudoku_start = [
3+
9 3 0 0 0 0 0 4 0
4+
0 0 0 0 4 2 0 9 0
5+
8 0 0 1 9 6 7 0 0
6+
0 0 0 4 7 0 0 0 0
7+
0 2 0 0 0 0 0 6 0
8+
0 0 0 0 2 3 0 0 0
9+
0 0 8 5 3 1 0 0 2
10+
0 9 0 2 8 0 0 0 0
11+
0 7 0 0 0 0 0 5 3
12+
]
13+
14+
qap_weights = [
15+
0 1 2 2 3 4 4 5 3 5 6 7
16+
1 0 1 1 2 3 3 4 2 4 5 6
17+
2 1 0 2 1 2 2 3 1 3 4 5
18+
2 1 2 0 1 2 2 3 3 3 4 5
19+
3 2 1 1 0 1 1 2 2 2 3 4
20+
4 3 2 2 1 0 2 3 3 1 2 3
21+
4 3 2 2 1 2 0 1 3 1 2 3
22+
5 4 3 3 2 3 1 0 4 2 1 2
23+
3 2 1 3 2 3 3 4 0 4 5 6
24+
5 4 3 3 2 1 1 2 4 0 1 2
25+
6 5 4 4 3 2 2 1 5 1 0 1
26+
7 6 5 5 4 3 3 2 6 2 1 0
27+
]
28+
29+
qap_distances = [
30+
0 3 4 6 8 5 6 6 5 1 4 6
31+
3 0 6 3 7 9 9 2 2 7 4 7
32+
4 6 0 2 6 4 4 4 2 6 3 6
33+
6 3 2 0 5 5 3 3 9 4 3 6
34+
8 7 6 5 0 4 3 4 5 7 6 7
35+
5 9 4 5 4 0 8 5 5 5 7 5
36+
6 9 4 3 3 8 0 6 8 4 6 7
37+
6 2 4 3 4 5 6 0 1 5 5 3
38+
5 2 2 9 5 5 8 1 0 4 5 2
39+
1 7 6 4 7 5 4 5 4 0 7 7
40+
4 4 3 3 6 7 6 5 5 7 0 9
41+
6 7 6 6 7 5 7 3 2 7 9 0
42+
]

test/raw_solver.jl

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,11 @@
4444
end
4545

4646
@testset "Raw solver: sudoku" begin
47-
sudoku_instance = collect(Iterators.flatten([
48-
9 3 0 0 0 0 0 4 0
49-
0 0 0 0 4 2 0 9 0
50-
8 0 0 1 9 6 7 0 0
51-
0 0 0 4 7 0 0 0 0
52-
0 2 0 0 0 0 0 6 0
53-
0 0 0 0 2 3 0 0 0
54-
0 0 8 5 3 1 0 0 2
55-
0 9 0 2 8 0 0 0 0
56-
0 7 0 0 0 0 0 5 3
57-
]))
58-
59-
s = solver(sudoku(3; start = sudoku_instance, modeler = :raw); options = Options(print_level = :minimal, iteration = 10000))
47+
sudoku_instance = collect(Iterators.flatten(sudoku_start))
48+
s = solver(
49+
sudoku(3; start = sudoku_instance, modeler = :raw);
50+
options = Options(print_level = :minimal, iteration = 10000)
51+
)
6052
display(Dictionary(1:length(sudoku_instance), sudoku_instance))
6153
solve!(s)
6254
display(solution(s))

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ using MathOptInterface
77
using Test
88

99
@testset "ConstraintModels.jl" begin
10+
include("instances.jl")
1011
include("raw_solver.jl")
1112
include("MOI_wrapper.jl")
1213
include("JuMP.jl")

0 commit comments

Comments
 (0)