perf: ⚡ no need to check twice for scout bee
This commit is contained in:
parent
792dec4e92
commit
8ad8241657
1 changed files with 12 additions and 15 deletions
|
@ -45,12 +45,6 @@ fn main() {
|
||||||
input.upper_bound,
|
input.upper_bound,
|
||||||
input.lower_bound,
|
input.lower_bound,
|
||||||
);
|
);
|
||||||
let mut most_tried_index = 0;
|
|
||||||
for i in 0..food_sources.len() {
|
|
||||||
if food_sources[most_tried_index].try_counter < food_sources[i].try_counter {
|
|
||||||
most_tried_index = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for food_source in &food_sources {
|
for food_source in &food_sources {
|
||||||
if best_food_source.fitness_calculation < food_source.fitness_calculation {
|
if best_food_source.fitness_calculation < food_source.fitness_calculation {
|
||||||
|
@ -58,15 +52,18 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if food_sources[most_tried_index].try_counter > input.food_source_try_limit {
|
for index in 0..food_sources.len() {
|
||||||
Bee::scout_bee(
|
if food_sources[index].try_counter >= input.food_source_try_limit {
|
||||||
&mut food_sources,
|
Bee::scout_bee(
|
||||||
most_tried_index,
|
&mut food_sources,
|
||||||
input.food_source_try_limit,
|
index,
|
||||||
input.lower_bound,
|
input.food_source_try_limit,
|
||||||
input.upper_bound,
|
input.lower_bound,
|
||||||
input.decision_variable_count,
|
input.upper_bound,
|
||||||
);
|
input.decision_variable_count,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue