Skip to content
Snippets Groups Projects
Commit 1f16e7e2 authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

add timestamp to measurements and delay start (dragoon/komodo!111)

- add a timestamp to all the measurements of the _diversity_ from `inbreeding/mod.rs`
- allow to delay the measurement starts with `--measurement-schedule-start`, to help completing already existing measurements

> :exclamation: **Important**  
> existing measurement files will have to change shape from
> ```
> table<strategy: string, diversity: list<float>>
> ```
> to
> ```
> table<strategy: string, diversity: table<t: int, diversity: float>>
> ```
parent d039128d
No related branches found
No related tags found
No related merge requests found
......@@ -114,7 +114,7 @@ where
for t in 0..=max_t {
if measurement_schedule(t) {
let inbreeding = measure_inbreeding(&shards, k, nb_measurements, &mp, &sty, rng);
println!("{}", inbreeding);
println!("{}, {}", t, inbreeding);
}
// decode the data
......@@ -164,7 +164,7 @@ where
if measurement_schedule(t) {
let inbreeding = measure_inbreeding(&shards, k, nb_measurements, &mp, &sty, rng);
println!("{}", inbreeding);
println!("{}, {}", t, inbreeding);
}
// recode a new random shard
......@@ -220,6 +220,8 @@ struct Cli {
#[arg(long)]
measurement_schedule: usize,
#[arg(long)]
measurement_schedule_start: usize,
}
fn main() {
......@@ -241,7 +243,10 @@ fn main() {
"diversity will be measured every {} steps",
cli.measurement_schedule
);
let measurement_schedule = |t| t % cli.measurement_schedule == 0;
let measurement_schedule = |t| {
t >= cli.measurement_schedule_start
&& (t - cli.measurement_schedule_start) % cli.measurement_schedule == 0
};
match cli.test_case {
TestCase::EndToEnd => {
......
......@@ -54,7 +54,7 @@ export def main [data: path, --save: path, --options: record<k: int>] {
}
| update diversity {|it|
let l = $it.diversity | length
$it.diversity | wrap y | merge (seq 0 $l | wrap x) | insert e 0
$it.diversity | insert e 0 | rename --column { t: "x", diversity: "y" }
}
| rename --column { diversity: "points" }
| insert style {|it|
......
......@@ -10,6 +10,7 @@ export def main [
nb_measurements: int,
nb_scenarii: int,
measurement_schedule: int,
measurement_schedule_start: int,
max_t: int,
strategies: list<string>,
environment: string,
......@@ -22,6 +23,7 @@ export def main [
-n $options.n
--nb-measurements $options.nb_measurements
--measurement-schedule $options.measurement_schedule
--measurement-schedule-start $options.measurement_schedule_start
-t $options.max_t
--test-case end-to-end
] | lines | into float | save --force baseline.nuon
......@@ -37,17 +39,25 @@ export def main [
-n $options.n
--nb-measurements $options.nb_measurements
--measurement-schedule $options.measurement_schedule
--measurement-schedule-start $options.measurement_schedule_start
-t $options.max_t
--test-case recoding
--strategy $s
--environment $options.environment
] | lines | into float
]
| lines
| parse "{t}, {diversity}"
| into float diversity
}
let diversity = $res
| skip 1
| reduce --fold $res.0 {|it, acc| $acc | zip $it | each { flatten }}
| each { math avg }
| flatten
| group-by t --to-table
| update items { get diversity | math avg }
| rename --column { group: "t", items: "diversity" }
| into int t # NOTE: $.t needs to be converted to int here because
# `group-by --to-table` converts the grouping key to
# string
{
strategy: $s,
......
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