Skip to content

Commit

Permalink
Merge pull request #363 from niklasdewally/feat/add-partial-evaluator
Browse files Browse the repository at this point in the history
  • Loading branch information
ozgurakgun authored Oct 15, 2024
2 parents 6248264 + a9b71f1 commit dc7f98b
Show file tree
Hide file tree
Showing 64 changed files with 3,572 additions and 575 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,7 @@ fabric.properties
*.eprime.infor
*.eprime.minion
*.eprime.solution
*.eprime.solution.*
*.eprime.info

.MINION*
6 changes: 3 additions & 3 deletions conjure_oxide/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ pub fn main() -> AnyhowResult<()> {
.append(true)
.open("conjure_oxide.log")?;

//Builder::with_level("Trace")
Builder::new()
Builder::with_level("TRACE")
//Builder::new()
.with_target_writer("info", new_writer(stdout()))
.with_target_writer("file", new_writer(log_file))
.with_target_writer("file,jsonparser", new_writer(log_file))
.init();

if target_family != SolverFamily::Minion {
Expand Down
8 changes: 6 additions & 2 deletions conjure_oxide/tests/generated_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ fn integration_test_inner(
}

fn assert_vector_operators_have_partially_evaluated(model: &conjure_core::Model) {
model.constraints.descend(Arc::new(|x| {
model.constraints.transform(Arc::new(|x| {
use conjure_core::ast::Expression::*;
match &x {
Nothing => (),
Expand All @@ -171,7 +171,11 @@ fn assert_vector_operators_have_partially_evaluated(model: &conjure_core::Model)
SumLeq(_, vec, _) => assert_constants_leq_one(&x, vec),
DivEq(_, _, _, _) => (),
Ineq(_, _, _, _) => (),
AllDiff(_, vec) => assert_constants_leq_one(&x, vec),
// this is a vector operation, but we don't want to fold values into each-other in this
// one
AllDiff(_, _) => (),
WatchedLiteral(_, _, _) => (),
Reify(_, _, _) => (),
};
x.clone()
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
[
{
"MachineName(0)": 1,
"UserName(a)": 1,
"UserName(b)": 1
},
{
"MachineName(0)": 1,
"UserName(a)": 2,
"UserName(b)": 2
},
{
"MachineName(0)": 1,
"UserName(a)": 3,
"UserName(b)": 2
},
{
"MachineName(0)": 1,
"UserName(a)": 3,
"UserName(b)": 3
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
[
{
"Eq": [
"DivEq": [
{
"clean": false,
"etype": null
Expand All @@ -19,28 +19,9 @@
"etype": null
},
{
"MachineName": 0
}
]
},
{
"Constant": [
{
"clean": false,
"etype": null
},
{
"Int": 1
"UserName": "a"
}
]
}
]
},
{
"Neq": [
{
"clean": false,
"etype": null
},
{
"Reference": [
Expand All @@ -60,29 +41,18 @@
"etype": null
},
{
"Int": 0
"Int": 1
}
]
}
]
},
{
"DivEq": [
"Neq": [
{
"clean": false,
"etype": null
},
{
"Reference": [
{
"clean": false,
"etype": null
},
{
"UserName": "a"
}
]
},
{
"Reference": [
{
Expand All @@ -95,13 +65,13 @@
]
},
{
"Reference": [
"Constant": [
{
"clean": false,
"etype": null
},
{
"MachineName": 0
"Int": 0
}
]
}
Expand All @@ -112,23 +82,6 @@
},
"next_var": 1,
"variables": [
[
{
"MachineName": 0
},
{
"domain": {
"IntDomain": [
{
"Bounded": [
0,
3
]
}
]
}
}
],
[
{
"UserName": "a"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
[
{
"MachineName(0)": 2,
"UserName(a)": 3
},
{
"MachineName(0)": 2,
"UserName(a)": 4
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
[
{
"Eq": [
"DivEq": [
{
"clean": false,
"etype": null
Expand All @@ -19,29 +19,10 @@
"etype": null
},
{
"Int": 2
"Int": 8
}
]
},
{
"Reference": [
{
"clean": false,
"etype": null
},
{
"MachineName": 0
}
]
}
]
},
{
"Neq": [
{
"clean": false,
"etype": null
},
{
"Reference": [
{
Expand All @@ -60,29 +41,18 @@
"etype": null
},
{
"Int": 0
"Int": 2
}
]
}
]
},
{
"DivEq": [
"Neq": [
{
"clean": false,
"etype": null
},
{
"Constant": [
{
"clean": false,
"etype": null
},
{
"Int": 8
}
]
},
{
"Reference": [
{
Expand All @@ -95,13 +65,13 @@
]
},
{
"Reference": [
"Constant": [
{
"clean": false,
"etype": null
},
{
"MachineName": 0
"Int": 0
}
]
}
Expand All @@ -112,23 +82,6 @@
},
"next_var": 1,
"variables": [
[
{
"MachineName": 0
},
{
"domain": {
"IntDomain": [
{
"Bounded": [
0,
8
]
}
]
}
}
],
[
{
"UserName": "a"
Expand Down
Loading

0 comments on commit dc7f98b

Please sign in to comment.