Skip to content
Snippets Groups Projects
Commit ebd264dc authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

Fix parallel search with FairZ3Solver

parent c76506d3
No related branches found
No related tags found
No related merge requests found
......@@ -23,15 +23,19 @@ trait Heuristic {
object HeuristicStep {
def verifyPre(sctx: SynthesisContext, problem: Problem)(s: Solution): Solution = {
sctx.solver.solveSAT(And(Not(s.pre), problem.phi)) match {
case (Some(true), model) =>
sctx.reporter.warning("Heuristic failed to produce weakest precondition:")
sctx.reporter.warning(" - problem: "+problem)
sctx.reporter.warning(" - precondition: "+s.pre)
s
case _ =>
s
}
//sctx here is unsafe to use in parallel. onSuccess should take a sctx for
//this to be possible
//sctx.solver.solveSAT(And(Not(s.pre), problem.phi)) match {
// case (Some(true), model) =>
// sctx.reporter.warning("Heuristic failed to produce weakest precondition:")
// sctx.reporter.warning(" - problem: "+problem)
// sctx.reporter.warning(" - precondition: "+s.pre)
// s
// case _ =>
// s
//}
s
}
def apply(sctx: SynthesisContext, problem: Problem, subProblems: List[Problem], onSuccess: List[Solution] => Solution) = {
......
......@@ -28,15 +28,19 @@ class ParallelSearch(synth: Synthesizer,
t.app.apply(sctx) match {
case RuleSuccess(sol) =>
info(prefix+"Got: "+t.problem)
info(prefix+"Solved with: "+sol)
synth.synchronized {
info(prefix+"Got: "+t.problem)
info(prefix+"Solved with: "+sol)
}
ExpandSuccess(sol)
case RuleDecomposed(sub, onSuccess) =>
info(prefix+"Got: "+t.problem)
info(prefix+"Decomposed into:")
for(p <- sub) {
info(prefix+" - "+p)
synth.synchronized {
info(prefix+"Got: "+t.problem)
info(prefix+"Decomposed into:")
for(p <- sub) {
info(prefix+" - "+p)
}
}
Expanded(sub.map(TaskTryRules(_)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment