Skip to content

Commit

Permalink
added proper limits for random sampling
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneslenfers committed Jan 11, 2024
1 parent 7a77010 commit a0b717e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ class RandomGraph[P] extends Heuristic[P] {
// reset solution
solution = initialSolution

for (_ <- Range(0, depth)) {
var depthCounter: Int = 0
while (depthCounter < depth && sampleCounter < samples) {
depthCounter += 1
sampleCounter += 1

//get neighbourhood
val Ns: Seq[Solution[P]] = panel.N(solution)
Expand All @@ -40,7 +43,6 @@ class RandomGraph[P] extends Heuristic[P] {
// get next element
solution = Ns.apply(random.nextInt(Ns.size))
solutionValue = panel.f(solution)
sampleCounter += 1

solution
}
Expand Down

0 comments on commit a0b717e

Please sign in to comment.