Skip to content
Snippets Groups Projects

Add "Initial Guess" Search Strategy

Merged Julia Rossow requested to merge stu222169/theodolite-extensions:issue-258 into master
7 files
+ 180
5
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -13,7 +13,13 @@ private val logger = KotlinLogging.logger {}
@@ -13,7 +13,13 @@ private val logger = KotlinLogging.logger {}
* @param benchmarkExecutor Benchmark executor which runs the individual benchmarks.
* @param benchmarkExecutor Benchmark executor which runs the individual benchmarks.
*/
*/
class BinarySearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchmarkExecutor) {
class BinarySearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchmarkExecutor) {
override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? {
override fun findSuitableResource(load: LoadDimension, resources: List<Resource>,
 
lastLowestResource: Resource?): Resource? {
 
 
if (lastLowestResource != null) {
 
logger.info { "Running LinearSearch with a set lastLowestResource value doesn't make sense." }
 
}
 
val result = binarySearch(load, resources, 0, resources.size - 1)
val result = binarySearch(load, resources, 0, resources.size - 1)
if (result == -1) {
if (result == -1) {
return null
return null
Loading