The UFZ services GitLab and Mattermost will be unavailable on Monday, July 4 from 06:00 AM to 08:00 AM due to maintenance work.

Commit 43ecc5f9 authored by Adam Reichold's avatar Adam Reichold
Browse files

Add a simple measurement for aggregate flower visitation rates.

parent 258494da
Pipeline #82257 passed with stage
in 5 minutes and 39 seconds
use std::env::args_os;
use measurements::{collect, insects};
fn main() {
collect(args_os().nth(1).unwrap(), |tick, worlds| {
let mut min_visitation_rate = f64::INFINITY;
let mut max_visitation_rate = f64::NEG_INFINITY;
let mut sum_visitation_rate = 0.0;
let mut cnt_insects = 0;
for insect in insects(worlds) {
let visitation_rate = insect.visits as f64 / tick.as_seconds() as f64;
if min_visitation_rate > visitation_rate {
min_visitation_rate = visitation_rate;
}
if max_visitation_rate < visitation_rate {
max_visitation_rate = visitation_rate;
}
sum_visitation_rate += visitation_rate;
cnt_insects += 1;
}
let mean_visitation_rate = sum_visitation_rate / cnt_insects as f64;
println!(
"{}, {:.3}, {:.3}, {:.3}",
tick.as_days(),
mean_visitation_rate,
min_visitation_rate,
max_visitation_rate,
);
});
}
......@@ -77,6 +77,7 @@ pub struct Insect {
pub activity: Activity,
pub memory: Queue<TaggedIndex, FLOWER_PATCH_MEMORY>,
pub pollen: Volume,
pub visits: usize,
pub pathogen_status: PathogenStatus,
}
......@@ -129,6 +130,7 @@ impl Insect {
activity: Activity::SearchFlowerPatch(Default::default()),
memory: Default::default(),
pollen,
visits: 0,
pathogen_status,
}
}
......@@ -291,6 +293,8 @@ As the scarcity of nectar is primarily used as a driver for the exploration of t
vectors,
temporal_network,
);
self.visits += 1;
}
if flower_patch.nectar <= Default::default() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment