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

Fix compilation and various things

parent 9c8b6e54
Branches
Tags
No related merge requests found
...@@ -37,7 +37,7 @@ class DerivationTree(root: RootTask) { ...@@ -37,7 +37,7 @@ class DerivationTree(root: RootTask) {
res append " "+node+" [ label = <<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\"><TR><TD BORDER=\"0\">"+t.rule+"</TD></TR><TR><TD BGCOLOR=\"indianred1\">"+escapeHTML(t.problem.toString)+"</TD></TR><TR><TD BGCOLOR=\"greenyellow\">"+escapeHTML(t.solution.map(_.toString).getOrElse("?"))+"</TD></TR></TABLE>> shape = \"none\" ];\n" res append " "+node+" [ label = <<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\"><TR><TD BORDER=\"0\">"+t.rule+"</TD></TR><TR><TD BGCOLOR=\"indianred1\">"+escapeHTML(t.problem.toString)+"</TD></TR><TR><TD BGCOLOR=\"greenyellow\">"+escapeHTML(t.solution.map(_.toString).getOrElse("?"))+"</TD></TR></TABLE>> shape = \"none\" ];\n"
for (st <- t.steps.flatMap(_.subSolvers.values)) { for (st <- t.solver.map(_.allSteps).flatten.flatMap(_.subSolvers.values)) {
res.append(" "+taskName(st)+" -> "+node+"\n") res.append(" "+taskName(st)+" -> "+node+"\n")
printTask(st) printTask(st)
} }
...@@ -45,7 +45,7 @@ class DerivationTree(root: RootTask) { ...@@ -45,7 +45,7 @@ class DerivationTree(root: RootTask) {
} }
root.solver.foreach(printTask) root.solverTask.foreach(printTask)
res append "}\n" res append "}\n"
......
...@@ -25,6 +25,8 @@ class Task(synth: Synthesizer, ...@@ -25,6 +25,8 @@ class Task(synth: Synthesizer,
} }
var solution: Option[Solution] = None var solution: Option[Solution] = None
var solver: Option[RuleApplication] = None
var alternatives = Set[RuleApplication]() var alternatives = Set[RuleApplication]()
var minComplexity: AbsSolComplexity = new FixedSolComplexity(0) var minComplexity: AbsSolComplexity = new FixedSolComplexity(0)
...@@ -66,9 +68,12 @@ class Task(synth: Synthesizer, ...@@ -66,9 +68,12 @@ class Task(synth: Synthesizer,
} else { } else {
onSuccess(solutions) match { onSuccess(solutions) match {
case (s, true) => case (s, true) =>
solution = Some(s) if (isBetterSolutionThan(s, solution)) {
solution = Some(s)
solver = Some(this)
parent.partlySolvedBy(Task.this, solution.get) parent.partlySolvedBy(Task.this, s)
}
case _ => case _ =>
// solution is there, but it is incomplete (precondition not strongest) // solution is there, but it is incomplete (precondition not strongest)
//parent.partlySolvedBy(this, Solution.choose(problem)) //parent.partlySolvedBy(this, Solution.choose(problem))
...@@ -117,18 +122,18 @@ class Task(synth: Synthesizer, ...@@ -117,18 +122,18 @@ class Task(synth: Synthesizer,
} }
class RootTask(synth: Synthesizer, problem: Problem) extends Task(synth, null, problem, null) { class RootTask(synth: Synthesizer, problem: Problem) extends Task(synth, null, problem, null) {
var solver: Option[Task] = None var solverTask: Option[Task] = None
override def run() = { override def run() = {
List(problem) List(problem)
} }
override def isSolvedFor(problem: Problem) = solver.isDefined override def isSolvedFor(problem: Problem) = solverTask.isDefined
override def partlySolvedBy(t: Task, s: Solution) { override def partlySolvedBy(t: Task, s: Solution) {
if (isBetterSolutionThan(s, solution)) { if (isBetterSolutionThan(s, solution)) {
solution = Some(s) solution = Some(s)
solver = Some(t) solverTask = Some(t)
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment