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

Fix Histogram

parent 3bad9622
No related branches found
No related tags found
No related merge requests found
...@@ -106,7 +106,7 @@ object Histogram { ...@@ -106,7 +106,7 @@ object Histogram {
} }
} }
def point(bound: Int, at: Int, v: Int) = { def point(bound: Int, at: Int, v: Double) = {
if (bound <= at) { if (bound <= at) {
empty(bound) empty(bound)
} else { } else {
......
...@@ -52,8 +52,8 @@ sealed class Graph(problem: Problem, costModel: CostModel) { ...@@ -52,8 +52,8 @@ sealed class Graph(problem: Problem, costModel: CostModel) {
class AndNode(parent: Option[Node], val ri: RuleInstantiation) extends Node(parent) { class AndNode(parent: Option[Node], val ri: RuleInstantiation) extends Node(parent) {
val p = ri.problem val p = ri.problem
var selfHistogram = Histogram.point(maxCost, costModel.ruleAppCost(ri), 100) var selfHistogram = Histogram.point(maxCost, costModel.ruleAppCost(ri), 1d)
var histogram = Histogram.uniformFrom(maxCost, costModel.ruleAppCost(ri), 50) var histogram = Histogram.uniformFrom(maxCost, costModel.ruleAppCost(ri), 0.5d)
override def toString = "\u2227 "+ri; override def toString = "\u2227 "+ri;
...@@ -73,7 +73,7 @@ sealed class Graph(problem: Problem, costModel: CostModel) { ...@@ -73,7 +73,7 @@ sealed class Graph(problem: Problem, costModel: CostModel) {
selectedSolution = 0; selectedSolution = 0;
histogram = sols.foldLeft(Histogram.empty(maxCost)) { histogram = sols.foldLeft(Histogram.empty(maxCost)) {
(d, sol) => d or Histogram.point(maxCost, costModel.solutionCost(sol), 100) (d, sol) => d or Histogram.point(maxCost, costModel.solutionCost(sol), 1d)
} }
isSolved = sols.nonEmpty isSolved = sols.nonEmpty
...@@ -143,7 +143,7 @@ sealed class Graph(problem: Problem, costModel: CostModel) { ...@@ -143,7 +143,7 @@ sealed class Graph(problem: Problem, costModel: CostModel) {
} }
class OrNode(parent: Option[Node], val p: Problem) extends Node(parent) { class OrNode(parent: Option[Node], val p: Problem) extends Node(parent) {
var histogram = Histogram.uniformFrom(maxCost, costModel.problemCost(p), 50) var histogram = Histogram.uniformFrom(maxCost, costModel.problemCost(p), 0.5d)
override def toString = "\u2228 "+p; override def toString = "\u2228 "+p;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment