Compare commits
3 Commits
afe317404f
...
df4bc1922f
| Author | SHA1 | Date | |
|---|---|---|---|
| df4bc1922f | |||
| 709ffb313f | |||
| 2ea8ba5a39 |
17
src/main.rs
17
src/main.rs
@@ -27,10 +27,10 @@ fn main() {
|
||||
let bounds: Bounds = Bounds::new(LinearBounds::new(3.1_f64, 3.2_f64), LinearBounds::new(-10_f64, 35_f64));
|
||||
let func: Function = Function::new(f);
|
||||
|
||||
let start: Instant = Instant::now();
|
||||
println!("{}\n{}ms", func.approximate(&bounds, 1_000_000_000, THREAD_CNT), start.elapsed().as_millis())
|
||||
//let start: Instant = Instant::now();
|
||||
//println!("{}\n{}ms", func.approximate(&bounds, 10_000_000, THREAD_CNT), start.elapsed().as_millis())
|
||||
|
||||
//simulate(&bounds, &func)
|
||||
simulate(&bounds, &func)
|
||||
}
|
||||
|
||||
fn simulate(bounds: &Bounds, func: &Function) {
|
||||
@@ -51,10 +51,11 @@ fn simulate(bounds: &Bounds, func: &Function) {
|
||||
}
|
||||
result.print();
|
||||
|
||||
let file: io::Result<File> = File::create("output.json");
|
||||
if file.is_err() {
|
||||
panic!("Error creating output file")
|
||||
}
|
||||
let file: io::Result<File> = File::create(format!("output{}.json", sample_cnt.ilog10()));
|
||||
if file.is_err() {
|
||||
panic!("Error creating output file")
|
||||
}
|
||||
|
||||
if let Err(_) = file.unwrap().write(result.to_json().to_string().as_bytes()) { panic!("Error writing to file") };
|
||||
if let Err(_) = file.unwrap().write(result.to_json().to_string().as_bytes()) { panic!("Error writing to file") };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user