feat: ✨ now able to run abc multiple times
This commit is contained in:
parent
5a2100fd30
commit
7d54ed4795
2 changed files with 53 additions and 46 deletions
|
@ -10,6 +10,7 @@ pub struct Input {
|
||||||
pub upper_bound: f64,
|
pub upper_bound: f64,
|
||||||
pub lower_bound: f64,
|
pub lower_bound: f64,
|
||||||
pub iteration: usize,
|
pub iteration: usize,
|
||||||
|
pub run: usize,
|
||||||
}
|
}
|
||||||
impl Input {
|
impl Input {
|
||||||
pub fn get() -> Self {
|
pub fn get() -> Self {
|
||||||
|
@ -31,6 +32,8 @@ impl Input {
|
||||||
println!("Iteration");
|
println!("Iteration");
|
||||||
let iteration = Self::get_input().parse().unwrap();
|
let iteration = Self::get_input().parse().unwrap();
|
||||||
|
|
||||||
|
println!("Run");
|
||||||
|
let run = Self::get_input().parse().unwrap();
|
||||||
Input {
|
Input {
|
||||||
decision_variable_count,
|
decision_variable_count,
|
||||||
food_source_number,
|
food_source_number,
|
||||||
|
@ -38,6 +41,7 @@ impl Input {
|
||||||
upper_bound,
|
upper_bound,
|
||||||
lower_bound,
|
lower_bound,
|
||||||
iteration,
|
iteration,
|
||||||
|
run,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn get_input() -> String {
|
fn get_input() -> String {
|
||||||
|
|
|
@ -10,6 +10,8 @@ fn main() {
|
||||||
input.upper_bound,
|
input.upper_bound,
|
||||||
input.lower_bound,
|
input.lower_bound,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
for _ in 0..input.run {
|
||||||
let mut best = FoodSource::get(vec![]);
|
let mut best = FoodSource::get(vec![]);
|
||||||
for food_source in &food_sources {
|
for food_source in &food_sources {
|
||||||
if best.fitness < food_source.fitness {
|
if best.fitness < food_source.fitness {
|
||||||
|
@ -57,4 +59,5 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("{:#?}", best);
|
println!("{:#?}", best);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue