-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: make all Minion expressions flat
Change the type signature of Minion constraints to use `Atom`, `Literal` and `Name` instead of recursive `Expressions`. This enforces flatness through typing. Give these expressions the Flat or Minion prefixes to better reflect the fact that they are solver-level expressions only. This commit also contains the following refactors: * Simplified and rewrote much of the Minion solver adaptor `load_model` code, and moved it to a separate file. * Improve documentation of Minion expressions, and add links to their Minion documentation * Rename some Minion rules to be more consistent, and update their doc strings. * Remove `use Expr::*` from the Minion rules. Apart from the rule name changes, these refactors do not change functionality. DETAILS The idea of encoding flatness as types originated in a872e12 (rules(minion): add flattening rules for division, 2024-11-16). This commit adds this strong typing to the rest of the Minion constraints. Minion takes flat constraints as input. Encoding this limitation in the type signature guarantees that our rules obey this, and that nothing is converted into Minion constraints until it is flat. Keeping expressions in a solver-generic, higher-level form until they can be directly converted to a Minion valid constraint is desirable as they can be rewritten by solver-generic rules (such as normalisation) for longer. The prefix used to rename an expression depends on how Minion specific they are: constraints that could be found in other solvers, such as SumGeq, are called Flat. Constraints with more Minion specific semantics, such as DivEqUndefZero, are prefixed with Minion instead.
- Loading branch information
1 parent
77b03db
commit 6ce102d
Showing
84 changed files
with
1,548 additions
and
3,502 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
}, | ||
[ | ||
{ | ||
"DivEqUndefZero": [ | ||
"MinionDivEqUndefZero": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
|
42 changes: 8 additions & 34 deletions
42
conjure_oxide/tests/integration/basic/div/02/input.expected-rewrite.serialised.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
}, | ||
[ | ||
{ | ||
"DivEqUndefZero": [ | ||
"MinionDivEqUndefZero": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ | |
] | ||
}, | ||
{ | ||
"DivEqUndefZero": [ | ||
"MinionDivEqUndefZero": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ | |
] | ||
}, | ||
{ | ||
"DivEqUndefZero": [ | ||
"MinionDivEqUndefZero": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ | |
] | ||
}, | ||
{ | ||
"DivEqUndefZero": [ | ||
"MinionDivEqUndefZero": [ | ||
{ | ||
"clean": false, | ||
"etype": null | ||
|
12 changes: 6 additions & 6 deletions
12
conjure_oxide/tests/integration/basic/max/02/input-expected-rule-trace-human.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 24 additions & 102 deletions
126
conjure_oxide/tests/integration/basic/max/02/input.expected-rewrite.serialised.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
conjure_oxide/tests/integration/basic/min/01/input-expected-rule-trace-human.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.