Skip to content

Commit

Permalink
Add symmetry tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisJefferson committed Apr 12, 2024
1 parent 707836c commit 94be5ba
Show file tree
Hide file tree
Showing 9 changed files with 516 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/custom/symmetry/basic/one-var/model.essence
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
letting e be new type of size 4

find i: e
10 changes: 10 additions & 0 deletions tests/custom/symmetry/basic/one-var/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
for sym in Quick Complete; do
for amount in Consecutive AllPairs AllPermutations; do
for combine in Independently Altogether; do
echo $sym-$amount-$combine
conjure solve --number-of-solutions=all --solutions-in-one-file --output-format=jsonstream --unnamed-symmetry-breaking=$sym-$amount-$combine *.essence 2>&1
cat *.json | LC_ALL=C sort
rm -rf conjure-output *solutions*
done
done
done
181 changes: 181 additions & 0 deletions tests/custom/symmetry/basic/one-var/stdout.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
Quick-Consecutive-Independently
Using cached models.
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "i": "e_1"}
Quick-Consecutive-Altogether
Adding the following unnamed symmetry breaking constraints:
such that
and([tuple (i) .<=
transform(permutation((q1, succ(q1))), tuple (i))
| q1 : e, q1 < 4])
Generating models for model.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "i": "e_1"}
Quick-AllPairs-Independently
Adding the following unnamed symmetry breaking constraints:
such that
and([tuple (i) .<= transform(permutation((q1, q2)), tuple (i))
| q1 : e, q2 : e, q1 < q2])
Generating models for model.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "i": "e_1"}
Quick-AllPairs-Altogether
Adding the following unnamed symmetry breaking constraints:
such that
and([tuple (i) .<= transform(permutation((q1, q2)), tuple (i))
| q1 : e, q2 : e, q1 < q2])
Generating models for model.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "i": "e_1"}
Quick-AllPermutations-Independently
Adding the following unnamed symmetry breaking constraints:
such that
and([tuple (i) .<= transform(q1, tuple (i))
| q1 : permutation of e])
Generating models for model.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "i": "e_1"}
Quick-AllPermutations-Altogether
Adding the following unnamed symmetry breaking constraints:
such that
and([tuple (i) .<= transform(q1, tuple (i))
| q1 : permutation of e])
Generating models for model.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "i": "e_1"}
Complete-Consecutive-Independently
Adding the following unnamed symmetry breaking constraints:
such that
and([{ tuple (i) .<= tuple (i_auxFor_e)
@ find i_auxFor_e: e
such that
tuple (i_auxFor_e) =
transform(permutation((q1, succ(q1))), tuple (i))
} | q1 : e, q1 < 4])
Generating models for model.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "i": "e_1"}
Complete-Consecutive-Altogether
Adding the following unnamed symmetry breaking constraints:
such that
and([{ tuple (i) .<= tuple (i_auxFor_all)
@ find i_auxFor_all: e
such that
tuple (i_auxFor_all) =
transform(permutation((q1, succ(q1))), tuple (i))
} | q1 : e, q1 < 4])
Generating models for model.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "i": "e_1"}
Complete-AllPairs-Independently
Adding the following unnamed symmetry breaking constraints:
such that
and([{ tuple (i) .<= tuple (i_auxFor_e)
@ find i_auxFor_e: e
such that
tuple (i_auxFor_e) = transform(permutation((q1, q2)), tuple (i))
} | q1 : e, q2 : e, q1 < q2])
Generating models for model.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "i": "e_1"}
Complete-AllPairs-Altogether
Adding the following unnamed symmetry breaking constraints:
such that
and([{ tuple (i) .<= tuple (i_auxFor_all)
@ find i_auxFor_all: e
such that
tuple (i_auxFor_all) = transform(permutation((q1, q2)), tuple (i))
} | q1 : e, q2 : e, q1 < q2])
Generating models for model.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "i": "e_1"}
Complete-AllPermutations-Independently
Adding the following unnamed symmetry breaking constraints:
such that
and([{ tuple (i) .<= tuple (i_auxFor_e)
@ find i_auxFor_e: e
such that tuple (i_auxFor_e) = transform(q1, tuple (i))
} | q1 : permutation of e])
Generating models for model.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "i": "e_1"}
Complete-AllPermutations-Altogether
Adding the following unnamed symmetry breaking constraints:
such that
and([{ tuple (i) .<= tuple (i_auxFor_all)
@ find i_auxFor_all: e
such that tuple (i_auxFor_all) = transform(q1, tuple (i))
} | q1 : permutation of e])
Generating models for model.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "i": "e_1"}
5 changes: 5 additions & 0 deletions tests/custom/symmetry/basic/two-type/model.essence
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
letting e be new type of size 4
letting f be new type of size 4

