From 8db85d6c36c057fcf7beaf5a542c168a4403247c Mon Sep 17 00:00:00 2001
From: "a.stevan" <antoine.stevan@isae-supaero.fr>
Date: Mon, 27 May 2024 15:45:29 +0200
Subject: [PATCH 1/4] dump raw text

---
 scripts/inbreeding/run.nu | 47 ++++++---------------------------------
 1 file changed, 7 insertions(+), 40 deletions(-)

diff --git a/scripts/inbreeding/run.nu b/scripts/inbreeding/run.nu
index 5cd2716b..5e99a916 100644
--- a/scripts/inbreeding/run.nu
+++ b/scripts/inbreeding/run.nu
@@ -1,8 +1,7 @@
 const BIN = "./target/release/examples/inbreeding"
+const CACHE = ($nu.home-path | path join .cache komodo inbreeding)
 
 export def main [
-    --output: path = "./inbreeding.nuon",
-    --baseline,
     --options: record<
         nb_bytes: int,
         k: int,
@@ -23,24 +22,11 @@ export def main [
         }
     }
 
-    if $baseline {
-        ^$BIN ...[
-            $options.nb_bytes,
-            -k $options.k
-            -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
-            --prng-seed $prng_seed
-        ] | lines | into float | save --force baseline.nuon
+    for s in $options.strategies {
+        for i in 1..$options.nb_scenarii {
+            let output = [ $CACHE, $prng_seed, $s, $i ] | each { into string } | path join
+            mkdir ($output | path dirname)
 
-        print "baseline saved to `baseline.nuon`"
-    }
-
-    $options.strategies | each {|s|
-        let res = 1..$options.nb_scenarii | each {
             ^$BIN ...[
                 $options.nb_bytes,
                 -k $options.k
@@ -53,26 +39,7 @@ export def main [
                 --strategy $s
                 --environment $options.environment
                 --prng-seed $prng_seed
-            ]
-                | lines
-                | parse "{t}, {diversity}"
-                | into float diversity
+            ] out> $output
         }
-
-        let diversity = $res
-            | 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,
-            diversity: $diversity,
-        }
-    } | save --force $output
-
-    print $"results saved to `($output)`"
+    }
 }
-- 
GitLab


From 2677d92d716f6676493c316a31fe8b74e5e73c7b Mon Sep 17 00:00:00 2001
From: "a.stevan" <antoine.stevan@isae-supaero.fr>
Date: Mon, 27 May 2024 16:18:13 +0200
Subject: [PATCH 2/4] add date to the output

---
 scripts/inbreeding/run.nu | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/inbreeding/run.nu b/scripts/inbreeding/run.nu
index 5e99a916..0f8da848 100644
--- a/scripts/inbreeding/run.nu
+++ b/scripts/inbreeding/run.nu
@@ -22,9 +22,11 @@ export def main [
         }
     }
 
+    let now = date now | format date "%s%f"
+
     for s in $options.strategies {
         for i in 1..$options.nb_scenarii {
-            let output = [ $CACHE, $prng_seed, $s, $i ] | each { into string } | path join
+            let output = [ $CACHE, $prng_seed, $now, $s, $i ] | each { into string } | path join
             mkdir ($output | path dirname)
 
             ^$BIN ...[
-- 
GitLab


From ded5cd19bf2d9bb72ae04dc8c33f6354068330c3 Mon Sep 17 00:00:00 2001
From: "a.stevan" <antoine.stevan@isae-supaero.fr>
Date: Mon, 27 May 2024 16:30:53 +0200
Subject: [PATCH 3/4] tell where the output will go

---
 scripts/inbreeding/run.nu | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/inbreeding/run.nu b/scripts/inbreeding/run.nu
index 0f8da848..7a510f86 100644
--- a/scripts/inbreeding/run.nu
+++ b/scripts/inbreeding/run.nu
@@ -25,9 +25,12 @@ export def main [
     let now = date now | format date "%s%f"
 
     for s in $options.strategies {
+        let output_dir = [ $CACHE, $"($prng_seed)", $now, $"($s)" ] | path join
+        mkdir $output_dir
+        print $"data will be dumped to `($output_dir)`"
+
         for i in 1..$options.nb_scenarii {
-            let output = [ $CACHE, $prng_seed, $now, $s, $i ] | each { into string } | path join
-            mkdir ($output | path dirname)
+            let output = [ $output_dir, $"($i)" ] | path join
 
             ^$BIN ...[
                 $options.nb_bytes,
@@ -43,5 +46,7 @@ export def main [
                 --prng-seed $prng_seed
             ] out> $output
         }
+
+        print $"data has been dumped to `($output_dir)`"
     }
 }
-- 
GitLab


From 8800404c75f8a6e45af88f4979959ce7f2c55924 Mon Sep 17 00:00:00 2001
From: "a.stevan" <antoine.stevan@isae-supaero.fr>
Date: Tue, 28 May 2024 09:32:01 +0200
Subject: [PATCH 4/4] add the environment to the dump directory

---
 scripts/inbreeding/run.nu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/inbreeding/run.nu b/scripts/inbreeding/run.nu
index 7a510f86..6a523b70 100644
--- a/scripts/inbreeding/run.nu
+++ b/scripts/inbreeding/run.nu
@@ -25,7 +25,7 @@ export def main [
     let now = date now | format date "%s%f"
 
     for s in $options.strategies {
-        let output_dir = [ $CACHE, $"($prng_seed)", $now, $"($s)" ] | path join
+        let output_dir = [ $CACHE, $"($prng_seed)", $now, $options.environment, $"($s)" ] | path join
         mkdir $output_dir
         print $"data will be dumped to `($output_dir)`"
 
-- 
GitLab