Skip to content

Commit

Permalink
Merge pull request #566 from conjure-cp/pr/nik/make-all-minion-constr…
Browse files Browse the repository at this point in the history
…aints-flat/02

refactor: make all Minion expressions flat
  • Loading branch information
ozgurakgun authored Jan 6, 2025
2 parents 3b43bda + 6ce102d commit e5ff7e2
Show file tree
Hide file tree
Showing 84 changed files with 1,548 additions and 3,502 deletions.
3 changes: 0 additions & 3 deletions conjure_oxide/tests/generated_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,6 @@ fn assert_vector_operators_have_partially_evaluated(model: &conjure_core::Model)
Max(_, ref vec) => assert_constants_leq_one(&node, vec),
Or(_, ref vec) => assert_constants_leq_one(&node, vec),
And(_, ref vec) => assert_constants_leq_one(&node, vec),
SumEq(_, ref vec, _) => assert_constants_leq_one(&node, vec),
SumGeq(_, ref vec, _) => assert_constants_leq_one(&node, vec),
SumLeq(_, ref vec, _) => assert_constants_leq_one(&node, vec),
_ => (),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
[
{
"DivEqUndefZero": [
"MinionDivEqUndefZero": [
{
"clean": false,
"etype": null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,23 @@
{
"constraints": [
{
"Ineq": [
"FlatIneq": [
{
"clean": false,
"etype": null
},
{
"Atomic": [
{
"clean": false,
"etype": null
},
{
"Literal": {
"Int": 2
}
}
]
"Literal": {
"Int": 2
}
},
{
"Atomic": [
{
"clean": false,
"etype": null
},
{
"Reference": {
"UserName": "a"
}
}
]
"Reference": {
"UserName": "a"
}
},
{
"Atomic": [
{
"clean": false,
"etype": null
},
{
"Literal": {
"Int": 0
}
}
]
"Int": 0
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
[
{
"DivEqUndefZero": [
"MinionDivEqUndefZero": [
{
"clean": false,
"etype": null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
]
},
{
"DivEqUndefZero": [
"MinionDivEqUndefZero": [
{
"clean": false,
"etype": null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
]
},
{
"DivEqUndefZero": [
"MinionDivEqUndefZero": [
{
"clean": false,
"etype": null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
]
},
{
"DivEqUndefZero": [
"MinionDivEqUndefZero": [
{
"clean": false,
"etype": null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
(Max([2, a]) <= 2),
~~> leq_to_ineq ([("Minion", 4100)])
Ineq(Max([2, a]), 2, 0)

--

Max([2, a]),
~~> max_to_var ([("Base", 100)])
__0

--

(__0 <= 2),
~~> leq_to_ineq ([("Minion", 4100)])
Ineq(__0, 2, 0)

--

(__0 >= 2),
~~> geq_to_ineq ([("Minion", 4100)])
Ineq(2, __0, 0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,143 +1,65 @@
{
"constraints": [
{
"Ineq": [
"FlatIneq": [
{
"clean": false,
"etype": null
},
{
"Atomic": [
{
"clean": false,
"etype": null
},
{
"Reference": {
"MachineName": 0
}
}
]
"Reference": {
"MachineName": 0
}
},
{
"Atomic": [
{
"clean": false,
"etype": null
},
{
"Literal": {
"Int": 2
}
}
]
"Literal": {
"Int": 2
}
},
{
"Atomic": [
{
"clean": false,
"etype": null
},
{
"Literal": {
"Int": 0
}
}
]
"Int": 0
}
]
},
{
"Ineq": [
"FlatIneq": [
{
"clean": false,
"etype": null
},
{
"Atomic": [
{
"clean": false,
"etype": null
},
{
"Literal": {
"Int": 2
}
}
]
"Literal": {
"Int": 2
}
},
{
"Atomic": [
{
"clean": false,
"etype": null
},
{
"Reference": {
"MachineName": 0
}
}
]
"Reference": {
"MachineName": 0
}
},
{
"Atomic": [
{
"clean": false,
"etype": null
},
{
"Literal": {
"Int": 0
}
}
]
"Int": 0
}
]
},
{
"Ineq": [
"FlatIneq": [
{
"clean": false,
"etype": null
},
{
"Atomic": [
{
"clean": false,
"etype": null
},
{
"Reference": {
"UserName": "a"
}
}
]
"Reference": {
"UserName": "a"
}
},
{
"Atomic": [
{
"clean": false,
"etype": null
},
{
"Reference": {
"MachineName": 0
}
}
]
"Reference": {
"MachineName": 0
}
},
{
"Atomic": [
{
"clean": false,
"etype": null
},
{
"Literal": {
"Int": 0
}
}
]
"Int": 0
}
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
(Min([a, b]) >= 3),
~~> geq_to_ineq ([("Minion", 4100)])
Ineq(3, Min([a, b]), 0)

--

Min([a, b]),
~~> min_to_var ([("Base", 2000)])
__0

--

(__0 >= 3),
~~> geq_to_ineq ([("Minion", 4100)])
Ineq(3, __0, 0)

--

(__0 <= a),
~~> leq_to_ineq ([("Minion", 4100)])
Ineq(__0, a, 0)
Expand Down
Loading

0 comments on commit e5ff7e2

Please sign in to comment.