find i: e
find j: f
10 changes: 10 additions & 0 deletions tests/custom/symmetry/basic/two-type/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
for sym in Quick Complete; do
for amount in Consecutive AllPairs AllPermutations; do
for combine in Independently Altogether; do
echo $sym-$amount-$combine
conjure solve --number-of-solutions=all --solutions-in-one-file --output-format=jsonstream --unnamed-symmetry-breaking=$sym-$amount-$combine *.essence 2>&1
cat *.json | LC_ALL=C sort
rm -rf conjure-output *solutions*
done
done
done
90 changes: 90 additions & 0 deletions tests/custom/symmetry/basic/two-type/stdout.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
Quick-Consecutive-Independently
Adding the following unnamed symmetry breaking constraints:
such that
and([(i, j) .<= transform(permutation((q1, succ(q1))), (i, j))
| q1 : e, q1 < 4]),
and([(i, j) .<= transform(permutation((q2, succ(q2))), (i, j))
| q2 : f, q2 < 4])
Generating models for model.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "f": ["f_1", "f_2", "f_3", "f_4"], "i": "e_1", "j": "f_1"}
Quick-Consecutive-Altogether
Adding the following unnamed symmetry breaking constraints:
such that
and([and([(i, j) .<=
transform(permutation((q2, succ(q2))),
transform(permutation((q1, succ(q1))), (i, j)))
| q2 : f, q2 < 4])
| q1 : e, q1 < 4])
Generating models for model.essence
conjure: This should never happen, sorry!

However, it did happen, so it must be a bug. Please report it to us!

Conjure is actively maintained, we will get back to you as soon as possible.
You can help us by providing a minimal failing example.

Also include the repository version for this build: unknown

Issue tracker: http://github.com/conjure-cp/conjure/issues


dontCare on domain: f

CallStack (from HasCallStack):
error, called at src/Conjure/Bug.hs:17:15 in conjure-cp-2.5.1-DjTx4wiFQ6I2X2qEEdPm4W:Conjure.Bug
bug, called at src/Conjure/Rules/DontCare.hs:31:20 in conjure-cp-2.5.1-DjTx4wiFQ6I2X2qEEdPm4W:Conjure.Rules.DontCare
Quick-AllPairs-Independently
Adding the following unnamed symmetry breaking constraints:
such that
and([(i, j) .<= transform(permutation((q1, q2)), (i, j))
| q1 : e, q2 : e, q1 < q2]),
and([(i, j) .<= transform(permutation((q3, q4)), (i, j))
| q3 : f, q4 : f, q3 < q4])
Generating models for model.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: model.solutions
Copying solution to: model.solutions.json
{"e": ["e_1", "e_2", "e_3", "e_4"], "f": ["f_1", "f_2", "f_3", "f_4"], "i": "e_1", "j": "f_1"}
Quick-AllPairs-Altogether
Adding the following unnamed symmetry breaking constraints:
such that
and([and([(i, j) .<=
transform(permutation((q3, q4)),
transform(permutation((q1, q2)), (i, j)))
| q3 : f, q4 : f, q3 < q4])
| q1 : e, q2 : e, q1 < q2])
Generating models for model.essence
conjure: This should never happen, sorry!

However, it did happen, so it must be a bug. Please report it to us!

Conjure is actively maintained, we will get back to you as soon as possible.
You can help us by providing a minimal failing example.

Also include the repository version for this build: unknown

Issue tracker: http://github.com/conjure-cp/conjure/issues


dontCare on domain: f

CallStack (from HasCallStack):
error, called at src/Conjure/Bug.hs:17:15 in conjure-cp-2.5.1-DjTx4wiFQ6I2X2qEEdPm4W:Conjure.Bug
bug, called at src/Conjure/Rules/DontCare.hs:31:20 in conjure-cp-2.5.1-DjTx4wiFQ6I2X2qEEdPm4W:Conjure.Rules.DontCare
Quick-AllPermutations-Independently
Adding the following unnamed symmetry breaking constraints:
such that
and([(i, j) .<= transform(q1, (i, j)) | q1 : permutation of e]),
and([(i, j) .<= transform(q2, (i, j)) | q2 : permutation of f])
Generating models for model.essence
4 changes: 4 additions & 0 deletions tests/custom/symmetry/basic/two-var/model.essence
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
letting e be new type of size 4

find i: e
find j: e
10 changes: 10 additions & 0 deletions tests/custom/symmetry/basic/two-var/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
for sym in Quick Complete; do
for amount in Consecutive AllPairs AllPermutations; do
for combine in Independently Altogether; do
echo $sym-$amount-$combine
conjure solve --number-of-solutions=all --solutions-in-one-file --output-format=jsonstream --unnamed-symmetry-breaking=$sym-$amount-$combine *.essence 2>&1
cat *.json | LC_ALL=C sort
rm -rf conjure-output *solutions*
done
done
done
Loading

0 comments on commit 94be5ba

Please sign in to comment.