shun 3 månader sedan
förälder
incheckning
414f4be6e4
87 ändrade filer med 5741 tillägg och 0 borttagningar
  1. 145 0
      #memo.org#
  2. 1 0
      .#memo.org
  3. 25 0
      add_linkselfie/#pickele#
  4. 1 0
      add_linkselfie/.#pickele
  5. 21 0
      add_linkselfie/LICENSE
  6. 100 0
      add_linkselfie/MEMO.org
  7. 99 0
      add_linkselfie/MEMO.org~
  8. 34 0
      add_linkselfie/README.md
  9. BIN
      add_linkselfie/__pycache__/evaluation.cpython-38.pyc
  10. BIN
      add_linkselfie/__pycache__/nb_protocol.cpython-38.pyc
  11. BIN
      add_linkselfie/__pycache__/network.cpython-38.pyc
  12. BIN
      add_linkselfie/__pycache__/utils.cpython-38.pyc
  13. 20 0
      add_linkselfie/algorithms/__init__.py
  14. BIN
      add_linkselfie/algorithms/__pycache__/__init__.cpython-38.pyc
  15. BIN
      add_linkselfie/algorithms/__pycache__/lonline_nb.cpython-38.pyc
  16. BIN
      add_linkselfie/algorithms/__pycache__/naive_nb.cpython-38.pyc
  17. BIN
      add_linkselfie/algorithms/__pycache__/online_nb.cpython-38.pyc
  18. BIN
      add_linkselfie/algorithms/__pycache__/succ_elim_nb.cpython-38.pyc
  19. 40 0
      add_linkselfie/algorithms/lnaive_nb.py
  20. 20 0
      add_linkselfie/algorithms/lnaive_nb.py~
  21. 68 0
      add_linkselfie/algorithms/lonline_nb.py
  22. 45 0
      add_linkselfie/algorithms/lonline_nb.py~
  23. 27 0
      add_linkselfie/algorithms/memo.txt
  24. 5 0
      add_linkselfie/algorithms/memo.txt~
  25. 20 0
      add_linkselfie/algorithms/naive_nb.py
  26. 51 0
      add_linkselfie/algorithms/online_nb.py
  27. 60 0
      add_linkselfie/algorithms/succ_elim_nb.py
  28. 0 0
      add_linkselfie/dump.txt
  29. 95 0
      add_linkselfie/evalationmemo.txt
  30. 1 0
      add_linkselfie/evalationmemo.txt~
  31. 855 0
      add_linkselfie/evaluation.py
  32. 145 0
      add_linkselfie/main.py
  33. 131 0
      add_linkselfie/memo.txt
  34. 108 0
      add_linkselfie/memo.txt~
  35. 209 0
      add_linkselfie/nb_protocol.py
  36. 111 0
      add_linkselfie/network.py
  37. BIN
      add_linkselfie/outputs/plot_accuracy_vs_budget_Depolar.pickle
  38. BIN
      add_linkselfie/outputs/plot_ciwidth_best_vs_budget_Depolar_max_bestby-mean.pickle
  39. 361 0
      add_linkselfie/outputs/plot_ciwidth_best_vs_budget_Depolar_max_bestby-mean_gaps.csv
  40. 361 0
      add_linkselfie/outputs/plot_ciwidth_best_vs_budget_Depolar_max_bestby-mean_widths.csv
  41. BIN
      add_linkselfie/outputs/plot_ciwidth_best_vs_budget_Depolar_mean_bestby-mean.pickle
  42. 361 0
      add_linkselfie/outputs/plot_ciwidth_best_vs_budget_Depolar_mean_bestby-mean_gaps.csv
  43. 361 0
      add_linkselfie/outputs/plot_ciwidth_best_vs_budget_Depolar_mean_bestby-mean_widths.csv
  44. BIN
      add_linkselfie/outputs/plot_ciwidth_vs_budget_Depolar_max.pickle
  45. 361 0
      add_linkselfie/outputs/plot_ciwidth_vs_budget_Depolar_max_widths.csv
  46. BIN
      add_linkselfie/outputs/plot_ciwidth_vs_budget_Depolar_mean.pickle
  47. 361 0
      add_linkselfie/outputs/plot_ciwidth_vs_budget_Depolar_mean_widths.csv
  48. BIN
      add_linkselfie/outputs/plot_minwidthsum_perpair_vs_budget_Depolar.pickle
  49. BIN
      add_linkselfie/outputs/plot_minwidthsum_perpair_weighted_vs_budget_Depolar.pickle
  50. BIN
      add_linkselfie/outputs/plot_widthsum_alllinks_vs_budget_Depolar.pickle
  51. BIN
      add_linkselfie/outputs/plot_widthsum_alllinks_weighted_vs_budget_Depolar.pickle
  52. BIN
      add_linkselfie/plot_accuracy_vs_budget_Depolar.pdf
  53. BIN
      add_linkselfie/plot_ciwidth_best_vs_budget_Depolar_max_bestby-mean.pdf
  54. BIN
      add_linkselfie/plot_ciwidth_best_vs_budget_Depolar_max_bestby-mean_gap.pdf
  55. BIN
      add_linkselfie/plot_ciwidth_best_vs_budget_Depolar_mean_bestby-mean.pdf
  56. BIN
      add_linkselfie/plot_ciwidth_best_vs_budget_Depolar_mean_bestby-mean_gap.pdf
  57. BIN
      add_linkselfie/plot_ciwidth_vs_budget_Depolar_max.pdf
  58. BIN
      add_linkselfie/plot_ciwidth_vs_budget_Depolar_mean.pdf
  59. BIN
      add_linkselfie/plot_minwidthsum_perpair_vs_budget_Depolar.pdf
  60. BIN
      add_linkselfie/plot_minwidthsum_perpair_weighted_vs_budget_Depolar.pdf
  61. BIN
      add_linkselfie/plot_value_vs_budget_Depolar.pdf
  62. BIN
      add_linkselfie/plot_value_vs_budget_target_Depolar.pdf
  63. BIN
      add_linkselfie/plot_value_vs_used_Depolar.pdf
  64. BIN
      add_linkselfie/plot_weighted_errorrate_vs_budget_Depolar.pdf
  65. BIN
      add_linkselfie/plot_widthsum_alllinks_vs_budget_Depolar.pdf
  66. BIN
      add_linkselfie/plot_widthsum_alllinks_weighted_vs_budget_Depolar.pdf
  67. 26 0
      add_linkselfie/schedulers/__init__.py
  68. 37 0
      add_linkselfie/schedulers/__init__.py~
  69. BIN
      add_linkselfie/schedulers/__pycache__/__init__.cpython-38.pyc
  70. BIN
      add_linkselfie/schedulers/__pycache__/greedy_scheduler.cpython-38.pyc
  71. BIN
      add_linkselfie/schedulers/__pycache__/lnaive_nb.cpython-38.pyc
  72. BIN
      add_linkselfie/schedulers/__pycache__/lnaive_scheduler.cpython-38.pyc
  73. BIN
      add_linkselfie/schedulers/__pycache__/lonline_nb.cpython-38.pyc
  74. BIN
      add_linkselfie/schedulers/__pycache__/pac_greedy_scheduler.cpython-38.pyc
  75. BIN
      add_linkselfie/schedulers/__pycache__/pac_naive_scheduler.cpython-38.pyc
  76. BIN
      add_linkselfie/schedulers/__pycache__/pac_wrapper.cpython-38.pyc
  77. 95 0
      add_linkselfie/schedulers/greedy_scheduler.py
  78. 91 0
      add_linkselfie/schedulers/greedy_scheduler.py~
  79. 65 0
      add_linkselfie/schedulers/lnaive_nb.py
  80. 55 0
      add_linkselfie/schedulers/lnaive_scheduler.py
  81. 37 0
      add_linkselfie/schedulers/lnaive_scheduler.py~
  82. 113 0
      add_linkselfie/schedulers/lonline_nb.py
  83. 35 0
      add_linkselfie/schedulers/memo.txt
  84. 11 0
      add_linkselfie/schedulers/memo.txt~
  85. 278 0
      add_linkselfie/utils.py
  86. 171 0
      memo.org
  87. 124 0
      memo.org~

+ 145 - 0
#memo.org#

@@ -0,0 +1,145 @@
+** 現段階で決まっている実験で取るデータの種類
+
+- linkselfieでやってる系の実験
+  - エラー率をとる
+    - リンク群の中から忠実度が最も高いリンクを選べる確率を手法ごとに
+      - 縦軸 エラー率
+      - 横軸 測定予算
+  - 忠実度のgapを変える
+    - リンク群の中から最も高い忠実度とそれ以外のリンクの忠実度が今は別
+      の分布から出力されている。忠実度平均が0.9が1本、それ以外の4本は平均
+      0.85から出力するなど設定されている。
+      - linkselfieでは横軸 gap, 縦軸 バウンスだった
+      - 本実験では、横軸 gap, 縦軸 エラー率 (gapが小さいと他のリンクに
+        手が回らなくなり、提案手法が劣る結果になるはず)?
+  - ノイズモデルを増やす
+    - 他の3つのノイズモデルで実験をとる
+
+
+
+- linkselfieでやってない系の実験
+- 重要度が一様分布
+  - 重要度が何を考慮しているかによる。
+    - 通信需要やそれ以外の要因をまとめて重要度という指標でブラックボッ
+      クス化しているなら何を分布を使うのが最適か考える
+
+- リンクの本数を全てのノードペア間で5本にしているが、現実的ではない
+  - ランダムにリンクの本数を変える?
+  - 特定の分布からリンクの本数を決める?
+    - 事前にリンクの本数を知っていることが前提なので、ノードペア間のリ
+      ンクの本数を重要度に与えるのもあり?
+      
+- gapがある状態で実験しているのがそもそもおかしい?
+  - gapを0にして今回の実験をするとどうなるか
+
+- 隣接ノード数を変える
+  - 横軸隣接ノード数、縦軸総価値スコア(sum f*w*b)
+
+- 総価値スコアを変える(足す。)
+  - 提案手法に有利すぎ。評価指標として適切ではない。重要度x忠実度が最
+    も高いリンクに全てのバウンスをかける手法が一番すごいことになるが、
+    linkselfieは一定以上のバウンスをかけない仕組みになっている。これは
+    最も忠実度が高いリンクにバウンスをかけて高精度な推定をすることを目
+    的としているがコストをかければかけるほどいいという意味ではない。
+    精度と測定資源の節約のトレードオフを信頼度deltaという変数で制御し
+    ているところがすごいのにその目的から逸れた手法が勝ってしまうような
+    評価指標になっているのが問題。なので評価指標に忠実度のエラー率を組
+    みこんだような指標にするべき。
+    - 信頼度をあらかじめ設定する。90%で最も忠実度が高いリンクを選ぶよ
+      うな通信をしたい状況を考えるのなら、linkselfieでdelta = 0.1にし
+      てトポロジを揃えて実験をし、理想的なバウンスのかけかたを算出し、
+      それとどの程度離れているかを調べるなど。
+      - linkselfieを理想的なバウンスのかけ方としたが、自分で考えてもい
+        い(時間あるなら)
+
+	
+- 処理時間を考える。計算量
+
+
+- ベースライン
+  - linkselfieだけ
+  - 素朴にやるならどうか
+    - unirom-linkselfieとnaive以外を考える
+
+      
+- ストーリーどうするか
+  - 全く変えないのは違う
+  - 大きな論文を書くためのストーリーをかく
+
+- iccはのびる
+  - 28ではない予定(2週間から1ヶ月伸びる)
+
+- 現状のストーリーを考える
+  - 作って変えてをくりかえす
+    
+
+
+
+
+
+
+背景 重要度が大事
+
+linkselfie 高精度な推定と測定予算をできるだけ削る。トレードオフ
+信頼度 delta
+
+トレードオフを調節する値
+
+
+総価値スコア sum(w x sum(fxb))
+maxなとき... 重要度が最も高い宛先の最も忠実度が高いリンクに全てのバウ
+ンスをかければ最大となるのがおかしい?
+
+->いいのがみつかったらそれでいく
+
+
+
+現状
+背景 量子ネットワークにおいて忠実度を高いリンクを効率的に判定する手法 LinkSelFiE が提案されている
+動機 LinkSelFiE は通信需要を考慮していないが、現実には通信需要が高くかつ忠実度の高いリンクの判定が望まれる
+目的 少ない計測 (バウンス) により利用率 x 忠実度が高いリンクの判定を可能とする
+
+
+linkselfie -> 1本の最高忠実度のリンクを探す
+提案手法 -> 1つの宛先ノード?利用率次第?
+
+
+背景、動機を考える
+
+ストーリー案を考える
+
+実験はいろんなやつをとる
+
+実験ごとに実験の目的を書く
+- なんでその実験をしたのか
+
+
+順番にとっていく
+実験の目的のリスト
+とりやすい実験からとっていく
+
+
+ストーリー案を考えて実験をとる
+-> そこから実験をして意味のある結果がとれるのか
+それと実験の種類
+
+月曜までにストーリー案3つ
+
+背景 量子ネットワークにおいて忠実度を高いリンクを効率的に判定する手法 LinkSelFiE が提案されている
+動機 LinkSelFiE は通信需要を考慮していないが、現実には通信需要が高くかつ忠実度の高いリンクの判定が望まれる
+目的 少ない計測 (バウンス) により利用率 x 忠実度が高いリンクの判定を可能とする
+
+** ストーリー案
+- 骨格
+
+背景 量子ネットワークにおいて忠実度を高いリンクを効率的に判定する手法 LinkSelFiE が提案されている
+動機 LinkSelFiE は通信需要を考慮していないが、現実には通信需要が高くかつ忠実度の高いリンクの判定が望まれる
+目的 少ない計測 (バウンス) により利用率 x 忠実度が高いリンクの判定を可能とする
+
+*** ストーリー案1
+- 背景 量子ネットワークにおいて忠実度を高いリンクを効率的に判定する手
+  法 LinkSelFiE が提案されている。
+
+
+- 動機
+- 目的

+ 1 - 0
.#memo.org

@@ -0,0 +1 @@
+shun@a.1281:1756281689

+ 25 - 0
add_linkselfie/#pickele#

@@ -0,0 +1,25 @@
+python - <<'PY'
+import sys, json, pickle
+from pathlib import Path
+import numpy as np
+
+def to_jsonable(x):
+    if isinstance(x, dict):
+        return {str(k): to_jsonable(v) for k,v in x.items()}
+    if isinstance(x, (list, tuple, set)):
+        return [to_jsonable(v) for v in x]
+    if isinstance(x, (np.integer,)): return int(x)
+    if isinstance(x, (np.floating,)): return float(x)
+    if isinstance(x, (np.ndarray,)): return x.tolist()
+    try:
+        json.dumps(x); return x
+    except Exception:
+        return str(x)
+
+path = Path(sys.argv[1])
+with open(path,"rb") as f:
+    obj = pickle.load(f)
+out = path.with_suffix(".json")
+out.write_text(json.dumps(to_jsonable(obj), ensure_ascii=False, indent=2))
+print("Wrote:", out)
+PY outputs/plot_ciwidth_best_vs_budget_Depolar_mean_bestby-mean.pickle

+ 1 - 0
add_linkselfie/.#pickele

@@ -0,0 +1 @@
+shun@a.1236:1757736525

+ 21 - 0
add_linkselfie/LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2023 Zhuohua Li (ANSRLab@CUHK)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 100 - 0
add_linkselfie/MEMO.org

@@ -0,0 +1,100 @@
+# add_linkselfie – I/O & Loops memo
+
+## main.py
+**Inputs**
+- 実験パラメータ: `budget_list`, `scheduler_names`, `noise_model_names`, `node_path_list`, `importance_list`, `bounces`, `repeat`
+
+**Outputs**
+- `evaluation.py` の各関数を並列実行 → `outputs/*.pdf` を生成
+
+**Loops**
+- `for noise_model in noise_model_names:`
+  - `Pool.apply_async(...)` で
+    - `plot_accuracy_vs_budget(...)`
+    - `plot_value_vs_used(...)`
+    - `plot_value_vs_budget_target(...)`
+  - 最後に `join()` して回収
+
+---
+
+## evaluation.py
+### plot_accuracy_vs_budget(...)
+**Inputs**: 予算列・スケジューラ名・ノイズモデル・ノード/重要度・`bounces`・`repeat`  
+**Outputs**: `outputs/plot_accuracy_vs_budget_{noise_model}.pdf`  
+**Loops**:
+- `for C_total in budget_list:`  
+  - `for r in range(repeat):`
+    - トポロジ生成(ペアごとに fidelity リスト)
+    - `for name in scheduler_names:` → `run_scheduler(...)`
+      - 正答率を集計(平均)
+
+### plot_value_vs_used(...)
+**Inputs**: 同上(`return_details=True` で呼ぶ)  
+**Outputs**: `outputs/plot_value_vs_used_{noise_model}.pdf`(x=実消費コスト平均)  
+**Loops**:
+- `for C_total in budget_list:`
+  - `for r in range(repeat):`
+    - トポロジ生成
+    - `for name in scheduler_names:` → `run_scheduler(..., return_details=True)`
+      - 受け取った `alloc_by_path` と `est_fid_by_path` で価値を合成
+      - `total_cost` を保持
+
+### plot_value_vs_budget_target(...)
+**Inputs**: 同上(`return_details=True` で呼ぶ)  
+**Outputs**: `outputs/plot_value_vs_budget_target_{noise_model}.pdf`(x=目標予算)  
+**Loops**: `plot_value_vs_used` と同一(プロット時の x だけ `budget_list`)
+
+---
+
+## schedulers/__init__.py
+**Inputs**: `node_path_list`, `importance_list`, `scheduler_name`, `bounces`, `C_total`, `network_generator`, `return_details`  
+**Outputs**:
+- `"LNaive"` → `lnaive_budget_scheduler(...)` の戻り値をそのまま返す  
+- `"Greedy"` → `greedy_budget_scheduler(...)` の戻り値をそのまま返す  
+**Loops**: なし(ディスパッチのみ)
+
+---
+
+## schedulers/lnaive_scheduler.py
+**Inputs**: `node_path_list`, `importance_list`, `bounces`, `C_total`, `network_generator`, `return_details=False`  
+**Outputs**:
+- `per_pair_results: List[(correct: bool, cost: int, best_fid: float|None)]`
+- `total_cost: int`
+- `per_pair_details: List[{alloc_by_path, est_fid_by_path}]`(`return_details=True` のとき)
+**Loops**:
+- `for pair_idx, path_num in enumerate(node_path_list):`
+  - 各ペアに等分配した予算で `naive_network_benchmarking_with_budget(...)` を1回呼ぶ
+
+---
+
+## schedulers/greedy_scheduler.py
+**Inputs**: `node_path_list`, `importance_list`, `bounces`, `C_total`, `network_generator`, `C_initial_per_pair=40`, `return_details=False`  
+**Outputs**: 上記 LNaive と同形(初期+残余の詳細はマージ)  
+**Loops**:
+1) **初期プローブ**: `for pair_idx, path_num in enumerate(node_path_list):`
+   - 小予算で `lonline_network_benchmarking(...)` を実行
+2) **優先度計算**: `score = importance * estimated_fidelity` を全ペアで算出し降順ソート
+3) **残余配分**: `for pair_idx in sorted_indices:` 残り予算を順に集中投資(各回 `lonline_network_benchmarking(...)`)
+
+---
+
+## schedulers/lonline_nb.py (アルゴ:L-Online)
+**Inputs**: `network`, `path_list`, `bounces`, `C_budget`, `return_details=False`  
+**Outputs**:
+- `return_details=False`: `(correct: bool, cost: int, best_fid: float|None)`
+- `return_details=True` : 上に加え `alloc_by_path: {path_id:int}`, `est_fid_by_path: {path_id:float}`
+**Loops**:
+- `while cost < C_budget and len(candidate_set) > 1:`
+  - ラウンド `s` のサンプル数 `Ns` を決定
+  - `for path in candidate_set:`(予算が入る分だけ計測)
+  - 連続削除ルールで候補を間引き
+
+---
+
+## schedulers/lnaive_nb.py (アルゴ:L-Naive)
+**Inputs**: `network`, `path_list`, `bounces`, `C_budget`, `return_details=False`  
+**Outputs**: L-Online と同形(3タプル/5タプル)  
+**Loops**:
+- `Ns = floor(C_budget / (len(path_list) * per_sample_cost))` を計算
+- `for path in path_list:` 各経路を同じ回数 `Ns` 測定して推定更新
+

+ 99 - 0
add_linkselfie/MEMO.org~

@@ -0,0 +1,99 @@
+# add_linkselfie – I/O & Loops memo
+
+## main.py
+**Inputs**
+- 実験パラメータ: `budget_list`, `scheduler_names`, `noise_model_names`, `node_path_list`, `importance_list`, `bounces`, `repeat`
+
+**Outputs**
+- `evaluation.py` の各関数を並列実行 → `outputs/*.pdf` を生成
+
+**Loops**
+- `for noise_model in noise_model_names:`
+  - `Pool.apply_async(...)` で
+    - `plot_accuracy_vs_budget(...)`
+    - `plot_value_vs_used(...)`
+    - `plot_value_vs_budget_target(...)`
+  - 最後に `join()` して回収
+
+---
+
+## evaluation.py
+### plot_accuracy_vs_budget(...)
+**Inputs**: 予算列・スケジューラ名・ノイズモデル・ノード/重要度・`bounces`・`repeat`  
+**Outputs**: `outputs/plot_accuracy_vs_budget_{noise_model}.pdf`  
+**Loops**:
+- `for C_total in budget_list:`  
+  - `for r in range(repeat):`
+    - トポロジ生成(ペアごとに fidelity リスト)
+    - `for name in scheduler_names:` → `run_scheduler(...)`
+      - 正答率を集計(平均)
+
+### plot_value_vs_used(...)
+**Inputs**: 同上(`return_details=True` で呼ぶ)  
+**Outputs**: `outputs/plot_value_vs_used_{noise_model}.pdf`(x=実消費コスト平均)  
+**Loops**:
+- `for C_total in budget_list:`
+  - `for r in range(repeat):`
+    - トポロジ生成
+    - `for name in scheduler_names:` → `run_scheduler(..., return_details=True)`
+      - 受け取った `alloc_by_path` と `est_fid_by_path` で価値を合成
+      - `total_cost` を保持
+
+### plot_value_vs_budget_target(...)
+**Inputs**: 同上(`return_details=True` で呼ぶ)  
+**Outputs**: `outputs/plot_value_vs_budget_target_{noise_model}.pdf`(x=目標予算)  
+**Loops**: `plot_value_vs_used` と同一(プロット時の x だけ `budget_list`)
+
+---
+
+## schedulers/__init__.py
+**Inputs**: `node_path_list`, `importance_list`, `scheduler_name`, `bounces`, `C_total`, `network_generator`, `return_details`  
+**Outputs**:
+- `"LNaive"` → `lnaive_budget_scheduler(...)` の戻り値をそのまま返す  
+- `"Greedy"` → `greedy_budget_scheduler(...)` の戻り値をそのまま返す  
+**Loops**: なし(ディスパッチのみ)
+
+---
+
+## schedulers/lnaive_scheduler.py
+**Inputs**: `node_path_list`, `importance_list`, `bounces`, `C_total`, `network_generator`, `return_details=False`  
+**Outputs**:
+- `per_pair_results: List[(correct: bool, cost: int, best_fid: float|None)]`
+- `total_cost: int`
+- `per_pair_details: List[{alloc_by_path, est_fid_by_path}]`(`return_details=True` のとき)
+**Loops**:
+- `for pair_idx, path_num in enumerate(node_path_list):`
+  - 各ペアに等分配した予算で `naive_network_benchmarking_with_budget(...)` を1回呼ぶ
+
+---
+
+## schedulers/greedy_scheduler.py
+**Inputs**: `node_path_list`, `importance_list`, `bounces`, `C_total`, `network_generator`, `C_initial_per_pair=40`, `return_details=False`  
+**Outputs**: 上記 LNaive と同形(初期+残余の詳細はマージ)  
+**Loops**:
+1) **初期プローブ**: `for pair_idx, path_num in enumerate(node_path_list):`
+   - 小予算で `lonline_network_benchmarking(...)` を実行
+2) **優先度計算**: `score = importance * estimated_fidelity` を全ペアで算出し降順ソート
+3) **残余配分**: `for pair_idx in sorted_indices:` 残り予算を順に集中投資(各回 `lonline_network_benchmarking(...)`)
+
+---
+
+## schedulers/lonline_nb.py (アルゴ:L-Online)
+**Inputs**: `network`, `path_list`, `bounces`, `C_budget`, `return_details=False`  
+**Outputs**:
+- `return_details=False`: `(correct: bool, cost: int, best_fid: float|None)`
+- `return_details=True` : 上に加え `alloc_by_path: {path_id:int}`, `est_fid_by_path: {path_id:float}`
+**Loops**:
+- `while cost < C_budget and len(candidate_set) > 1:`
+  - ラウンド `s` のサンプル数 `Ns` を決定
+  - `for path in candidate_set:`(予算が入る分だけ計測)
+  - 連続削除ルールで候補を間引き
+
+---
+
+## schedulers/lnaive_nb.py (アルゴ:L-Naive)
+**Inputs**: `network`, `path_list`, `bounces`, `C_budget`, `return_details=False`  
+**Outputs**: L-Online と同形(3タプル/5タプル)  
+**Loops**:
+- `Ns = floor(C_budget / (len(path_list) * per_sample_cost))` を計算
+- `for path in path_list:` 各経路を同じ回数 `Ns` 測定して推定更新

+ 34 - 0
add_linkselfie/README.md

@@ -0,0 +1,34 @@
+# LinkSelFiE: Link Selection and Fidelity Estimation in Quantum Networks
+
+[![DOI](https://zenodo.org/badge/737247284.svg)](https://zenodo.org/doi/10.5281/zenodo.10444443)
+
+This repository contains the source code for reproducing the results of our INFOCOM'24 paper titled *LinkSelFiE: Link Selection and Fidelity Estimation in Quantum Networks*.
+
+## Prerequisites
+
+To get started, ensure you have the following packages installed:
+
+[NetSquid](https://netsquid.org/), scipy, matplotlib
+
+## Repository Structure
+
+* [algorithms](./algorithms): Implementation of various link selection & fidelity estimation algorithms.
+    * [naive_nb.py](./algorithms/naive_nb.py): The naive algorithm based on network benchmarking.
+    * [online_nb.py](./algorithms/online_nb.py): Our proposed LinkSelFiE algorithm.
+    * [succ_elim_nb.py](./algorithms/succ_elim_nb.py): A successive elimination-based network benchmarking algorithm.
+* [evaluation.py](./evaluation.py): Script to visualize evaluation results and generate figures in the paper.
+* [nb_protocol.py](./nb_protocol.py): Implementation of the network benchmarking protocol.
+* [network.py](./network.py): Builds the quantum network structure for the experiments.
+* [utils](./utils.py): A collection of helper functions.
+
+## How to Run
+
+Execute the following command to reproduce all the figures in the paper:
+
+```sh
+python main.py
+```
+
+## License
+
+See [LICENSE](LICENSE)

BIN
add_linkselfie/__pycache__/evaluation.cpython-38.pyc


BIN
add_linkselfie/__pycache__/nb_protocol.cpython-38.pyc


BIN
add_linkselfie/__pycache__/network.cpython-38.pyc


BIN
add_linkselfie/__pycache__/utils.cpython-38.pyc


+ 20 - 0
add_linkselfie/algorithms/__init__.py

@@ -0,0 +1,20 @@
+from .naive_nb import naive_network_benchmarking  # noqa: F401
+from .online_nb import online_network_benchmarking  # noqa: F401
+from .lonline_nb import lonline_network_benchmarking  # noqa: F401
+from .succ_elim_nb import \
+    successive_elimination_network_benchmarking  # noqa: F401
+
+
+def benchmark_using_algorithm(network, path_list, algorithm_name, bounces, sample_times,C_budget=None):
+    if algorithm_name == "Vanilla NB":
+        return naive_network_benchmarking(network, path_list, bounces, sample_times)
+    elif algorithm_name == "LinkSelFiE":
+        return online_network_benchmarking(network, path_list, bounces)
+    elif algorithm_name == "LimitLinkSelFiE":
+        return lonline_network_benchmarking(network, path_list, bounces, C_budget)
+
+    elif algorithm_name == "Succ. Elim. NB":
+        return successive_elimination_network_benchmarking(network, path_list, bounces)
+    else:
+        print("Error: Unknown algorithm name")
+        exit(1)

BIN
add_linkselfie/algorithms/__pycache__/__init__.cpython-38.pyc


BIN
add_linkselfie/algorithms/__pycache__/lonline_nb.cpython-38.pyc


BIN
add_linkselfie/algorithms/__pycache__/naive_nb.cpython-38.pyc


BIN
add_linkselfie/algorithms/__pycache__/online_nb.cpython-38.pyc


BIN
add_linkselfie/algorithms/__pycache__/succ_elim_nb.cpython-38.pyc


+ 40 - 0
add_linkselfie/algorithms/lnaive_nb.py

@@ -0,0 +1,40 @@
+# lnaive_nb.py
+def naive_network_benchmarking_with_budget(network, path_list, bounces, C_budget):
+    """
+    目的:
+      総予算 C_budget を各パスへ均等割り当てし、均等サンプリングで NB を実行。
+      実行コストは常に予算内(超過しない)。
+
+    出力:
+      (correctness, cost, best_path_fidelity)
+        correctness … 推定最良パスが真の最良と一致したか
+        cost        … 実測で消費した総コスト
+        best_path_fidelity … 推定最良パスの推定忠実度(naive変換後)
+    """
+    fidelity, cost = {}, 0
+    n_paths = len(path_list)
+    if n_paths == 0:
+        return False, 0, None
+
+    per_sample_cost = sum(bounces) or 1
+    per_path_budget = int(C_budget) // n_paths
+    Ns = per_path_budget // per_sample_cost  # 各パスのサンプル数
+    if Ns <= 0:
+        return False, 0, None
+
+    # 各 hop に同じ Ns を配る(既存 naive と同じ割当表)
+    sample_times = {h: int(Ns) for h in bounces}
+
+    # 各パスを均等回数でベンチマーク
+    for path in path_list:
+        p, used = network.benchmark_path(path, bounces, sample_times)
+        fidelity[path] = p + (1 - p) / 2  # 既存 naive と同じ忠実度変換
+        cost += used
+
+    if not fidelity:
+        return False, cost, None
+
+    best_path = max(fidelity, key=fidelity.get)
+    correctness = (best_path == getattr(network, "best_path", None))
+    best_path_fidelity = fidelity[best_path]
+    return correctness, cost, best_path_fidelity

+ 20 - 0
add_linkselfie/algorithms/lnaive_nb.py~

@@ -0,0 +1,20 @@
+def naive_network_benchmarking(network, path_list, bounces, sample_times):
+    fidelity = {}
+    cost = 0
+
+    # ガード: サンプル0なら何もしない
+    if sample_times and not any(sample_times.values()):
+        return 0, 0, None
+
+    for path in path_list:
+        p, bounces_num = network.benchmark_path(path, bounces, sample_times)
+        fidelity[path] = p + (1 - p) / 2
+        cost += bounces_num
+
+    if not fidelity:               # ガード: path_list空など
+        return 0, cost, None
+
+    best_path = max(fidelity, key=fidelity.get)
+    correctness = (best_path == network.best_path)
+    best_path_fidelity = fidelity[best_path]
+    return correctness, cost, best_path_fidelity

+ 68 - 0
add_linkselfie/algorithms/lonline_nb.py

@@ -0,0 +1,68 @@
+import math
+
+def lonline_network_benchmarking(network, path_list, bounces, C_budget):
+    candidate_set = list(path_list)
+    s = 0
+    C = 0.01     
+    delta = 0.1  
+    cost = 0
+    estimated_fidelities = {}
+
+    # 1経路を1サンプル測る想定コスト(list 前提)
+    cost_per_sample_unit = sum(bounces) if sum(bounces) > 0 else 1
+
+    while cost < C_budget and len(candidate_set) > 1:
+        s += 1
+        Ns = math.ceil(C * (2 ** (2 * s)) * math.log2(max((2 ** s) * len(candidate_set) / delta, 2)))
+        if Ns < 4:
+            Ns = 4
+
+        # --- 事前コスト見積り(lonline準拠) ---
+        cost_needed_for_one_path = Ns * cost_per_sample_unit
+        # 2ラウンド目以降で1経路ぶんすら入らないなら終了
+        if cost + cost_needed_for_one_path > C_budget and s > 1:
+            break
+        # 1ラウンド目だけは Ns を縮退してでも1回は回す(入らなければ中止)
+        """
+        if cost + cost_needed_for_one_path > C_budget and s == 1:
+            Ns_fit = (C_budget - cost) // max(cost_per_sample_unit, 1)
+            if Ns_fit <= 0:
+                break
+            Ns = int(Ns_fit)
+            cost_needed_for_one_path = Ns * cost_per_sample_unit
+        """
+        # ---------------------------------------
+
+        sample_times = {i: Ns for i in bounces}
+
+        p_s = {}
+        measured_paths = []  # このラウンドで実際に測れた経路だけを削除判定に使う
+        for path in list(candidate_set):
+            if cost + cost_needed_for_one_path > C_budget:
+                continue  # 予算に入らない経路はこのラウンドはスキップ
+            p, bounces_num = network.benchmark_path(path, bounces, sample_times)
+            cost += bounces_num
+            estimated_fidelities[path] = p + (1 - p) / 2  # ★ 既存式&変数名を踏襲
+            p_s[path] = p
+            measured_paths.append(path)
+
+        if not p_s:
+            break  # このラウンドで1つも測れなかった
+
+        # online_nb.py と同じ 2^{-s} 幅の連続削除
+        p_max = max(p_s.values())
+        new_candidate_set = []
+        for path in measured_paths:  # 測れたものだけで判定(KeyError防止)
+            if p_s[path] + 2**(-s) > p_max - 2**(-s):
+                new_candidate_set.append(path)
+
+        # もし全消しになったら、保険として現集合を維持
+        candidate_set = new_candidate_set or candidate_set
+
+    if not estimated_fidelities:
+        return None, cost, None
+
+    best_path = max(estimated_fidelities, key=estimated_fidelities.get)
+    best_path_fidelity = estimated_fidelities[best_path]
+    correctness = (best_path == getattr(network, "best_path", None))
+    return correctness, cost, best_path_fidelity

+ 45 - 0
add_linkselfie/algorithms/lonline_nb.py~

@@ -0,0 +1,45 @@
+def _online_network_benchmarking_truly_strict(network, path_list, bounces, C_budget):
+    candidate_set = list(path_list)
+    s = 0
+    C_const = 0.01
+    delta = 0.1
+    cost = 0
+    estimated_fidelities = {}
+    
+
+    cost_per_sample_unit = sum(bounces)
+    if cost_per_sample_unit == 0:
+        cost_per_sample_unit = 1
+
+    while cost < C_budget and len(candidate_set) > 1:
+        s += 1
+        Ns = math.ceil(C_const * 2**(2 * s) * math.log2(2**s * len(candidate_set) / delta))
+        if Ns < 4:
+            Ns = 4
+        
+        cost_needed_for_one_path = Ns * cost_per_sample_unit
+        if cost + cost_needed_for_one_path > C_budget and s > 1:
+             break
+
+        p_s = {}
+        sample_times = {i: Ns for i in bounces}
+        for path in candidate_set:
+            if cost + cost_needed_for_one_path > C_budget:
+                continue
+            p, bounces_num = network.benchmark_path(path, bounces, sample_times)
+            cost += bounces_num
+            estimated_fidelity = p + (1 - p) / 2
+            estimated_fidelities[path] = estimated_fidelity
+            p_s[path] = p
+        if not p_s:
+            break
+        p_max = max(p_s.values())
+        new_candidate_set = [path for path in candidate_set if path in p_s and p_s[path] + 2**(-s) > p_max - 2**(-s)]
+        candidate_set = new_candidate_set
+        
+    if not estimated_fidelities:
+
+    best_path = max(estimated_fidelities, key=estimated_fidelities.get)
+    best_path_fidelity = estimated_fidelities[best_path]
+    correctness = (best_path == network.best_path)
+

+ 27 - 0
add_linkselfie/algorithms/memo.txt

@@ -0,0 +1,27 @@
+入力
+network(オブジェクト)
+
+ここは“実験器”役。内部で乱数やノイズモデルを使ってOK
+
+path_list(list)
+
+測定対象のパスの集合(例:[1, 2, 3, 4] やタプルの列など)
+
+bounces(list)
+
+1回の経路ベンチマークで各 hop が消費する重み(コスト)
+例:[1, 2, 3, 4] → 1サンプルの概算コストは sum(bounces)=10
+
+C_budget(int)
+
+総測定予算(絶対に超えない)
+
+
+
+
+出力
+correctness: 選んだパスが真の最良パスかどうか(True/False)
+
+cost: 使った総コスト
+
+best_path_fidelity: 選んだパスの推定忠実度

+ 5 - 0
add_linkselfie/algorithms/memo.txt~

@@ -0,0 +1,5 @@
+correctness: 選んだパスが真の最良パスかどうか(True/False)
+
+cost: 使った総コスト
+
+best_path_fidelity: 選んだパスの推定忠実度

+ 20 - 0
add_linkselfie/algorithms/naive_nb.py

@@ -0,0 +1,20 @@
+import numpy as np
+
+
+def naive_network_benchmarking(network, path_list, bounces, sample_times):
+    '''Perform vanilla network benchmarking for each path in the `path_list`.
+    Return a tuple: (a list of fidelities, the total number of bounces).
+    '''
+    fidelity = {}
+    cost = 0
+    for path in path_list:
+        p, bounces_num = network.benchmark_path(path, bounces, sample_times)
+        # fidelity.append(result)
+        fidelity[path] = p + (1 - p) / 2  # Convert the estimated depolarizing parameter `p` into fidelity
+        cost += bounces_num
+    # print("Estimated fidelity:", fidelity)
+    # best_path = np.argmax(fidelity) + 1
+    best_path = max(fidelity, key=fidelity.get)
+    correctness = best_path == network.best_path
+    best_path_fidelity = fidelity[best_path]
+    return correctness, cost, best_path_fidelity

+ 51 - 0
add_linkselfie/algorithms/online_nb.py

@@ -0,0 +1,51 @@
+import math
+
+
+def online_network_benchmarking(network, path_list, bounces):
+    # Initialization
+    candidate_set = path_list
+    s = 0  # Phase
+    C = 0.01  # Constant
+    delta = 0.1  # Error
+    cost = 0
+    estimated_fidelities = {}
+    # error_probability = {}  # Map bounces number to the probability that the arm with largest mean is not the best arm
+    # epoch_len = 20
+    # epoch = 0
+    # correct_times = 0
+    while len(candidate_set) > 1:
+        s += 1
+        Ns = math.ceil(C * 2**(2 * s) * math.log2(2**s * len(candidate_set) / delta))
+        if Ns < 4:
+            Ns = 4
+        # print(f"Ns: {Ns}")
+        sample_times = {}
+        for i in bounces:
+            sample_times[i] = Ns
+
+        p_s = {}
+        for path in candidate_set:
+            p, bounces_num = network.benchmark_path(path, bounces, sample_times)
+            # print(f"Estimated Fidelity of path {path}: {p}")
+            # Convert the estimated depolarizing parameter `p` into fidelity
+            estimated_fidelities[path] = p + (1 - p) / 2
+            p_s[path] = p
+            cost += bounces_num
+        p_max = max(p_s.values())
+        # current_best_path = max(p_s, key=p_s.get)
+        # if current_best_path == network.best_path:
+        #     correct_times += 1
+        new_candidate_set = []
+        for path in candidate_set:
+            # print(f"p_s[path] + 2**(-s): {p_s[path] + 2**(-s)}")
+            # print(f"p_max - 2**(-s): {p_max - 2**(-s)}")
+            if p_s[path] + 2**(-s) > p_max - 2**(-s):
+                new_candidate_set.append(path)
+        candidate_set = new_candidate_set
+
+    assert len(candidate_set) == 1
+    best_path = candidate_set[0]
+    correctness = best_path == network.best_path
+    best_path_fidelity = estimated_fidelities[best_path]
+    # print(f"Best path: {best_path}, estimated parameter p: {p_s[best_path]}, cost: {cost}")
+    return correctness, cost, best_path_fidelity

+ 60 - 0
add_linkselfie/algorithms/succ_elim_nb.py

@@ -0,0 +1,60 @@
+import math
+
+
+def successive_elimination_network_benchmarking(network, path_list, bounces):
+    # Initialization
+    L = len(path_list)
+    active_set = path_list
+    C = 0.15
+    N = 4
+    cost = 0
+    delta = 0.1
+    sample_times = {}
+    for i in bounces:
+        sample_times[i] = N
+
+    mean = {path: 0 for path in path_list}
+    n = {path: 0 for path in path_list}
+    t = 0
+    while len(active_set) > 1:
+        t += 1
+        ucb = {}
+        lcb = {}
+        for path in active_set:
+            p, bounces_num = network.benchmark_path(path, bounces, sample_times)
+            if p > 1.5:
+                print(f"Get an abnormal p={p}")
+            cost += bounces_num
+            mean[path] = (mean[path] * n[path] + p) / (n[path] + 1)
+            n[path] += 1
+            r = C * math.sqrt(math.log(4 * L * t * t / delta) / (2 * t))
+            # print(f"r={r}, {math.log(4 * L * t * t / delta)}")
+            ucb[path] = mean[path] + r
+            lcb[path] = mean[path] - r
+            # print(f"mean[{path}] = {mean[path]}")
+            # print(f"ucb[{path}] = {ucb[path]}")
+            # print(f"lcb[{path}] = {lcb[path]}")
+        new_active_set = []
+        for path1 in active_set:
+            ok = True
+            for path2 in active_set:
+                if path1 != path2 and ucb[path1] < lcb[path2]:
+                    ok = False
+                    break
+            if ok:
+                new_active_set.append(path1)
+
+        active_set = new_active_set
+        # print(f"Length of active set: {len(active_set)}")
+
+    assert len(active_set) == 1
+    best_path = active_set[0]
+    correctness = best_path == network.best_path
+    # print(f"Succ Elim NB: Best path: {best_path}, estimated parameter p: {mean[best_path]}, cost: {cost}")
+    estimated_fidelity = {}
+    for path in path_list:
+        p = mean[path]
+        # Convert the estimated depolarizing parameter `p` into fidelity
+        estimated_fidelity[path] = p + (1 - p) / 2
+    best_path_fidelity = estimated_fidelity[best_path]
+    return correctness, cost, best_path_fidelity

+ 0 - 0
add_linkselfie/dump.txt


+ 95 - 0
add_linkselfie/evalationmemo.txt

@@ -0,0 +1,95 @@
+ノードS〜ノードD 間のリンク集合 L だけでなく、
+ノードS〜ノードD_n間のリンク集合 L_n (1 <= n <= N, N はノードSの隣接ノード数)がそれぞれ入力される。
+ノードS〜ノードD_n間の重要度 I_n (0〜1 の値) が入力として与えられる。
+総バウンスコスト C が入力として与えられる。
+この時、ノードS〜ノードD_n のノードペアの中で、
+K 個のノードペア (S, D_s_1), (S, D_s_2), ... (S, D_s_K) における
+忠実度が最大のリンクをそれぞれ発見する。
+ただし、発見するリンクのノードペア数 K は、
+重要度と忠実度の積の総和、つまり
+I = \sum_{k = 1}^K I_s_k * F_s_k 
+が最大となるように定める。
+ここで F_n は (S, D_n) 間において忠実度の最大のリンクの忠実度である。
+
+A. この拡張問題は、複数のノードペア (S, Dₙ) に対して、限られたリソース(バウンスコスト)の中で、重要なノードペアの
+高忠実度リンクを選定する最適化問題です。以下に、この問題の形式的な定義を記述します。
+
+
+--------------------------------------------------------
+
+この拡張問題を最適化問題として扱うにはどうすればいいのかを考えました
+->
+全リンクの I_d × (UB - LB) の総和 (重要度を幅に乗算)を最小化する最適化
+問題とする?方向性を考えてます
+
+ここで、UB,LBは信頼区間の上界と下界です。
+たくさん測定をするとUB-LBは小さくなります
+
+現時点では提案手法は予想とは裏腹にnaiveよりも性能が低いという結果にな
+りました。(提案手法では需要が高い宛先の中で忠実度が中程度のリンクに資
+源を割かないため)
+
+
+全リンクではなく、各宛先の最大推定忠実度のI_d × (UB - LB)
+7) plot_minwidthsum_perpair_weighted_vs_budget_{NOISE}.pdf
+のみで提案手法が性能が優れているという結果です。
+
+
+
+現段階で新しく実装している評価指標
+
+1) plot_accuracy_vs_budget_{NOISE}.pdf
+   - X軸: 目標予算 (Budget target)
+   - Y軸: 正答率の平均 (各ペアでベストリンクを正しく当てた割合の平均)
+   - 系列: スケジューラごと
+   - CI帯: なし (平均のみ)
+   - Pickle: ./outputs/plot_accuracy_vs_budget_{NOISE}.pickle (必要に応じて利用/保存)
+
+2) plot_value_vs_used_{NOISE}.pdf
+   - X軸: 実際に使用した測定コストの平均 (Total measured cost: used)
+   - Y軸: 総価値の平均 (各ペアの重要度 I_d × 推定忠実度 f_hat × 投入バウンス数 B の総和)
+   - 系列: スケジューラごと
+   - CI帯: なし
+   - Pickle: なし (PDFのみ)
+
+3) plot_value_vs_budget_target_{NOISE}.pdf
+   - X軸: 目標予算 (Budget target)
+   - Y軸: 総価値の平均 (定義は上と同じ: I_d × f_hat × B の総和)
+   - 系列: スケジューラごと
+   - CI帯: なし
+   - Pickle: なし (PDFのみ)
+
+4) plot_widthsum_alllinks_vs_budget_{NOISE}.pdf
+   - 定義: 全リンクの (UB - LB) の総和 (重要度は掛けない)
+           UB/LB は Hoeffding 半径に基づく信頼区間から計算
+   - X軸: 目標予算 (Budget target)
+   - Y軸: 全リンク (UB - LB) 総和の反復平均
+   - 系列: スケジューラごと
+   - CI帯: あり (平均 ± 95% CI)
+   - Pickle: ./outputs/plot_widthsum_alllinks_vs_budget_{NOISE}.pickle
+
+5) plot_minwidthsum_perpair_vs_budget_{NOISE}.pdf
+   - 定義: ペアごとに (UB - LB) の最小値を取り、その総和 (重要度は掛けない)
+           推定が無いペアは幅=1.0として加算 (保守的扱い)
+   - X軸: 目標予算 (Budget target)
+   - Y軸: ペア最小幅の総和の反復平均
+   - 系列: スケジューラごと
+   - CI帯: あり (平均 ± 95% CI)
+   - Pickle: ./outputs/plot_minwidthsum_perpair_vs_budget_{NOISE}.pickle
+
+6) plot_widthsum_alllinks_weighted_vs_budget_{NOISE}.pdf
+   - 定義: 全リンクの I_d × (UB - LB) の総和 (重要度を幅に乗算)
+   - X軸: 目標予算 (Budget target)
+   - Y軸: 重み付き全リンク幅総和の反復平均
+   - 系列: スケジューラごと
+   - CI帯: あり (平均 ± 95% CI)
+   - Pickle: ./outputs/plot_widthsum_alllinks_weighted_vs_budget_{NOISE}.pickle
+
+7) plot_minwidthsum_perpair_weighted_vs_budget_{NOISE}.pdf
+   - 定義: ペアごとの最小幅に I_d を掛け、その総和 (I_d × min_l(UB - LB) の合計)
+           推定が無いペアは I_d × 1.0 を加算 (保守的扱い)
+   - X軸: 目標予算 (Budget target)
+   - Y軸: 重み付きペア最小幅総和の反復平均
+   - 系列: スケジューラごと
+   - CI帯: あり (平均 ± 95% CI)
+   - Pickle: ./outputs/plot_minwidthsum_perpair_weighted_vs_budget_{NOISE}.pickle

+ 1 - 0
add_linkselfie/evalationmemo.txt~

@@ -0,0 +1 @@
+a

+ 855 - 0
add_linkselfie/evaluation.py

@@ -0,0 +1,855 @@
+# evaluation.py
+# Run evaluation and plot figures
+import math
+import os
+import pickle
+import time
+import shutil
+
+import matplotlib.pyplot as plt
+import numpy as np
+from cycler import cycler
+
+from algorithms import benchmark_using_algorithm  # may be used elsewhere
+from network import QuantumNetwork
+from schedulers import run_scheduler  # パッケージ化したものを使う
+
+# ---- Matplotlib style (IEEE-ish) ----
+plt.rc("font", family="Times New Roman")
+plt.rc("font", size=20)
+default_cycler = (
+    cycler(color=["#4daf4a", "#377eb8", "#e41a1c", "#984ea3", "#ff7f00", "#a65628"])
+    + cycler(marker=["s", "v", "o", "x", "*", "+"])
+    + cycler(linestyle=[":", "--", "-", "-.", "--", ":"])
+)
+plt.rc("axes", prop_cycle=default_cycler)
+
+
+# =========================
+# Fidelity generators
+# =========================
+def generate_fidelity_list_avg_gap(path_num):
+    result = []
+    fidelity_max = 1
+    fidelity_min = 0.9
+    gap = (fidelity_max - fidelity_min) / path_num
+    fidelity = fidelity_max
+    for _ in range(path_num):
+        result.append(fidelity)
+        fidelity -= gap
+    assert len(result) == path_num
+    return result
+
+
+def generate_fidelity_list_fix_gap(path_num, gap, fidelity_max=1):
+    result = []
+    fidelity = fidelity_max
+    for _ in range(path_num):
+        result.append(fidelity)
+        fidelity -= gap
+    assert len(result) == path_num
+    return result
+
+
+def generate_fidelity_list_random(path_num, alpha=0.95, beta=0.85, variance=0.1):
+    """Generate `path_num` links.
+    u_1 = alpha, u_i = beta for all i = 2, 3, ..., n.
+    Fidelity_i ~ N(u_i, variance), clipped to [0.8, 1].
+    Ensure the top-1 gap is large enough (> 0.02) for termination guarantees.
+    """
+    while True:
+        mean = [alpha] + [beta] * (path_num - 1)
+        result = []
+        for i in range(path_num):
+            mu = mean[i]
+            # Sample a Gaussian random variable and make sure its value is in the valid range
+            while True:
+                r = np.random.normal(mu, variance)
+                # Depolarizing noise and amplitude damping noise models require fidelity >= 0.5
+                # Be conservative: require >= 0.8
+                if 0.8 <= r <= 1.0:
+                    break
+            result.append(r)
+        assert len(result) == path_num
+        sorted_res = sorted(result, reverse=True)
+        # To guarantee the termination of algorithms, we require that the gap is large enough
+        if sorted_res[0] - sorted_res[1] > 0.02:
+            return result
+
+
+# =========================
+# Progress helpers (LinkSelfie風)
+# =========================
+def _start_timer():
+    return {"t0": time.time(), "last": time.time()}
+
+
+def _tick(timer):
+    now = time.time()
+    dt_total = now - timer["t0"]
+    dt_step = now - timer["last"]
+    timer["last"] = now
+    return dt_total, dt_step
+
+
+def _log(msg):
+    print(msg, flush=True)
+
+
+# =========================
+# Plots
+# =========================
+def plot_accuracy_vs_budget(
+    budget_list,          # e.g., [1000, 2000, 3000, ...] (x-axis)
+    scheduler_names,      # e.g., ["LNaive", "Greedy", ...]
+    noise_model,          # e.g., "Depolar"
+    node_path_list,       # e.g., [5, 5, 5]
+    importance_list,      # e.g., [0.4, 0.7, 1.0] (not used here, but kept for interface)
+    bounces=(1, 2, 3, 4),
+    repeat=10,
+    verbose=True,
+    print_every=1,
+):
+    file_name = f"plot_accuracy_vs_budget_{noise_model}"
+    root_dir = os.path.dirname(os.path.abspath(__file__))
+    output_dir = os.path.join(root_dir, "outputs")
+    os.makedirs(output_dir, exist_ok=True)
+    file_path = os.path.join(output_dir, f"{file_name}.pickle")
+
+    if os.path.exists(file_path):
+        _log("Pickle data exists, skip simulation and plot the data directly.")
+        _log("To rerun, delete the pickle in `outputs`.")
+        with open(file_path, "rb") as f:
+            payload = pickle.load(f)
+            budget_list = payload["budget_list"]
+            results = payload["results"]
+    else:
+        results = {name: {"accs": [[] for _ in budget_list]} for name in scheduler_names}
+        for k, C_total in enumerate(budget_list):
+            timer = _start_timer()
+            if verbose:
+                _log(f"\n=== [{noise_model}] Budget={C_total} ({k+1}/{len(budget_list)}) ===")
+            for r in range(repeat):
+                if verbose and ((r + 1) % print_every == 0 or r == 0):
+                    _log(f"  [repeat {r+1}/{repeat}] generating topology …")
+                # 1リピート = 1トポロジ(全スケジューラで共有)
+                fidelity_bank = [generate_fidelity_list_random(n) for n in node_path_list]
+
+                def network_generator(path_num, pair_idx):
+                    return QuantumNetwork(path_num, fidelity_bank[pair_idx], noise_model)
+
+                for name in scheduler_names:
+                    if verbose and ((r + 1) % print_every == 0 or r == 0):
+                        _log(f"    - {name}: running …")
+                    per_pair_results, _ = run_scheduler(
+                        node_path_list=node_path_list,
+                        importance_list=importance_list,
+                        scheduler_name=name,
+                        bounces=list(bounces),
+                        C_total=int(C_total),
+                        network_generator=network_generator,
+                    )
+                    acc = (
+                        float(np.mean([1.0 if c else 0.0 for (c, _cost, _bf) in per_pair_results]))
+                        if per_pair_results
+                        else 0.0
+                    )
+                    results[name]["accs"][k].append(acc)
+                    if verbose and ((r + 1) % print_every == 0 or r == 0):
+                        _log(f"      -> acc={acc:.3f}")
+            if verbose:
+                tot, _ = _tick(timer)
+                _log(f"=== done Budget={C_total} | elapsed {tot:.1f}s ===")
+
+        with open(file_path, "wb") as f:
+            pickle.dump({"budget_list": list(budget_list), "results": results}, f)
+
+    # --- Plot ---
+    plt.rc("axes", prop_cycle=default_cycler)
+    fig, ax = plt.subplots()
+    x = list(budget_list)
+    for name, data in results.items():
+        avg_accs = [float(np.mean(v)) if v else 0.0 for v in data["accs"]]
+        label = name.replace("Vanilla NB", "VanillaNB").replace("Succ. Elim. NB", "SuccElimNB")
+        ax.plot(x, avg_accs, linewidth=2.0, label=label)
+
+    ax.set_xlabel("Total Budget (C)")
+    ax.set_ylabel("Average Correctness")
+    ax.grid(True)
+    ax.legend(title="Scheduler", fontsize=14, title_fontsize=18)
+    plt.tight_layout()
+    pdf_name = f"{file_name}.pdf"
+    plt.savefig(pdf_name)
+    if shutil.which("pdfcrop"):
+        os.system(f"pdfcrop {pdf_name} {pdf_name}")
+    _log(f"Saved: {pdf_name}")
+
+
+def plot_value_vs_used(
+    budget_list,
+    scheduler_names,
+    noise_model,
+    node_path_list,
+    importance_list,
+    bounces=(1, 2, 3, 4),
+    repeat=10,
+    verbose=True,
+    print_every=1,
+):
+    """x = 実コスト平均(used)で描く版。旧 plot_value_vs_budget と同等の挙動。"""
+    file_name = f"plot_value_vs_used_{noise_model}"
+    root_dir = os.path.dirname(os.path.abspath(__file__))
+    output_dir = os.path.join(root_dir, "outputs")
+    os.makedirs(output_dir, exist_ok=True)
+
+    results = {
+        name: {"values": [[] for _ in budget_list], "costs": [[] for _ in budget_list]}
+        for name in scheduler_names
+    }
+
+    for k, C_total in enumerate(budget_list):
+        timer = _start_timer()
+        if verbose:
+            _log(f"\n=== [{noise_model}] Budget={C_total} ({k+1}/{len(budget_list)}) ===")
+
+        # 1リピート = 1トポロジ(全スケジューラで共有)
+        fidelity_bank = [generate_fidelity_list_random(n) for n in node_path_list]
+
+        def network_generator(path_num, pair_idx):
+            return QuantumNetwork(path_num, fidelity_bank[pair_idx], noise_model)
+
+        for r in range(repeat):
+            if verbose and ((r + 1) % print_every == 0 or r == 0):
+                _log(f"  [repeat {r+1}/{repeat}]")
+            for name in scheduler_names:
+                if verbose and ((r + 1) % print_every == 0 or r == 0):
+                    _log(f"    - {name}: running …")
+                per_pair_results, total_cost, per_pair_details = run_scheduler(
+                    node_path_list=node_path_list,
+                    importance_list=importance_list,
+                    scheduler_name=name,
+                    bounces=list(bounces),
+                    C_total=int(C_total),
+                    network_generator=network_generator,
+                    return_details=True,
+                )
+                # 価値の合成
+                value = 0.0
+                for d, details in enumerate(per_pair_details):
+                    alloc = details.get("alloc_by_path", {})
+                    est = details.get("est_fid_by_path", {})
+                    inner = sum(float(est.get(l, 0.0)) * int(b) for l, b in alloc.items())
+                    value += float(importance_list[d]) * inner
+
+                results[name]["values"][k].append(float(value))
+                results[name]["costs"][k].append(int(total_cost))
+                if verbose and ((r + 1) % print_every == 0 or r == 0):
+                    _log(f"      -> used={total_cost}, value={value:.2f}")
+
+        if verbose:
+            tot, _ = _tick(timer)
+            _log(f"=== done Budget={C_total} | elapsed {tot:.1f}s ===")
+
+    # --- Plot (x = 実コスト平均) ---
+    plt.rc("axes", prop_cycle=default_cycler)
+    fig, ax = plt.subplots()
+    for name, data in results.items():
+        xs = [float(np.mean(v)) if v else 0.0 for v in data["costs"]]
+        ys = [float(np.mean(v)) if v else 0.0 for v in data["values"]]
+        ax.plot(xs, ys, linewidth=2.0, marker="o", label=name)
+
+    ax.set_xlabel("Total Measured Cost (used)")
+    ax.set_ylabel("Total Value (Σ I_d Σ f̂_{d,l}·B_{d,l})")
+    ax.grid(True)
+    ax.legend(title="Scheduler")
+    plt.tight_layout()
+    pdf_name = f"{file_name}.pdf"
+    plt.savefig(pdf_name)
+    if shutil.which("pdfcrop"):
+        os.system(f"pdfcrop {pdf_name} {pdf_name}")
+    _log(f"Saved: {pdf_name}")
+
+
+def plot_value_vs_budget_target(
+    budget_list,
+    scheduler_names,
+    noise_model,
+    node_path_list,
+    importance_list,
+    bounces=(1, 2, 3, 4),
+    repeat=10,
+    verbose=True,
+    print_every=1,
+):
+    """x = 目標予算(指定した budget_list をそのまま x 軸に)で描く版。"""
+    file_name = f"plot_value_vs_budget_target_{noise_model}"
+    root_dir = os.path.dirname(os.path.abspath(__file__))
+    output_dir = os.path.join(root_dir, "outputs")
+    os.makedirs(output_dir, exist_ok=True)
+
+    results = {
+        name: {"values": [[] for _ in budget_list], "costs": [[] for _ in budget_list]}
+        for name in scheduler_names
+    }
+
+    for k, C_total in enumerate(budget_list):
+        timer = _start_timer()
+        if verbose:
+            _log(f"\n=== [{noise_model}] Budget={C_total} ({k+1}/{len(budget_list)}) ===")
+
+        fidelity_bank = [generate_fidelity_list_random(n) for n in node_path_list]
+
+        def network_generator(path_num, pair_idx):
+            return QuantumNetwork(path_num, fidelity_bank[pair_idx], noise_model)
+
+        for r in range(repeat):
+            if verbose and ((r + 1) % print_every == 0 or r == 0):
+                _log(f"  [repeat {r+1}/{repeat}]")
+            for name in scheduler_names:
+                if verbose and ((r + 1) % print_every == 0 or r == 0):
+                    _log(f"    - {name}: running …")
+                per_pair_results, total_cost, per_pair_details = run_scheduler(
+                    node_path_list=node_path_list,
+                    importance_list=importance_list,
+                    scheduler_name=name,
+                    bounces=list(bounces),
+                    C_total=int(C_total),
+                    network_generator=network_generator,
+                    return_details=True,
+                )
+                value = 0.0
+                for d, details in enumerate(per_pair_details):
+                    alloc = details.get("alloc_by_path", {})
+                    est = details.get("est_fid_by_path", {})
+                    inner = sum(float(est.get(l, 0.0)) * int(b) for l, b in alloc.items())
+                    value += float(importance_list[d]) * inner
+
+                results[name]["values"][k].append(float(value))
+                results[name]["costs"][k].append(int(total_cost))
+                if verbose and ((r + 1) % print_every == 0 or r == 0):
+                    _log(f"      -> used={total_cost}, value={value:.2f}")
+
+        if verbose:
+            tot, _ = _tick(timer)
+            _log(f"=== done Budget={C_total} | elapsed {tot:.1f}s ===")
+
+    # --- Plot (x = 目標予算) ---
+    plt.rc("axes", prop_cycle=default_cycler)
+    fig, ax = plt.subplots()
+    x = list(budget_list)
+    for name, data in results.items():
+        ys = [float(np.mean(v)) if v else 0.0 for v in data["values"]]
+        ax.plot(x, ys, linewidth=2.0, marker="o", label=name)
+
+    ax.set_xlabel("Budget (target)")
+    ax.set_ylabel("Total Value (Σ I_d Σ f̂_{d,l}·B_{d,l})")
+    ax.grid(True)
+    ax.legend(title="Scheduler")
+    plt.tight_layout()
+    pdf_name = f"{file_name}.pdf"
+    plt.savefig(pdf_name)
+    if shutil.which("pdfcrop"):
+        os.system(f"pdfcrop {pdf_name} {pdf_name}")
+    _log(f"Saved: {pdf_name}")
+
+
+# =========================
+# CI width helpers and plots
+# =========================
+def _ci_radius_hoeffding(n: int, delta: float = 0.1) -> float:
+    if n <= 0:
+        return 1.0
+    return math.sqrt(0.5 * math.log(2.0 / delta) / n)
+
+
+# =========================
+# Width-sum metrics (new)
+# =========================
+
+def _sum_widths_all_links(per_pair_details, delta: float = 0.1) -> float:
+    """
+    すべてのペア・すべてのリンクについて、(UB - LB) を合計。
+    est が無いリンクはスキップ(=寄与0)。測定していないリンクは数えません。
+    """
+    total = 0.0
+    for det in per_pair_details:
+        alloc = det.get("alloc_by_path", {})  # n = 測定回数
+        est   = det.get("est_fid_by_path", {})  # 標本平均
+        for pid, m in est.items():
+            n = int(alloc.get(pid, 0))
+            rad = _ci_radius_hoeffding(n, delta)
+            lb = max(0.0, float(m) - rad)
+            ub = min(1.0, float(m) + rad)
+            total += (ub - lb)
+    return float(total)
+
+
+def _sum_min_widths_per_pair(per_pair_details, delta: float = 0.1) -> float:
+    """
+    ペアごとにリンクの (UB - LB) を算出し、その「最小値」を取り、全ペアで合計。
+    est が空のペアは保守的に 1.0 を加算(“全く分からない”幅として扱う)。
+    """
+    s = 0.0
+    for det in per_pair_details:
+        alloc = det.get("alloc_by_path", {})
+        est   = det.get("est_fid_by_path", {})
+        if not est:
+            s += 1.0
+            continue
+        widths = []
+        for pid, m in est.items():
+            n = int(alloc.get(pid, 0))
+            rad = _ci_radius_hoeffding(n, delta)
+            lb = max(0.0, float(m) - rad)
+            ub = min(1.0, float(m) + rad)
+            widths.append(ub - lb)
+        s += (min(widths) if widths else 1.0)
+    return float(s)
+
+
+def plot_widthsum_alllinks_vs_budget(
+    budget_list,
+    scheduler_names,
+    noise_model,
+    node_path_list,
+    importance_list,
+    bounces=(1, 2, 3, 4),
+    repeat=10,
+    delta=0.1,
+    verbose=True,
+    print_every=1,
+):
+    """
+    y = 全リンク(UB-LB)総和 の平均 ±95%CI を、x = 目標予算 で描画。
+    生データは outputs/plot_widthsum_alllinks_vs_budget_*.pickle に保存。
+    """
+    file_name = f"plot_widthsum_alllinks_vs_budget_{noise_model}"
+    root_dir = os.path.dirname(os.path.abspath(__file__))
+    output_dir = os.path.join(root_dir, "outputs")
+    os.makedirs(output_dir, exist_ok=True)
+
+    results = {name: {"sums": [[] for _ in budget_list]} for name in scheduler_names}
+
+    for k, C_total in enumerate(budget_list):
+        if verbose:
+            print(f"\n=== [{noise_model}] Budget={C_total} ({k+1}/{len(budget_list)}) ===", flush=True)
+
+        # 1リピート=1トポロジ(全スケジューラ共有)
+        fidelity_bank = [generate_fidelity_list_random(n) for n in node_path_list]
+
+        def network_generator(path_num, pair_idx):
+            return QuantumNetwork(path_num, fidelity_bank[pair_idx], noise_model)
+
+        for r in range(repeat):
+            if verbose and ((r + 1) % print_every == 0 or r == 0):
+                print(f"  [repeat {r+1}/{repeat}]", flush=True)
+
+            for name in scheduler_names:
+                per_pair_results, total_cost, per_pair_details = run_scheduler(
+                    node_path_list=node_path_list,
+                    importance_list=importance_list,
+                    scheduler_name=name,
+                    bounces=list(bounces),
+                    C_total=int(C_total),
+                    network_generator=network_generator,
+                    return_details=True,
+                )
+                v = _sum_widths_all_links(per_pair_details, delta=delta)
+                results[name]["sums"][k].append(v)
+                if verbose and ((r + 1) % print_every == 0 or r == 0):
+                    print(f"    - {name}: sum_alllinks={v:.4f} (used={total_cost})", flush=True)
+
+    # --- Save raw data (.pickle) ---
+    file_path = os.path.join(output_dir, f"{file_name}.pickle")
+    with open(file_path, "wb") as f:
+        pickle.dump({"budget_list": list(budget_list), "results": results}, f)
+    print(f"Saved pickle: {file_path}")
+
+    # --- Plot mean ± 95% CI across repeats ---
+    plt.rc("axes", prop_cycle=default_cycler)
+    fig, ax = plt.subplots()
+    x = list(budget_list)
+    for name, data in results.items():
+        means, halfs = [], []
+        for vals in data["sums"]:
+            m, h = mean_ci95(vals)
+            means.append(m); halfs.append(h)
+        means = np.asarray(means); halfs = np.asarray(halfs)
+        ax.plot(x, means, linewidth=2.0, marker="o", label=name)
+        ax.fill_between(x, means - halfs, means + halfs, alpha=0.25)
+
+    ax.set_xlabel("Budget (target)")
+    ax.set_ylabel("Sum of (UB - LB) over all links")
+    ax.grid(True)
+    ax.legend(title="Scheduler")
+    plt.tight_layout()
+    pdf_name = f"{file_name}.pdf"
+    plt.savefig(pdf_name)
+    if shutil.which("pdfcrop"):
+        os.system(f"pdfcrop {pdf_name} {pdf_name}")
+    print(f"Saved: {pdf_name}")
+
+
+def plot_minwidthsum_perpair_vs_budget(
+    budget_list,
+    scheduler_names,
+    noise_model,
+    node_path_list,
+    importance_list,
+    bounces=(1, 2, 3, 4),
+    repeat=10,
+    delta=0.1,
+    verbose=True,
+    print_every=1,
+):
+    """
+    y = ペアごとの (UB-LB) 最小値の合計 の平均 ±95%CI、x = 目標予算。
+    生データは outputs/plot_minwidthsum_perpair_vs_budget_*.pickle に保存。
+    """
+    file_name = f"plot_minwidthsum_perpair_vs_budget_{noise_model}"
+    root_dir = os.path.dirname(os.path.abspath(__file__))
+    output_dir = os.path.join(root_dir, "outputs")
+    os.makedirs(output_dir, exist_ok=True)
+
+    results = {name: {"sums": [[] for _ in budget_list]} for name in scheduler_names}
+
+    for k, C_total in enumerate(budget_list):
+        if verbose:
+            print(f"\n=== [{noise_model}] Budget={C_total} ({k+1}/{len(budget_list)}) ===", flush=True)
+
+        fidelity_bank = [generate_fidelity_list_random(n) for n in node_path_list]
+
+        def network_generator(path_num, pair_idx):
+            return QuantumNetwork(path_num, fidelity_bank[pair_idx], noise_model)
+
+        for r in range(repeat):
+            if verbose and ((r + 1) % print_every == 0 or r == 0):
+                print(f"  [repeat {r+1}/{repeat}]", flush=True)
+
+            for name in scheduler_names:
+                per_pair_results, total_cost, per_pair_details = run_scheduler(
+                    node_path_list=node_path_list,
+                    importance_list=importance_list,
+                    scheduler_name=name,
+                    bounces=list(bounces),
+                    C_total=int(C_total),
+                    network_generator=network_generator,
+                    return_details=True,
+                )
+                v = _sum_min_widths_per_pair(per_pair_details, delta=delta)
+                results[name]["sums"][k].append(v)
+                if verbose and ((r + 1) % print_every == 0 or r == 0):
+                    print(f"    - {name}: sum_min_perpair={v:.4f} (used={total_cost})", flush=True)
+
+    # --- Save raw data (.pickle) ---
+    file_path = os.path.join(output_dir, f"{file_name}.pickle")
+    with open(file_path, "wb") as f:
+        pickle.dump({"budget_list": list(budget_list), "results": results}, f)
+    print(f"Saved pickle: {file_path}")
+
+    # --- Plot mean ± 95% CI across repeats ---
+    plt.rc("axes", prop_cycle=default_cycler)
+    fig, ax = plt.subplots()
+    x = list(budget_list)
+    for name, data in results.items():
+        means, halfs = [], []
+        for vals in data["sums"]:
+            m, h = mean_ci95(vals)
+            means.append(m); halfs.append(h)
+        means = np.asarray(means); halfs = np.asarray(halfs)
+        ax.plot(x, means, linewidth=2.0, marker="o", label=name)
+        ax.fill_between(x, means - halfs, means + halfs, alpha=0.25)
+
+    ax.set_xlabel("Budget (target)")
+    ax.set_ylabel("Sum over pairs of min (UB - LB)")
+    ax.grid(True)
+    ax.legend(title="Scheduler")
+    plt.tight_layout()
+    pdf_name = f"{file_name}.pdf"
+    plt.savefig(pdf_name)
+    if shutil.which("pdfcrop"):
+        os.system(f"pdfcrop {pdf_name} {pdf_name}")
+    print(f"Saved: {pdf_name}")
+
+
+
+# =========================
+# Weighted width-sum metrics (add-on)
+# =========================
+
+def _sum_weighted_widths_all_links(per_pair_details, importance_list, delta: float = 0.1) -> float:
+    """
+    すべてのペア・すべてのリンクの (UB-LB) に、ペア重要度 I_d を掛けて合計。
+    importance_list[d] が無ければ I_d=1.0 として扱う。
+    """
+    total = 0.0
+    for d, det in enumerate(per_pair_details):
+        I = float(importance_list[d]) if d < len(importance_list) else 1.0
+        alloc = det.get("alloc_by_path", {})
+        est   = det.get("est_fid_by_path", {})
+        for pid, m in est.items():
+            n = int(alloc.get(pid, 0))
+            rad = _ci_radius_hoeffding(n, delta)
+            lb = max(0.0, float(m) - rad)
+            ub = min(1.0, float(m) + rad)
+            total += I * (ub - lb)
+    return float(total)
+
+
+def _sum_weighted_min_widths_per_pair(per_pair_details, importance_list, delta: float = 0.1) -> float:
+    """
+    ペア d ごとに min_l (UB-LB) を計算し、I_d を掛けて全ペアで合計。
+    est が空のペアは保守的に幅=1.0 として I_d*1.0 を加算。
+    """
+    s = 0.0
+    for d, det in enumerate(per_pair_details):
+        I = float(importance_list[d]) if d < len(importance_list) else 1.0
+        alloc = det.get("alloc_by_path", {})
+        est   = det.get("est_fid_by_path", {})
+        if not est:
+            s += I * 1.0
+            continue
+        widths = []
+        for pid, m in est.items():
+            n = int(alloc.get(pid, 0))
+            rad = _ci_radius_hoeffding(n, delta)
+            lb = max(0.0, float(m) - rad)
+            ub = min(1.0, float(m) + rad)
+            widths.append(ub - lb)
+        s += I * (min(widths) if widths else 1.0)
+    return float(s)
+
+
+def plot_widthsum_alllinks_weighted_vs_budget(
+    budget_list,
+    scheduler_names,
+    noise_model,
+    node_path_list,
+    importance_list,
+    bounces=(1, 2, 3, 4),
+    repeat=10,
+    delta=0.1,
+    verbose=True,
+    print_every=1,
+):
+    """
+    y = Σ_d Σ_l I_d·(UB-LB) の平均 ±95%CI、x = 目標予算。
+    生データは outputs/plot_widthsum_alllinks_weighted_vs_budget_*.pickle に保存。
+    """
+    file_name = f"plot_widthsum_alllinks_weighted_vs_budget_{noise_model}"
+    root_dir = os.path.dirname(os.path.abspath(__file__))
+    output_dir = os.path.join(root_dir, "outputs")
+    os.makedirs(output_dir, exist_ok=True)
+
+    results = {name: {"sums": [[] for _ in budget_list]} for name in scheduler_names}
+
+    for k, C_total in enumerate(budget_list):
+        if verbose:
+            print(f"\n=== [{noise_model}] Budget={C_total} ({k+1}/{len(budget_list)}) ===", flush=True)
+
+        fidelity_bank = [generate_fidelity_list_random(n) for n in node_path_list]
+
+        def network_generator(path_num, pair_idx):
+            return QuantumNetwork(path_num, fidelity_bank[pair_idx], noise_model)
+
+        for r in range(repeat):
+            if verbose and ((r + 1) % print_every == 0 or r == 0):
+                print(f"  [repeat {r+1}/{repeat}]", flush=True)
+
+            for name in scheduler_names:
+                per_pair_results, total_cost, per_pair_details = run_scheduler(
+                    node_path_list=node_path_list,
+                    importance_list=importance_list,
+                    scheduler_name=name,
+                    bounces=list(bounces),
+                    C_total=int(C_total),
+                    network_generator=network_generator,
+                    return_details=True,
+                )
+                v = _sum_weighted_widths_all_links(per_pair_details, importance_list, delta=delta)
+                results[name]["sums"][k].append(v)
+                if verbose and ((r + 1) % print_every == 0 or r == 0):
+                    print(f"    - {name}: wsum_alllinks={v:.4f} (used={total_cost})", flush=True)
+
+    # --- Save raw data (.pickle) ---
+    file_path = os.path.join(output_dir, f"{file_name}.pickle")
+    with open(file_path, "wb") as f:
+        pickle.dump({"budget_list": list(budget_list), "results": results}, f)
+    print(f"Saved pickle: {file_path}")
+
+    # --- Plot mean ± 95% CI ---
+    plt.rc("axes", prop_cycle=default_cycler)
+    fig, ax = plt.subplots()
+    x = list(budget_list)
+    for name, data in results.items():
+        means, halfs = [], []
+        for vals in data["sums"]:
+            m, h = mean_ci95(vals)
+            means.append(m); halfs.append(h)
+        means = np.asarray(means); halfs = np.asarray(halfs)
+        ax.plot(x, means, linewidth=2.0, marker="o", label=name)
+        ax.fill_between(x, means - halfs, means + halfs, alpha=0.25)
+
+    ax.set_xlabel("Budget (target)")
+    ax.set_ylabel("Weighted sum of (UB - LB) over all links (× I_d)")
+    ax.grid(True); ax.legend(title="Scheduler")
+    plt.tight_layout()
+    pdf_name = f"{file_name}.pdf"
+    plt.savefig(pdf_name)
+    if shutil.which("pdfcrop"):
+        os.system(f"pdfcrop {pdf_name} {pdf_name}")
+    print(f"Saved: {pdf_name}")
+
+
+def plot_minwidthsum_perpair_weighted_vs_budget(
+    budget_list,
+    scheduler_names,
+    noise_model,
+    node_path_list,
+    importance_list,
+    bounces=(1, 2, 3, 4),
+    repeat=10,
+    delta=0.1,
+    verbose=True,
+    print_every=1,
+):
+    """
+    y = Σ_d I_d·min_l(UB-LB) の平均 ±95%CI、x = 目標予算。
+    生データは outputs/plot_minwidthsum_perpair_weighted_vs_budget_*.pickle に保存。
+    """
+    file_name = f"plot_minwidthsum_perpair_weighted_vs_budget_{noise_model}"
+    root_dir = os.path.dirname(os.path.abspath(__file__))
+    output_dir = os.path.join(root_dir, "outputs")
+    os.makedirs(output_dir, exist_ok=True)
+
+    results = {name: {"sums": [[] for _ in budget_list]} for name in scheduler_names}
+
+    for k, C_total in enumerate(budget_list):
+        if verbose:
+            print(f"\n=== [{noise_model}] Budget={C_total} ({k+1}/{len(budget_list)}) ===", flush=True)
+
+        fidelity_bank = [generate_fidelity_list_random(n) for n in node_path_list]
+
+        def network_generator(path_num, pair_idx):
+            return QuantumNetwork(path_num, fidelity_bank[pair_idx], noise_model)
+
+        for r in range(repeat):
+            if verbose and ((r + 1) % print_every == 0 or r == 0):
+                print(f"  [repeat {r+1}/{repeat}]", flush=True)
+
+            for name in scheduler_names:
+                per_pair_results, total_cost, per_pair_details = run_scheduler(
+                    node_path_list=node_path_list,
+                    importance_list=importance_list,
+                    scheduler_name=name,
+                    bounces=list(bounces),
+                    C_total=int(C_total),
+                    network_generator=network_generator,
+                    return_details=True,
+                )
+                v = _sum_weighted_min_widths_per_pair(per_pair_details, importance_list, delta=delta)
+                results[name]["sums"][k].append(v)
+                if verbose and ((r + 1) % print_every == 0 or r == 0):
+                    print(f"    - {name}: wsum_min_perpair={v:.4f} (used={total_cost})", flush=True)
+
+    # --- Save raw data (.pickle) ---
+    file_path = os.path.join(output_dir, f"{file_name}.pickle")
+    with open(file_path, "wb") as f:
+        pickle.dump({"budget_list": list(budget_list), "results": results}, f)
+    print(f"Saved pickle: {file_path}")
+
+    # --- Plot mean ± 95% CI ---
+    plt.rc("axes", prop_cycle=default_cycler)
+    fig, ax = plt.subplots()
+    x = list(budget_list)
+    for name, data in results.items():
+        means, halfs = [], []
+        for vals in data["sums"]:
+            m, h = mean_ci95(vals)
+            means.append(m); halfs.append(h)
+        means = np.asarray(means); halfs = np.asarray(halfs)
+        ax.plot(x, means, linewidth=2.0, marker="o", label=name)
+        ax.fill_between(x, means - halfs, means + halfs, alpha=0.25)
+
+    ax.set_xlabel("Budget (target)")
+    ax.set_ylabel("Weighted sum over pairs of min (UB - LB) (× I_d)")
+    ax.grid(True); ax.legend(title="Scheduler")
+    plt.tight_layout()
+    pdf_name = f"{file_name}.pdf"
+    plt.savefig(pdf_name)
+    if shutil.which("pdfcrop"):
+        os.system(f"pdfcrop {pdf_name} {pdf_name}")
+    print(f"Saved: {pdf_name}")
+
+
+# =========================
+# 95%CI helpers (repeats 可変対応)
+# =========================
+# 小 n 用の簡易表(両側95%、df = n-1)
+_T95 = {
+    1: 12.706,
+    2: 4.303,
+    3: 3.182,
+    4: 2.776,
+    5: 2.571,
+    6: 2.447,
+    7: 2.365,
+    8: 2.306,
+    9: 2.262,
+    10: 2.228,
+    11: 2.201,
+    12: 2.179,
+    13: 2.160,
+    14: 2.145,
+    15: 2.131,
+    16: 2.120,
+    17: 2.110,
+    18: 2.101,
+    19: 2.093,
+    20: 2.086,
+    21: 2.080,
+    22: 2.074,
+    23: 2.069,
+    24: 2.064,
+    25: 2.060,
+    26: 2.056,
+    27: 2.052,
+    28: 2.048,
+    29: 2.045,
+}
+
+
+def tcrit_95(n: int) -> float:
+    """repeats=n に対する両側95% t臨界値 (df=n-1)。n<2 は 0 を返す。"""
+    if n <= 1:
+        return 0.0
+    df = n - 1
+    if df in _T95:
+        return _T95[df]
+    if df >= 30:
+        return 1.96  # 正規近似
+    return 2.13  # 小 n 保守値
+
+
+def mean_ci95(vals):
+    """同一 budget 上の値列 vals(可変 n)に対して (mean, halfwidth) を返す。"""
+    arr = np.asarray(vals, dtype=float)
+    n = len(arr)
+    if n == 0:
+        return 0.0, 0.0
+    if n == 1:
+        return float(arr[0]), 0.0
+    mean = float(arr.mean())
+    s = float(arr.std(ddof=1))
+    half = tcrit_95(n) * (s / math.sqrt(n))
+    return mean, half
+
+
+def _plot_with_ci_band(ax, xs, mean, half, *, label, line_kwargs=None, band_kwargs=None):
+    line_kwargs = {} if line_kwargs is None else dict(line_kwargs)
+    band_kwargs = {"alpha": 0.25} | ({} if band_kwargs is None else dict(band_kwargs))
+    ax.plot(xs, mean, label=label, **line_kwargs)
+    ax.fill_between(xs, mean - half, mean + half, **band_kwargs)
+
+
+

+ 145 - 0
add_linkselfie/main.py

@@ -0,0 +1,145 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+"""
+main.py — evaluation.py の各種プロットを一括実行
+  Unweighted:
+    1) plot_accuracy_vs_budget
+    2) plot_value_vs_used
+    3) plot_value_vs_budget_target
+    4) plot_widthsum_alllinks_vs_budget
+    5) plot_minwidthsum_perpair_vs_budget
+  Weighted(重要度 I_d を幅に掛ける版):
+    6) plot_widthsum_alllinks_weighted_vs_budget
+    7) plot_minwidthsum_perpair_weighted_vs_budget
+
+出力:
+  - 生データ pickle -> ./outputs/
+  - 図 PDF -> カレントディレクトリ
+"""
+
+from multiprocessing.pool import Pool
+import os
+import random
+
+# 任意:あなたの環境のユーティリティ。無ければフォールバック。
+try:
+    from utils import set_random_seed
+except Exception:
+    def set_random_seed(seed: int = 12):
+        random.seed(seed)
+        try:
+            import numpy as np
+            np.random.seed(seed)
+        except Exception:
+            pass
+
+# evaluation 側のプロット関数
+from evaluation import (
+    # Accuracy / Value 系
+    plot_accuracy_vs_budget,
+    plot_value_vs_used,
+    plot_value_vs_budget_target,
+
+    # 幅(UB-LB)系 - Unweighted
+    plot_widthsum_alllinks_vs_budget,
+    plot_minwidthsum_perpair_vs_budget,
+
+    # 幅(UB-LB)系 - Weighted (× I_d)
+    plot_widthsum_alllinks_weighted_vs_budget,
+    plot_minwidthsum_perpair_weighted_vs_budget,
+)
+
+
+def main():
+    # ===== 実験パラメータ =====
+    set_random_seed(12)
+    num_workers      = max(1, (os.cpu_count() or 4) // 2)
+    noise_model_list = ["Depolar"]              # 例: ["Depolar", "Dephase"]
+    scheduler_names  = ["LNaive", "Greedy"]     # 実装済みスケジューラ名に合わせて
+    node_path_list   = [5, 5, 5]                # ペアごとのリンク本数
+    importance_list  = [0.3, 0.6, 0.9]          # value系&weighted幅系で使用
+    budget_list      = [3000, 6000, 9000, 12000, 15000, 18000]
+    bounces          = (1, 2, 3, 4)             # 測定深さ候補(あなたの定義に従う)
+    repeat           = 10                       # 反復回数(精度と時間のトレードオフ)
+    delta            = 0.1                      # 幅用の信頼度パラメータ(Hoeffding)
+
+    print("=== Config ===")
+    print(f"workers={num_workers}, noise_models={noise_model_list}")
+    print(f"schedulers={scheduler_names}")
+    print(f"node_path_list={node_path_list}, importance_list={importance_list}")
+    print(f"budgets={budget_list}, bounces={bounces}, repeat={repeat}, delta={delta}")
+    print("================\n")
+
+    # ===== 実行キュー =====
+    p = Pool(processes=num_workers)
+    jobs = []
+
+    for noise_model in noise_model_list:
+        # --- Accuracy ---
+        jobs.append(p.apply_async(
+            plot_accuracy_vs_budget,
+            args=(budget_list, scheduler_names, noise_model,
+                  node_path_list, importance_list, bounces, repeat),
+            kwds={"verbose": True}
+        ))
+
+        # --- Value: x=used(実コスト平均) ---
+        jobs.append(p.apply_async(
+            plot_value_vs_used,
+            args=(budget_list, scheduler_names, noise_model,
+                  node_path_list, importance_list, bounces, repeat),
+            kwds={"verbose": True}
+        ))
+
+        # --- Value: x=target(指定予算) ---
+        jobs.append(p.apply_async(
+            plot_value_vs_budget_target,
+            args=(budget_list, scheduler_names, noise_model,
+                  node_path_list, importance_list, bounces, repeat),
+            kwds={"verbose": True}
+        ))
+
+        # --- Width (UB-LB) Unweighted: 全リンク総和 ---
+        jobs.append(p.apply_async(
+            plot_widthsum_alllinks_vs_budget,
+            args=(budget_list, scheduler_names, noise_model,
+                  node_path_list, importance_list, bounces, repeat),
+            kwds={"delta": delta, "verbose": True}
+        ))
+
+        # --- Width (UB-LB) Unweighted: ペア最小幅の総和 ---
+        jobs.append(p.apply_async(
+            plot_minwidthsum_perpair_vs_budget,
+            args=(budget_list, scheduler_names, noise_model,
+                  node_path_list, importance_list, bounces, repeat),
+            kwds={"delta": delta, "verbose": True}
+        ))
+
+        # --- Width (UB-LB) Weighted: 全リンク I_d·幅 総和 ---
+        jobs.append(p.apply_async(
+            plot_widthsum_alllinks_weighted_vs_budget,
+            args=(budget_list, scheduler_names, noise_model,
+                  node_path_list, importance_list, bounces, repeat),
+            kwds={"delta": delta, "verbose": True}
+        ))
+
+        # --- Width (UB-LB) Weighted: ペアごとの I_d·最小幅 総和 ---
+        jobs.append(p.apply_async(
+            plot_minwidthsum_perpair_weighted_vs_budget,
+            args=(budget_list, scheduler_names, noise_model,
+                  node_path_list, importance_list, bounces, repeat),
+            kwds={"delta": delta, "verbose": True}
+        ))
+
+    # ===== 実行 & 同期 =====
+    p.close()
+    p.join()
+    for j in jobs:
+        j.get()
+
+    print("\nAll jobs finished.")
+    print("Pickles -> ./outputs/,  PDF -> カレントディレクトリ に保存されます。")
+
+
+if __name__ == "__main__":
+    main()

+ 131 - 0
add_linkselfie/memo.txt

@@ -0,0 +1,131 @@
+linkselfieのストーリー
+
+背景:量子ネットワークでは長距離伝送にエンタングルメントを用いるが、ノイズでリンク品質(忠実度)が劣化するため、送信前にリンク品質の検証(Network Benchmarking)が必要。ただし複数リンクを一様に測るとコスト(バウンス・反復)が大きい。
+
+動機:実運用で使うのは少数の高忠実度リンクだけ。低忠実度リンクを高精度に測るのは無駄なので、悪いリンクを早期に捨て、資源消費を抑えて良いリンクだけを精密化したい(しかもベンチマークはバッチ型で柔軟に1回ずつ引けない)。
+
+目的:最小限の量子資源で最良リンクを高信頼で特定し、その忠実度を十分な
+精度で推定するアルゴリズムの設計・保証・実証。具体的には LinkSelFiE を
+提案し、新しい信頼区間に基づく段階的淘汰で資源削減を図り、正しさとコス
+ト上界を理論立証し、シミュレーションで有効性を示す。
+
+
+
+自分の研究のストーリー
+背景 量子ネットワークにおいて忠実度を高いリンクを効率的に判定する手法 LinkSelFiE が提案されている
+動機 LinkSelFiE は通信需要を考慮していないが、現実には通信需要が高くかつ忠実度の高いリンクの判定が望まれる
+目的 少ない計測 (バウンス) により利用率 x 忠実度が高いリンクの判定を可能とする
+
+
+
+確認
+LinkSelFiEの思想は、悪い候補にはほぼ費やさず、有望候補群にメリハリ配分
+し、必要ならε-最適やTop-Kで止めること。
+-> つまり、最良のリンクを特定することよりも、忠実度が上位のリンクに資
+源を割くことが目的?
+読む(関連研究)
+linkselfieを引用している論文があったら読む
+作者の論文
+
+上位のリンク数本を測定するのが大事
+なぜかを調べる
+
+
+
+- 実装予定の評価指標とそのストーリー
+- 精度と測定資源の削減のトレードオフの正解を信頼度deltaによって決める
+
+
+
+
+- 実装予定のベースライン手法
+- uniform-linkselfieよりも少し賢い手法
+  - 全てのリンクをまとめてlinkselfieを適用する手法
+  - 重要度と忠実度の積に対してlinkselfieを行なう
+
+- 信頼度deltaとリンクの本数からノードペア間に割く測定資源の上限を設定
+  - 上限に達するとlinkselfieを打ち切る
+
+
+- 重要度に比例して傾斜的に資源を割りあてる手法
+  - ノードペア間では等しく配分
+
+
+
+目的を考えて答えがでるときと出ないときがある
+実験やったら理解が深まるかも
+両方やる
+
+性能の良さで勝負するのは厳しい
+
+自分の研究の売りは何か
+通信需要を考えた条件を最初に示したのが売り
+
+評価指標はこだわる必要がある
+-> だれも評価したことないから
+
+その他の論文を読んだほうがいいか->yes
+読んでから考えたほうがいいか->わからない
+
+ネットワークアーキテクチャの論文も読むべき
+幅広く読むべき、深く読むべき ものによる
+
+どこに使えるか
+
+読者が読んだときに何をインパクトとして受けとるかを考えて書く必要がある
+自分でアピールする
+
+-> 通信需要を考えた条件を最初に示したのが売り
+
+ストーリーもそのようにする必要がある
+
+
+
+- linkselfieは通信需要を考慮した環境でも良かった。
+
+
+
+
+
+
+
+理想的な配分が何かを考える必要がある
+
+宛先ノードがいくつかあり、それぞれの通信需要が分かっているときの理想的
+な測定資源の配分の仕方って何?
+
+- まず、入力として何がある?
+  - どれくらいの粒度で測定をするかを表わす、信頼度delta
+  - 真の忠実度のlist
+  - 重要度のlist
+価値レグレット
+使えると判断する基準は?
+linkselfieだと信頼度を満たすと判断するが、ベースラインのvanillaなどは全リンク均等配分するためそのような機能は備わっていない
+
+
+
+
+
+PAC停止
+各ペアiの最良リンクにおいて
+UCB,LCBを求める(信頼区間の上限、下限)
+重要度Iをかけて、
+UB = I_i x UCB_i , LB = I_i x LCB_iを求める
+
+LBが負になる場合はKを自動決定するが、そうはならないので
+実際はUBとLBの差を監視する
+
+Coverage
+
+リンクごとの忠実度の信頼区間の下限LCB_ij
+ノードの重要度I_i
+としたときに
+閾値dを越えるI_i x LCB_ijを何本獲得できたか
+
+
+価値レグレット
+coverageの閾値を考慮しないver
+値としてsum(I_i x LCB_ij)を計算し、真値のsum(I_i x F*_ij)と比較する
+選ばれるリンクはペア間で最大の忠実度のリンクのみ
+
+この3つに言えることだが、ベースラインはどのような手法を想定している?

+ 108 - 0
add_linkselfie/memo.txt~

@@ -0,0 +1,108 @@
+linkselfieのストーリー
+
+背景:量子ネットワークでは長距離伝送にエンタングルメントを用いるが、ノイズでリンク品質(忠実度)が劣化するため、送信前にリンク品質の検証(Network Benchmarking)が必要。ただし複数リンクを一様に測るとコスト(バウンス・反復)が大きい。
+
+動機:実運用で使うのは少数の高忠実度リンクだけ。低忠実度リンクを高精度に測るのは無駄なので、悪いリンクを早期に捨て、資源消費を抑えて良いリンクだけを精密化したい(しかもベンチマークはバッチ型で柔軟に1回ずつ引けない)。
+
+目的:最小限の量子資源で最良リンクを高信頼で特定し、その忠実度を十分な
+精度で推定するアルゴリズムの設計・保証・実証。具体的には LinkSelFiE を
+提案し、新しい信頼区間に基づく段階的淘汰で資源削減を図り、正しさとコス
+ト上界を理論立証し、シミュレーションで有効性を示す。
+
+
+
+自分の研究のストーリー
+背景 量子ネットワークにおいて忠実度を高いリンクを効率的に判定する手法 LinkSelFiE が提案されている
+動機 LinkSelFiE は通信需要を考慮していないが、現実には通信需要が高くかつ忠実度の高いリンクの判定が望まれる
+目的 少ない計測 (バウンス) により利用率 x 忠実度が高いリンクの判定を可能とする
+
+
+
+確認
+LinkSelFiEの思想は、悪い候補にはほぼ費やさず、有望候補群にメリハリ配分
+し、必要ならε-最適やTop-Kで止めること。
+-> つまり、最良のリンクを特定することよりも、忠実度が上位のリンクに資
+源を割くことが目的?
+読む(関連研究)
+linkselfieを引用している論文があったら読む
+作者の論文
+
+上位のリンク数本を測定するのが大事
+なぜかを調べる
+
+
+
+- 実装予定の評価指標とそのストーリー
+- 精度と測定資源の削減のトレードオフの正解を信頼度deltaによって決める
+
+
+
+
+- 実装予定のベースライン手法
+- uniform-linkselfieよりも少し賢い手法
+  - 全てのリンクをまとめてlinkselfieを適用する手法
+  - 重要度と忠実度の積に対してlinkselfieを行なう
+
+- 信頼度deltaとリンクの本数からノードペア間に割く測定資源の上限を設定
+  - 上限に達するとlinkselfieを打ち切る
+
+
+- 重要度に比例して傾斜的に資源を割りあてる手法
+  - ノードペア間では等しく配分
+
+
+
+目的を考えて答えがでるときと出ないときがある
+実験やったら理解が深まるかも
+両方やる
+
+性能の良さで勝負するのは厳しい
+
+自分の研究の売りは何か
+通信需要を考えた条件を最初に示したのが売り
+
+評価指標はこだわる必要がある
+-> だれも評価したことないから
+
+その他の論文を読んだほうがいいか->yes
+読んでから考えたほうがいいか->わからない
+
+ネットワークアーキテクチャの論文も読むべき
+幅広く読むべき、深く読むべき ものによる
+
+どこに使えるか
+
+読者が読んだときに何をインパクトとして受けとるかを考えて書く必要がある
+自分でアピールする
+
+-> 通信需要を考えた条件を最初に示したのが売り
+
+ストーリーもそのようにする必要がある
+
+
+
+- linkselfieは通信需要を考慮した環境でも良かった。
+
+
+
+
+
+
+
+理想的な配分が何かを考える必要がある
+
+宛先ノードがいくつかあり、それぞれの通信需要が分かっているときの理想的
+な測定資源の配分の仕方って何?
+
+- まず、入力として何がある?
+  - どれくらいの粒度で測定をするかを表わす、信頼度delta
+  - 真の忠実度のlist
+  - 重要度のlist
+価値レグレット
+使えると判断する基準は?
+linkselfieだと信頼度を満たすと判断するが、ベースラインのvanillaなどは全リンク均等配分するためそのような機能は備わっていない
+
+価値レグレット
+PAC停止
+Coverage
+この3つに言えることだが、ベースラインはどのような手法を想定している?

+ 209 - 0
add_linkselfie/nb_protocol.py

@@ -0,0 +1,209 @@
+import random as rd
+
+import netsquid as ns
+import numpy as np
+from netsquid.protocols import NodeProtocol
+from netsquid.qubits import QFormalism, ketstates
+from netsquid.qubits import operators as ops
+from netsquid.qubits import qubitapi
+from netsquid.qubits.cliffords import local_cliffords
+from netsquid.qubits.operators import Operator
+from netsquid.qubits.qubitapi import create_qubits, measure, operate
+from scipy.optimize import curve_fit
+
+CLIFFORD_OPERATORS = [Operator(op.name, op.arr) for op in local_cliffords]
+ns.set_qstate_formalism(QFormalism.DM)
+
+
+def EXP(x, p, A):
+    return A * p**(2 * x)
+
+
+def REGRESSION(bounces, mean_bm):
+    popt_AB, pcov_AB = curve_fit(EXP, bounces, mean_bm, p0=[0.9, 0.5], maxfev=100000)
+    # print("poptAB", popt_AB[0])
+    return [popt_AB[0], popt_AB[1]]
+
+
+def GET_FIDELITY(info_qubit, gates):
+    [ref_qubit1, ref_qubit2] = create_qubits(2)
+    # qubitapi.assign_qstate(ref_qubit1, ketstates.s1)
+    # qubitapi.assign_qstate(ref_qubit2, ketstates.s1)
+    operate(ref_qubit2, ops.X)
+    for gate_instr in gates:
+        operate(ref_qubit1, gate_instr)
+        operate(ref_qubit2, gate_instr)
+    fidelity = qubitapi.exp_value(
+        info_qubit, ops.Operator("ref", (ns.qubits.reduced_dm(ref_qubit1) - ns.qubits.reduced_dm(ref_qubit2)) / 2))
+    # fidelity = abs(fidelity)
+    # if fidelity < 0:
+    #     print("NEGATIVE", fidelity)
+    #     # print("A:", ns.qubits.reduced_dm(ref_qubit1))
+    #     # print("B:", ns.qubits.reduced_dm(ref_qubit2))
+    #     # print("Operator:", (ns.qubits.reduced_dm(ref_qubit1) - ns.qubits.reduced_dm(ref_qubit2)) / 2)
+    # # Add Gaussian noise to simulate measurement noise, but we need to make sure fidelity is within a valid range
+    # if fidelity < 0.005:
+    #     # If the fidelity is too small, adding noise will likely to make it negative, so we skip adding noise
+    #     return fidelity
+    # while True:
+    #     # measure_error = np.random.normal(0, np.sqrt(((1 + fidelity) * (1 - fidelity))) / np.sqrt(1000))
+    #     noisy_fidelity = fidelity + np.random.normal(0, 0.015)
+    #     if noisy_fidelity >= 0 and noisy_fidelity <= 1:
+    #         break
+
+    noisy_fidelity = fidelity + np.random.normal(0, 0.015)
+    return noisy_fidelity
+
+
+def teleport(epr_qubit, info_qubit):
+    """Perform teleportation and return two classical bits."""
+    operate([epr_qubit, info_qubit], ns.CNOT)
+    operate(epr_qubit, ns.H)
+    m1, _ = measure(epr_qubit)
+    m2, _ = measure(info_qubit)
+    return [m1, m2]
+
+
+def correction(epr_qubit, measurement_results):
+    """Perform correction to recover the information qubit."""
+    if measurement_results[0]:
+        operate(epr_qubit, ns.Z)
+    if measurement_results[1]:
+        operate(epr_qubit, ns.X)
+    return epr_qubit
+
+
+class NBProtocolAlice(NodeProtocol):
+    # bounce: bounce number, type: list
+    # num_samples: repetition times for each bounce, type: dict bounce: times
+
+    def __init__(self, node, bounce=[], num_samples={}, qconn=None):
+        super().__init__(node)
+        self._qconn = qconn
+        if isinstance(bounce, list):
+            self._bounce_list = bounce
+        elif isinstance(bounce, int):
+            self._bounce_list = [bounce]
+        self._num_samples = num_samples
+        self._gates = []  # record the clifford operations we used.
+        self._data_record = {}
+        self._target_protocol = None
+        self._cost = 0  # The totoal number of bounces
+        self.add_signal("ALICE_MEASUREMENT_READY")
+        self.add_signal("BOB_MEASUREMENT_READY")
+        self.add_signal("ENTANGLEMENT_READY")
+
+    def set_target_protocol(self, bob_protocol):
+        self._target_protocol = bob_protocol
+
+    def request_ERP(self):
+        """Generate an EPR pair by triggering the quantum source of the quantum channel."""
+        self._qconn.subcomponents["qsource"].ports["trigger"].tx_input("trigger")
+        yield self.await_timer(100)  # Wait for Alice and Bob to receive and store their qubits
+
+    def run(self):
+        for current_bounce in self._bounce_list:
+            current_max_sample = self._num_samples[current_bounce]
+            if current_bounce not in self._data_record:
+                self._data_record[current_bounce] = []
+            # print("current bounce:", current_bounce, "bounce_list:", self._bounce_list)
+            for current_sample in range(current_max_sample):
+                # print("current sample:", current_sample)
+                self._gates.clear()
+                info_qubit = create_qubits(1)[0]
+                # qubitapi.assign_qstate(info_qubit, ketstates.s1)
+                for _ in range(current_bounce):
+                    # Start one bounce
+
+                    # clifford operation to info qubit
+                    instr = rd.choice(CLIFFORD_OPERATORS)
+                    self._gates.append(instr)
+                    operate(info_qubit, instr)
+
+                    # Request an ERP pair
+                    self._qconn.subcomponents["qsource"].ports["trigger"].tx_input("trigger")
+                    yield self.await_timer(100)  # Wait for Alice and Bob to receive and store their qubits
+
+                    # Extract EPR pair
+                    # print(f"At {ns.sim_time()} {self.node} get one EPR pair and starts teleportation")
+                    epr_qubit = self.node.qmemory.pop(0)[0]
+                    # print('At', ns.sim_time(), "alice's epr pair", epr_qubit.qstate.qrepr)
+
+                    # Teleport info qubit to Bob using the EPR pair
+                    measurement_results = teleport(epr_qubit, info_qubit)
+                    # msg = MeasurementResult(measurement_results)
+                    self.send_signal("ALICE_MEASUREMENT_READY", result=measurement_results)
+
+                    self._qconn.subcomponents["qsource"].ports["trigger"].tx_input("trigger")
+                    yield self.await_timer(100)  # Wait for Alice and Bob to receive and store their qubits
+
+                    # epr_qubit = self.node.qmemory.pop(entanglement.source_position)[0]
+                    epr_qubit = self.node.qmemory.pop(0)[0]
+                    self.send_signal("ENTANGLEMENT_READY")
+                    # print('At', ns.sim_time(), "alice's epr pair", epr_qubit.qstate.qrepr)
+                    yield self.await_signal(self._target_protocol, "BOB_MEASUREMENT_READY")
+
+                    measurement_results, instrfrombob = self._target_protocol.get_signal_result("BOB_MEASUREMENT_READY")
+                    self._gates.append(instrfrombob)
+                    info_qubit = correction(epr_qubit, measurement_results)
+
+                    self._cost += 1  # Finish one bounce
+
+                fidelity = GET_FIDELITY(info_qubit, self._gates)
+                self._data_record[current_bounce].append(fidelity)
+            # print(f"Finished bounce {current_bounce}")
+        # result = self.data_processing()
+        # print(f"Estimated fidelity: {result}, cost: {self._cost}")
+
+    def data_processing(self):
+        raw_data = self._data_record
+        bounces = list(raw_data.keys())
+        mean_values = [np.mean(raw_data[key]) for key in bounces]
+        # if sorted(mean_values)[0] < 0:
+        #     print("Some mean value is negative,", mean_values)
+        # print('bounces:', bounces)
+        # print("mean_values:", mean_values)
+        p, _ = REGRESSION(bounces, mean_values)
+        return p, self._cost
+
+    def return_data(self):
+        raw_data = self._data_record
+        print(raw_data)
+        # print()
+        bounces = list(raw_data.keys())
+        mean_values = [np.mean(raw_data[key]) for key in bounces]
+
+        # assert len(mean_values) == len(self._bounce_list)
+        # print('bounces:', bounces)
+        # print("mean_values:",mean_values)
+        return mean_values
+
+
+class NBProtocolBob(NodeProtocol):
+
+    def __init__(self, node):
+        super().__init__(node)
+        self.add_signal("ALICE_MEASUREMENT_READY")
+        self.add_signal("BOB_MEASUREMENT_READY")
+        self.add_signal("ENTANGLEMENT_READY")
+
+    def set_target_protocol(self, alice_protocol):
+        self._target_protocol = alice_protocol
+
+    def run(self):
+        while True:
+            yield self.await_signal(self._target_protocol, signal_label="ALICE_MEASUREMENT_READY")
+            measurement_results_from_target = self._target_protocol.get_signal_result("ALICE_MEASUREMENT_READY")
+            # entanglement = measurement_result.entanglement
+            epr_qubit = self.node.qmemory.pop(0)[0]
+            # measurement_results_from_target = measurement_result.measurement_results
+            info_qubit = correction(epr_qubit, measurement_results_from_target)
+
+            yield self.await_signal(self._target_protocol, "ENTANGLEMENT_READY")
+            # entanglement = self._target_protocol.get_signal_result("ENTANGLEMENT_READY")
+            epr_qubit = self.node.qmemory.pop(0)[0]
+            # teleport the qubit to the next node Bob
+            instr = rd.choice(CLIFFORD_OPERATORS)
+            operate(info_qubit, instr)
+            measurement_results = teleport(epr_qubit, info_qubit)
+            self.send_signal("BOB_MEASUREMENT_READY", result=[measurement_results, instr])

+ 111 - 0
add_linkselfie/network.py

@@ -0,0 +1,111 @@
+import netsquid as ns
+import numpy as np
+from netsquid.nodes import Node
+from netsquid.protocols import NodeProtocol
+
+from nb_protocol import NBProtocolAlice, NBProtocolBob
+from utils import EntanglingConnectionOnDemand, create_qprocessor
+
+
+class BAI:
+    '''The base class of the Best Arm Identification algorithm.'''
+
+    def __init__(self, arms):
+        self.arms = arms
+
+
+class QuantumNode(Node):
+    '''A quantum node with a quantum port and quantum memory.'''
+
+    def __init__(self, name):
+        super().__init__(name)
+        # For our purpose, we only need to store 1 qubit
+        self.qmemory = create_qprocessor(num_positions=1)
+        # Add quantum port used for receiving qubits generated by quantum source
+        self.add_ports(["qport"])
+
+
+class QuantumNodeProtocol(NodeProtocol):
+    '''The protocol of each quantum node
+       It scans the quantum port and see whether there is an input
+       If yes, it stores the qubit in the node's quantum memory
+    '''
+
+    def run(self):
+        while True:
+            qport = self.node.ports["qport"]
+            yield self.await_port_input(qport)
+            msg = qport.rx_input()
+            if msg is not None:
+                self.node.qmemory.put(msg.items[0])
+
+
+class QuantumNetwork:
+    '''Simulate the quantum links between two parties, Alice and Bob.
+    '''
+
+    def __init__(self, path_num, fidelity_list, noise_model):
+        '''Initialize `path_num` number of paths between Alice and Bob.
+           The fidelity of each path is provided in `fidelity_list`.
+        '''
+        super().__init__()
+        assert path_num == len(fidelity_list)
+        self.best_path = np.argmax(fidelity_list) + 1
+        self.noise_model = noise_model
+
+        # Initialize Alice and Bob
+        self.alice = QuantumNode(name="Alice")
+        self.bob = QuantumNode(name="Bob")
+        alice_protocol = QuantumNodeProtocol(self.alice)
+        bob_protocol = QuantumNodeProtocol(self.bob)
+        alice_protocol.start()
+        bob_protocol.start()
+
+        # Initialize quantum channels between Alice and Bob
+        # Note that the channels are not connected to Alice and Bob yet
+        self.quantum_channels = []
+        for i in range(path_num):
+            qconn = EntanglingConnectionOnDemand(noise_model, fidelity=fidelity_list[i])
+            self.quantum_channels.append(qconn)
+
+    def benchmark_path(self, path, bounces, sample_times):
+        """Run network benchmarking along `path`.
+
+           Parameters
+           ----------
+           path :int
+               Path id
+           bounces : [int]
+               List of number of bounces
+           sample_times : dict, int -> int
+               Map from number of bounces to its repetition times
+        """
+
+        # Get the quantum channel of the corresponding path
+        qconn = self.quantum_channels[path - 1]
+        # print("Benchmarking channel with fidelity:", qconn.fidelity)
+
+        # Connect Alice and Bob via the quantum channel
+        self.alice.ports["qport"].disconnect()
+        self.bob.ports["qport"].disconnect()
+        self.alice.ports["qport"].connect(qconn.ports["A"])
+        self.bob.ports["qport"].connect(qconn.ports["B"])
+
+        while True:
+            # Run NB protocol using quantum channel `qconn`
+            alice_protocol = NBProtocolAlice(self.alice, bounce=bounces, num_samples=sample_times, qconn=qconn)
+            bob_protocol = NBProtocolBob(self.bob)
+
+            # Let Alice and Bob know each other
+            alice_protocol.set_target_protocol(bob_protocol)
+            bob_protocol.set_target_protocol(alice_protocol)
+
+            alice_protocol.start()
+            bob_protocol.start()
+            ns.sim_run()
+
+            p, cost = alice_protocol.data_processing()
+            # print(f"Estimated parameter p: {p}, cost: {cost}")
+            # Only accept the result if the estimated parameter is in a reasonable range
+            if p >= 0 and p < 1.5:
+                return p, cost

BIN
add_linkselfie/outputs/plot_accuracy_vs_budget_Depolar.pickle


BIN
add_linkselfie/outputs/plot_ciwidth_best_vs_budget_Depolar_max_bestby-mean.pickle


+ 361 - 0
add_linkselfie/outputs/plot_ciwidth_best_vs_budget_Depolar_max_bestby-mean_gaps.csv

@@ -0,0 +1,361 @@
+scheduler,budget,trial_idx,gap
+LNaive,3000,0,-0.11525232662572615
+LNaive,3000,1,-0.1162814635310172
+LNaive,3000,2,-0.11551019498327286
+LNaive,3000,3,-0.11578460042548988
+LNaive,3000,4,-0.1168991513304547
+LNaive,3000,5,-0.11474698114272386
+LNaive,3000,6,-0.1149732776703486
+LNaive,3000,7,-0.11275637404632133
+LNaive,3000,8,-0.11624163708121649
+LNaive,3000,9,-0.11386484800630003
+LNaive,3000,10,-0.1141671071919208
+LNaive,3000,11,-0.11651576074743486
+LNaive,3000,12,-0.11533031241959402
+LNaive,3000,13,-0.11406256440593054
+LNaive,3000,14,-0.11511433446313446
+LNaive,3000,15,-0.11491153484099459
+LNaive,3000,16,-0.11517702893674042
+LNaive,3000,17,-0.115155554276961
+LNaive,3000,18,-0.11647905932954128
+LNaive,3000,19,-0.11332103593833731
+LNaive,3000,20,-0.11477871976194176
+LNaive,3000,21,-0.11528005898928106
+LNaive,3000,22,-0.11521974859314899
+LNaive,3000,23,-0.11526682916739273
+LNaive,3000,24,-0.11483393167587086
+LNaive,3000,25,-0.11604973240066618
+LNaive,3000,26,-0.11601627167916018
+LNaive,3000,27,-0.114985013454029
+LNaive,3000,28,-0.11336483428764055
+LNaive,3000,29,-0.11411357085127172
+LNaive,6000,0,-0.0841005360323932
+LNaive,6000,1,-0.08621707049238236
+LNaive,6000,2,-0.08424618665895633
+LNaive,6000,3,-0.0846580036392438
+LNaive,6000,4,-0.08515169675730139
+LNaive,6000,5,-0.08412673466135523
+LNaive,6000,6,-0.08414399156347752
+LNaive,6000,7,-0.08563398710270842
+LNaive,6000,8,-0.08557804900585941
+LNaive,6000,9,-0.08592465761716472
+LNaive,6000,10,-0.08516015640535635
+LNaive,6000,11,-0.08493867000214128
+LNaive,6000,12,-0.0834270604883891
+LNaive,6000,13,-0.08534575371117525
+LNaive,6000,14,-0.08588272535691965
+LNaive,6000,15,-0.08566092504444123
+LNaive,6000,16,-0.08546618602363454
+LNaive,6000,17,-0.08472149074039848
+LNaive,6000,18,-0.08390470306169406
+LNaive,6000,19,-0.08592953990866403
+LNaive,6000,20,-0.0862950470474011
+LNaive,6000,21,-0.08360568447223948
+LNaive,6000,22,-0.08549599663335405
+LNaive,6000,23,-0.08626749428211888
+LNaive,6000,24,-0.08522178341432995
+LNaive,6000,25,-0.0853256400320902
+LNaive,6000,26,-0.08643554782011542
+LNaive,6000,27,-0.08794586367634438
+LNaive,6000,28,-0.08469812816726541
+LNaive,6000,29,-0.08400907490427356
+LNaive,9000,0,-0.06706930005792333
+LNaive,9000,1,-0.06719176031548779
+LNaive,9000,2,-0.0684709438202904
+LNaive,9000,3,-0.06526765680635682
+LNaive,9000,4,-0.06597777344512967
+LNaive,9000,5,-0.0690357695007413
+LNaive,9000,6,-0.06666184166686062
+LNaive,9000,7,-0.06727799111214816
+LNaive,9000,8,-0.06683021786656196
+LNaive,9000,9,-0.0675058540768938
+LNaive,9000,10,-0.06762111961691641
+LNaive,9000,11,-0.06760298351413008
+LNaive,9000,12,-0.0684646825918297
+LNaive,9000,13,-0.06785821136729331
+LNaive,9000,14,-0.06630217842030295
+LNaive,9000,15,-0.0671758398499519
+LNaive,9000,16,-0.06720014082133308
+LNaive,9000,17,-0.07061517634833425
+LNaive,9000,18,-0.06591584405708872
+LNaive,9000,19,-0.06552229393064446
+LNaive,9000,20,-0.06964788160131419
+LNaive,9000,21,-0.06770778314660286
+LNaive,9000,22,-0.06715073505593405
+LNaive,9000,23,-0.0702255609532243
+LNaive,9000,24,-0.06591741798791095
+LNaive,9000,25,-0.0676873643746464
+LNaive,9000,26,-0.06831537974291146
+LNaive,9000,27,-0.06584309963344004
+LNaive,9000,28,-0.06671158189922122
+LNaive,9000,29,-0.06761545160257132
+LNaive,12000,0,-0.058544923313416874
+LNaive,12000,1,-0.0564324189099501
+LNaive,12000,2,-0.05570096070632857
+LNaive,12000,3,-0.05701798378695777
+LNaive,12000,4,-0.059127581879105495
+LNaive,12000,5,-0.05753998376584213
+LNaive,12000,6,-0.055641875480117675
+LNaive,12000,7,-0.056243623653545405
+LNaive,12000,8,-0.0564885341703798
+LNaive,12000,9,-0.05571491508741133
+LNaive,12000,10,-0.05650324486447911
+LNaive,12000,11,-0.055944163300091665
+LNaive,12000,12,-0.05556887076565664
+LNaive,12000,13,-0.0552965184267189
+LNaive,12000,14,-0.057779288869098444
+LNaive,12000,15,-0.05812085236132314
+LNaive,12000,16,-0.056774091781738534
+LNaive,12000,17,-0.0572377077723768
+LNaive,12000,18,-0.05688329776379164
+LNaive,12000,19,-0.05675254283776998
+LNaive,12000,20,-0.05832459128184264
+LNaive,12000,21,-0.056173721560785594
+LNaive,12000,22,-0.05603652110529811
+LNaive,12000,23,-0.05755345005175694
+LNaive,12000,24,-0.057432033501015556
+LNaive,12000,25,-0.05756115349741153
+LNaive,12000,26,-0.05678748000019085
+LNaive,12000,27,-0.05701627416768262
+LNaive,12000,28,-0.057073974994542476
+LNaive,12000,29,-0.056437265574215245
+LNaive,15000,0,-0.047672376362878466
+LNaive,15000,1,-0.04800210022407547
+LNaive,15000,2,-0.048009178582940515
+LNaive,15000,3,-0.0483873824271015
+LNaive,15000,4,-0.04767025796132285
+LNaive,15000,5,-0.04840726885609048
+LNaive,15000,6,-0.04824012171791159
+LNaive,15000,7,-0.04762405459173136
+LNaive,15000,8,-0.04569789757979936
+LNaive,15000,9,-0.04884641068564055
+LNaive,15000,10,-0.046753112035364364
+LNaive,15000,11,-0.049306713662000456
+LNaive,15000,12,-0.04749899609083441
+LNaive,15000,13,-0.04933460452722516
+LNaive,15000,14,-0.04809651975305984
+LNaive,15000,15,-0.048866158389188286
+LNaive,15000,16,-0.048927504785606146
+LNaive,15000,17,-0.048297909005402095
+LNaive,15000,18,-0.047648622195405776
+LNaive,15000,19,-0.0484728125748366
+LNaive,15000,20,-0.048318519485654576
+LNaive,15000,21,-0.04640452480886925
+LNaive,15000,22,-0.04842256683320367
+LNaive,15000,23,-0.04766644195600522
+LNaive,15000,24,-0.047751177164039094
+LNaive,15000,25,-0.04758827844113278
+LNaive,15000,26,-0.047939594991386336
+LNaive,15000,27,-0.04779434446450437
+LNaive,15000,28,-0.04802690095298723
+LNaive,15000,29,-0.04807078261011166
+LNaive,18000,0,-0.032853286748915744
+LNaive,18000,1,-0.03418379525230364
+LNaive,18000,2,-0.03394494499343936
+LNaive,18000,3,-0.033421307790617694
+LNaive,18000,4,-0.03358032910982034
+LNaive,18000,5,-0.03382791801647267
+LNaive,18000,6,-0.03405689568888248
+LNaive,18000,7,-0.034103410294123004
+LNaive,18000,8,-0.0340902131841454
+LNaive,18000,9,-0.03337322388675612
+LNaive,18000,10,-0.032826055889372374
+LNaive,18000,11,-0.03420217061564934
+LNaive,18000,12,-0.03430192498654694
+LNaive,18000,13,-0.033503860045569045
+LNaive,18000,14,-0.033743993642237236
+LNaive,18000,15,-0.034135627731535445
+LNaive,18000,16,-0.03382506984465916
+LNaive,18000,17,-0.03394311674167716
+LNaive,18000,18,-0.033849207773852696
+LNaive,18000,19,-0.03340023513988866
+LNaive,18000,20,-0.034720460160830524
+LNaive,18000,21,-0.03317398784244974
+LNaive,18000,22,-0.0332714915853215
+LNaive,18000,23,-0.03336753496022027
+LNaive,18000,24,-0.032926973808218185
+LNaive,18000,25,-0.03387107645633225
+LNaive,18000,26,-0.03468662898161545
+LNaive,18000,27,-0.03365161711823117
+LNaive,18000,28,-0.03435181982281277
+LNaive,18000,29,-0.034640462016360396
+Greedy,3000,0,-0.13972885159784498
+Greedy,3000,1,-0.14034605332069394
+Greedy,3000,2,-0.14222176541377274
+Greedy,3000,3,-0.13730469489094288
+Greedy,3000,4,-0.14195098410593676
+Greedy,3000,5,-0.13841492950744827
+Greedy,3000,6,-0.1417665025440915
+Greedy,3000,7,-0.13798968728963912
+Greedy,3000,8,-0.13913067608052476
+Greedy,3000,9,-0.1386051693112944
+Greedy,3000,10,-0.13894445652895393
+Greedy,3000,11,-0.1405976825143198
+Greedy,3000,12,-0.13791351102737792
+Greedy,3000,13,-0.14147759957365036
+Greedy,3000,14,-0.13723457652718618
+Greedy,3000,15,-0.14087892350280573
+Greedy,3000,16,-0.14322930090272812
+Greedy,3000,17,-0.13968190601225539
+Greedy,3000,18,-0.14232023409252026
+Greedy,3000,19,-0.14175713921761934
+Greedy,3000,20,-0.11712853789760669
+Greedy,3000,21,-0.1375519374580083
+Greedy,3000,22,-0.13838329388443016
+Greedy,3000,23,-0.13973747276280013
+Greedy,3000,24,-0.1412203266764549
+Greedy,3000,25,-0.1405011383854513
+Greedy,3000,26,-0.13988077948611188
+Greedy,3000,27,-0.14203808226222536
+Greedy,3000,28,-0.13950840235603978
+Greedy,3000,29,-0.14128578764165245
+Greedy,6000,0,-0.11153394389339488
+Greedy,6000,1,-0.11396050551986503
+Greedy,6000,2,-0.11508176648113
+Greedy,6000,3,-0.11078939040912561
+Greedy,6000,4,-0.14669178929687576
+Greedy,6000,5,-0.11466077429821564
+Greedy,6000,6,-0.11206348125757748
+Greedy,6000,7,-0.1122377469457726
+Greedy,6000,8,-0.11266616908974758
+Greedy,6000,9,-0.11094962484282556
+Greedy,6000,10,-0.11012340547175625
+Greedy,6000,11,-0.11268742908310891
+Greedy,6000,12,-0.11134789633012943
+Greedy,6000,13,-0.11275115642668665
+Greedy,6000,14,-0.11117280853820655
+Greedy,6000,15,-0.1106404490516778
+Greedy,6000,16,-0.11278521398689756
+Greedy,6000,17,-0.1117494280602862
+Greedy,6000,18,-0.11267254080859734
+Greedy,6000,19,-0.11552334361393146
+Greedy,6000,20,-0.11226041004876319
+Greedy,6000,21,-0.11285737629616
+Greedy,6000,22,-0.11463586699809913
+Greedy,6000,23,-0.11254464777146078
+Greedy,6000,24,-0.11315247285159957
+Greedy,6000,25,-0.1126776845576275
+Greedy,6000,26,-0.11304603368735144
+Greedy,6000,27,-0.1135223163960758
+Greedy,6000,28,-0.11184227872505503
+Greedy,6000,29,-0.11241831040780104
+Greedy,9000,0,-0.05635942914212411
+Greedy,9000,1,-0.12871584117599266
+Greedy,9000,2,-0.12358776461761789
+Greedy,9000,3,-0.123588955150426
+Greedy,9000,4,-0.1249622273437897
+Greedy,9000,5,-0.11909401523497332
+Greedy,9000,6,-0.12449521799636443
+Greedy,9000,7,-0.11201844953877593
+Greedy,9000,8,-0.13173879309935765
+Greedy,9000,9,-0.05923231702737575
+Greedy,9000,10,-0.1240797682219108
+Greedy,9000,11,-0.11650005548961129
+Greedy,9000,12,-0.12747199970455636
+Greedy,9000,13,-0.1276055034320146
+Greedy,9000,14,-0.16188917715111983
+Greedy,9000,15,-0.12525166086280348
+Greedy,9000,16,-0.15828018873202465
+Greedy,9000,17,-0.1175759938812947
+Greedy,9000,18,-0.12833326014515456
+Greedy,9000,19,-0.054764187845526724
+Greedy,9000,20,-0.12607590425629844
+Greedy,9000,21,-0.1272488448096214
+Greedy,9000,22,-0.16147048361380278
+Greedy,9000,23,-0.12810088932015862
+Greedy,9000,24,-0.124236503051245
+Greedy,9000,25,-0.05553219269360121
+Greedy,9000,26,-0.11806766743196473
+Greedy,9000,27,-0.12446542042103581
+Greedy,9000,28,-0.12328559363120684
+Greedy,9000,29,-0.1111795893215336
+Greedy,12000,0,-0.1930888148248897
+Greedy,12000,1,-0.05998076175176803
+Greedy,12000,2,-0.059750513529616356
+Greedy,12000,3,-0.06187789014393785
+Greedy,12000,4,-0.06350897176162162
+Greedy,12000,5,-0.10505559495463734
+Greedy,12000,6,-0.13707939871625952
+Greedy,12000,7,-0.057487326605518585
+Greedy,12000,8,-0.06064680216385787
+Greedy,12000,9,-0.05899421010565287
+Greedy,12000,10,-0.05726160492011312
+Greedy,12000,11,-0.0604986161014357
+Greedy,12000,12,-0.06011962363584489
+Greedy,12000,13,-0.1908792022205701
+Greedy,12000,14,-0.19311673887293423
+Greedy,12000,15,-0.19447442947315374
+Greedy,12000,16,-0.059453330440368046
+Greedy,12000,17,-0.0583286002289467
+Greedy,12000,18,-0.10331965689820344
+Greedy,12000,19,-0.0587044736478648
+Greedy,12000,20,-0.06400022446562215
+Greedy,12000,21,-0.19327415600277176
+Greedy,12000,22,-0.19199589793696425
+Greedy,12000,23,-0.05935788373404394
+Greedy,12000,24,-0.1377102064404213
+Greedy,12000,25,-0.1966478918984882
+Greedy,12000,26,-0.05961027885731929
+Greedy,12000,27,-0.057459771157465256
+Greedy,12000,28,-0.19290196548834726
+Greedy,12000,29,-0.06263305432051758
+Greedy,15000,0,-0.23126025208020984
+Greedy,15000,1,-0.23492341367629344
+Greedy,15000,2,-0.23021164465557353
+Greedy,15000,3,-0.23673855644032638
+Greedy,15000,4,-0.23536371927650213
+Greedy,15000,5,-0.23712638077406467
+Greedy,15000,6,-0.2330413695876632
+Greedy,15000,7,-0.2362474377319943
+Greedy,15000,8,-0.2369419891606781
+Greedy,15000,9,-0.2362920807243145
+Greedy,15000,10,-0.23071436538951495
+Greedy,15000,11,-0.23268439569417043
+Greedy,15000,12,-0.2338379985460275
+Greedy,15000,13,-0.23126249685987554
+Greedy,15000,14,-0.23671306044504714
+Greedy,15000,15,-0.23476257525954303
+Greedy,15000,16,-0.23751241843630666
+Greedy,15000,17,-0.23515862596671222
+Greedy,15000,18,-0.23410215652451627
+Greedy,15000,19,-0.2351207579382888
+Greedy,15000,20,-0.23537082565950773
+Greedy,15000,21,-0.2288632004206177
+Greedy,15000,22,-0.2352139854779185
+Greedy,15000,23,-0.23474802670120054
+Greedy,15000,24,-0.2325459870309965
+Greedy,15000,25,-0.23047709382312642
+Greedy,15000,26,-0.2325880923804713
+Greedy,15000,27,-0.23360252919336544
+Greedy,15000,28,-0.2317248261301279
+Greedy,15000,29,-0.23513847633271578
+Greedy,18000,0,-0.050689208924951434
+Greedy,18000,1,-0.056101789460940465
+Greedy,18000,2,-0.05529292106849526
+Greedy,18000,3,-0.05391095888297415
+Greedy,18000,4,-0.05527537706978358
+Greedy,18000,5,-0.052915763891636325
+Greedy,18000,6,-0.0558971866029323
+Greedy,18000,7,-0.05703460124299209
+Greedy,18000,8,-0.05288260392024191
+Greedy,18000,9,-0.05093272799809889
+Greedy,18000,10,-0.05263941352796553
+Greedy,18000,11,-0.051274958729431885
+Greedy,18000,12,-0.056588230393473604
+Greedy,18000,13,-0.0546173629584874
+Greedy,18000,14,-0.054917809480469204
+Greedy,18000,15,-0.05488966386120864
+Greedy,18000,16,-0.05468005286249589
+Greedy,18000,17,-0.05564583177657112
+Greedy,18000,18,-0.052896441173686415
+Greedy,18000,19,-0.0520832701538575
+Greedy,18000,20,-0.05656531040640855
+Greedy,18000,21,-0.055960760962019185
+Greedy,18000,22,-0.054168852935967626
+Greedy,18000,23,-0.0539751839138527
+Greedy,18000,24,-0.054601688810618554
+Greedy,18000,25,-0.05212513798841467
+Greedy,18000,26,-0.052075793093082634
+Greedy,18000,27,-0.050152668070174045
+Greedy,18000,28,-0.054503667998331506
+Greedy,18000,29,-0.05424090125946668

+ 361 - 0
add_linkselfie/outputs/plot_ciwidth_best_vs_budget_Depolar_max_bestby-mean_widths.csv

@@ -0,0 +1,361 @@
+scheduler,budget,trial_idx,width
+LNaive,3000,0,0.11525232662572615
+LNaive,3000,1,0.1162814635310172
+LNaive,3000,2,0.11551019498327286
+LNaive,3000,3,0.11578460042548988
+LNaive,3000,4,0.1168991513304547
+LNaive,3000,5,0.1159610122199981
+LNaive,3000,6,0.11528069252961315
+LNaive,3000,7,0.11636592549352875
+LNaive,3000,8,0.11624163708121649
+LNaive,3000,9,0.11449053417658206
+LNaive,3000,10,0.1141671071919208
+LNaive,3000,11,0.11651576074743486
+LNaive,3000,12,0.11533031241959402
+LNaive,3000,13,0.11406256440593054
+LNaive,3000,14,0.11511433446313446
+LNaive,3000,15,0.1164360723048079
+LNaive,3000,16,0.11517702893674042
+LNaive,3000,17,0.115155554276961
+LNaive,3000,18,0.11647905932954128
+LNaive,3000,19,0.11526186523733606
+LNaive,3000,20,0.11477871976194176
+LNaive,3000,21,0.11528005898928106
+LNaive,3000,22,0.11521974859314899
+LNaive,3000,23,0.11526682916739273
+LNaive,3000,24,0.11530298686088636
+LNaive,3000,25,0.11604973240066618
+LNaive,3000,26,0.11688591154770078
+LNaive,3000,27,0.11564027166577495
+LNaive,3000,28,0.11336483428764055
+LNaive,3000,29,0.11538531644334404
+LNaive,6000,0,0.10932759623644239
+LNaive,6000,1,0.10846219128654844
+LNaive,6000,2,0.10897221189428774
+LNaive,6000,3,0.10909635266041495
+LNaive,6000,4,0.10896701313832002
+LNaive,6000,5,0.10865726786762431
+LNaive,6000,6,0.10838102933703975
+LNaive,6000,7,0.108597832139954
+LNaive,6000,8,0.10839571145855553
+LNaive,6000,9,0.10820103362767575
+LNaive,6000,10,0.10891781146742585
+LNaive,6000,11,0.1084302744714234
+LNaive,6000,12,0.10849499468914237
+LNaive,6000,13,0.1073518082503625
+LNaive,6000,14,0.10783214060939916
+LNaive,6000,15,0.10987542793703486
+LNaive,6000,16,0.10861012707864992
+LNaive,6000,17,0.10951492949340169
+LNaive,6000,18,0.11076623903497973
+LNaive,6000,19,0.10990138247773285
+LNaive,6000,20,0.1103045678726231
+LNaive,6000,21,0.11029383118283698
+LNaive,6000,22,0.10924568244691457
+LNaive,6000,23,0.10895468665177876
+LNaive,6000,24,0.1089340417161424
+LNaive,6000,25,0.10845268614982795
+LNaive,6000,26,0.10845176967150016
+LNaive,6000,27,0.10977908439011008
+LNaive,6000,28,0.10963331814710442
+LNaive,6000,29,0.1092650535674955
+LNaive,9000,0,0.0999288459113783
+LNaive,9000,1,0.0999288459113783
+LNaive,9000,2,0.0999288459113783
+LNaive,9000,3,0.0999288459113783
+LNaive,9000,4,0.0999288459113783
+LNaive,9000,5,0.0999288459113783
+LNaive,9000,6,0.0999288459113783
+LNaive,9000,7,0.0999288459113783
+LNaive,9000,8,0.0999288459113783
+LNaive,9000,9,0.0999288459113783
+LNaive,9000,10,0.0999288459113783
+LNaive,9000,11,0.0999288459113783
+LNaive,9000,12,0.0999288459113783
+LNaive,9000,13,0.0999288459113783
+LNaive,9000,14,0.0999288459113783
+LNaive,9000,15,0.0999288459113783
+LNaive,9000,16,0.0999288459113783
+LNaive,9000,17,0.0999288459113783
+LNaive,9000,18,0.0999288459113783
+LNaive,9000,19,0.0999288459113783
+LNaive,9000,20,0.0999288459113783
+LNaive,9000,21,0.0999288459113783
+LNaive,9000,22,0.0999288459113783
+LNaive,9000,23,0.0999288459113783
+LNaive,9000,24,0.0999288459113783
+LNaive,9000,25,0.0999288459113783
+LNaive,9000,26,0.0999288459113783
+LNaive,9000,27,0.0999288459113783
+LNaive,9000,28,0.0999288459113783
+LNaive,9000,29,0.0999288459113783
+LNaive,12000,0,0.0865409191301143
+LNaive,12000,1,0.0865409191301143
+LNaive,12000,2,0.0865409191301143
+LNaive,12000,3,0.0865409191301143
+LNaive,12000,4,0.0865409191301143
+LNaive,12000,5,0.0865409191301143
+LNaive,12000,6,0.0865409191301143
+LNaive,12000,7,0.0865409191301143
+LNaive,12000,8,0.0865409191301143
+LNaive,12000,9,0.0865409191301143
+LNaive,12000,10,0.0865409191301143
+LNaive,12000,11,0.0865409191301143
+LNaive,12000,12,0.0865409191301143
+LNaive,12000,13,0.0865409191301143
+LNaive,12000,14,0.0865409191301143
+LNaive,12000,15,0.0865409191301143
+LNaive,12000,16,0.0865409191301143
+LNaive,12000,17,0.0865409191301143
+LNaive,12000,18,0.0865409191301143
+LNaive,12000,19,0.0865409191301143
+LNaive,12000,20,0.0865409191301143
+LNaive,12000,21,0.0865409191301143
+LNaive,12000,22,0.0865409191301143
+LNaive,12000,23,0.0865409191301143
+LNaive,12000,24,0.0865409191301143
+LNaive,12000,25,0.0865409191301143
+LNaive,12000,26,0.0865409191301143
+LNaive,12000,27,0.0865409191301143
+LNaive,12000,28,0.0865409191301143
+LNaive,12000,29,0.0865409191301143
+LNaive,15000,0,0.07740455120409906
+LNaive,15000,1,0.07740455120409906
+LNaive,15000,2,0.07740455120409906
+LNaive,15000,3,0.07740455120409906
+LNaive,15000,4,0.07740455120409906
+LNaive,15000,5,0.07740455120409906
+LNaive,15000,6,0.07740455120409906
+LNaive,15000,7,0.07740455120409906
+LNaive,15000,8,0.07740455120409906
+LNaive,15000,9,0.07740455120409906
+LNaive,15000,10,0.07740455120409906
+LNaive,15000,11,0.07740455120409906
+LNaive,15000,12,0.07740455120409906
+LNaive,15000,13,0.07740455120409906
+LNaive,15000,14,0.07740455120409906
+LNaive,15000,15,0.07740455120409906
+LNaive,15000,16,0.07740455120409906
+LNaive,15000,17,0.07740455120409906
+LNaive,15000,18,0.07740455120409906
+LNaive,15000,19,0.07740455120409906
+LNaive,15000,20,0.07740455120409906
+LNaive,15000,21,0.07740455120409906
+LNaive,15000,22,0.07740455120409906
+LNaive,15000,23,0.07740455120409906
+LNaive,15000,24,0.07740455120409906
+LNaive,15000,25,0.07740455120409906
+LNaive,15000,26,0.07740455120409906
+LNaive,15000,27,0.07740455120409906
+LNaive,15000,28,0.07740455120409906
+LNaive,15000,29,0.07740455120409906
+LNaive,18000,0,0.07066036458008118
+LNaive,18000,1,0.07066036458008118
+LNaive,18000,2,0.07066036458008118
+LNaive,18000,3,0.07066036458008118
+LNaive,18000,4,0.07066036458008118
+LNaive,18000,5,0.07066036458008118
+LNaive,18000,6,0.07066036458008118
+LNaive,18000,7,0.07066036458008118
+LNaive,18000,8,0.07066036458008118
+LNaive,18000,9,0.07066036458008118
+LNaive,18000,10,0.07066036458008118
+LNaive,18000,11,0.07066036458008118
+LNaive,18000,12,0.07066036458008118
+LNaive,18000,13,0.07066036458008118
+LNaive,18000,14,0.07066036458008118
+LNaive,18000,15,0.07066036458008118
+LNaive,18000,16,0.07066036458008118
+LNaive,18000,17,0.07066036458008118
+LNaive,18000,18,0.07066036458008118
+LNaive,18000,19,0.07066036458008118
+LNaive,18000,20,0.07066036458008118
+LNaive,18000,21,0.07066036458008118
+LNaive,18000,22,0.07066036458008118
+LNaive,18000,23,0.07066036458008118
+LNaive,18000,24,0.07066036458008118
+LNaive,18000,25,0.07066036458008118
+LNaive,18000,26,0.07066036458008118
+LNaive,18000,27,0.07066036458008118
+LNaive,18000,28,0.07066036458008118
+LNaive,18000,29,0.07066036458008118
+Greedy,3000,0,0.13972885159784498
+Greedy,3000,1,0.14034605332069394
+Greedy,3000,2,0.14222176541377274
+Greedy,3000,3,0.13730469489094288
+Greedy,3000,4,0.14195098410593676
+Greedy,3000,5,0.13841492950744827
+Greedy,3000,6,0.1417665025440915
+Greedy,3000,7,0.13798968728963912
+Greedy,3000,8,0.13913067608052476
+Greedy,3000,9,0.1386051693112944
+Greedy,3000,10,0.13894445652895393
+Greedy,3000,11,0.1405976825143198
+Greedy,3000,12,0.13791351102737792
+Greedy,3000,13,0.14147759957365036
+Greedy,3000,14,0.13723457652718618
+Greedy,3000,15,0.14087892350280573
+Greedy,3000,16,0.14322930090272812
+Greedy,3000,17,0.13968190601225539
+Greedy,3000,18,0.14232023409252026
+Greedy,3000,19,0.14175713921761934
+Greedy,3000,20,0.1985449814889242
+Greedy,3000,21,0.1375519374580083
+Greedy,3000,22,0.13838329388443016
+Greedy,3000,23,0.13973747276280013
+Greedy,3000,24,0.1412203266764549
+Greedy,3000,25,0.1405011383854513
+Greedy,3000,26,0.13988077948611188
+Greedy,3000,27,0.14203808226222536
+Greedy,3000,28,0.13950840235603978
+Greedy,3000,29,0.14128578764165245
+Greedy,6000,0,0.11153394389339488
+Greedy,6000,1,0.11396050551986503
+Greedy,6000,2,0.11508176648113
+Greedy,6000,3,0.11078939040912561
+Greedy,6000,4,0.14669178929687576
+Greedy,6000,5,0.11466077429821564
+Greedy,6000,6,0.11206348125757748
+Greedy,6000,7,0.1122377469457726
+Greedy,6000,8,0.11266616908974758
+Greedy,6000,9,0.11094962484282556
+Greedy,6000,10,0.11012340547175625
+Greedy,6000,11,0.11268742908310891
+Greedy,6000,12,0.11134789633012943
+Greedy,6000,13,0.11275115642668665
+Greedy,6000,14,0.11117280853820655
+Greedy,6000,15,0.1106404490516778
+Greedy,6000,16,0.11278521398689756
+Greedy,6000,17,0.1117494280602862
+Greedy,6000,18,0.11267254080859734
+Greedy,6000,19,0.11552334361393146
+Greedy,6000,20,0.11226041004876319
+Greedy,6000,21,0.11285737629616
+Greedy,6000,22,0.11463586699809913
+Greedy,6000,23,0.11254464777146078
+Greedy,6000,24,0.11315247285159957
+Greedy,6000,25,0.1126776845576275
+Greedy,6000,26,0.11304603368735144
+Greedy,6000,27,0.1135223163960758
+Greedy,6000,28,0.11184227872505503
+Greedy,6000,29,0.11241831040780104
+Greedy,9000,0,0.08518162692547071
+Greedy,9000,1,0.12871584117599266
+Greedy,9000,2,0.12586602169965377
+Greedy,9000,3,0.12598361147119053
+Greedy,9000,4,0.1249622273437897
+Greedy,9000,5,0.126116243821207
+Greedy,9000,6,0.12567986330128278
+Greedy,9000,7,0.12707342031390922
+Greedy,9000,8,0.13173879309935765
+Greedy,9000,9,0.08589341533195305
+Greedy,9000,10,0.12408435513252403
+Greedy,9000,11,0.12501834788990362
+Greedy,9000,12,0.12747199970455636
+Greedy,9000,13,0.1276055034320146
+Greedy,9000,14,0.16188917715111983
+Greedy,9000,15,0.12525166086280348
+Greedy,9000,16,0.16098308686124574
+Greedy,9000,17,0.12685358753612241
+Greedy,9000,18,0.12833326014515456
+Greedy,9000,19,0.08569848270542912
+Greedy,9000,20,0.12607590425629844
+Greedy,9000,21,0.1289058505101922
+Greedy,9000,22,0.16147048361380278
+Greedy,9000,23,0.12879991574980443
+Greedy,9000,24,0.124236503051245
+Greedy,9000,25,0.08585390897464806
+Greedy,9000,26,0.12701857296605257
+Greedy,9000,27,0.1262037498186791
+Greedy,9000,28,0.12328559363120684
+Greedy,9000,29,0.12528904997230494
+Greedy,12000,0,0.1930888148248897
+Greedy,12000,1,0.3155130837249338
+Greedy,12000,2,0.30804036376375343
+Greedy,12000,3,0.3018982739337064
+Greedy,12000,4,0.3084790118002494
+Greedy,12000,5,0.11804083395861986
+Greedy,12000,6,0.13707939871625952
+Greedy,12000,7,0.30202517837753096
+Greedy,12000,8,0.31827555729594437
+Greedy,12000,9,0.3038793945275169
+Greedy,12000,10,0.3136640242651634
+Greedy,12000,11,0.3094809254256423
+Greedy,12000,12,0.3077201806906986
+Greedy,12000,13,0.1908792022205701
+Greedy,12000,14,0.19311673887293423
+Greedy,12000,15,0.19447442947315374
+Greedy,12000,16,0.3134409816178185
+Greedy,12000,17,0.3088134791827799
+Greedy,12000,18,0.11804083395861986
+Greedy,12000,19,0.3090275838487564
+Greedy,12000,20,0.31573471555147936
+Greedy,12000,21,0.19327415600277176
+Greedy,12000,22,0.19199589793696425
+Greedy,12000,23,0.30794807475060937
+Greedy,12000,24,0.1377102064404213
+Greedy,12000,25,0.1966478918984882
+Greedy,12000,26,0.3134751287471791
+Greedy,12000,27,0.30838522826550996
+Greedy,12000,28,0.19290196548834726
+Greedy,12000,29,0.30968852314951323
+Greedy,15000,0,0.23126025208020984
+Greedy,15000,1,0.23492341367629344
+Greedy,15000,2,0.23021164465557353
+Greedy,15000,3,0.23673855644032638
+Greedy,15000,4,0.23536371927650213
+Greedy,15000,5,0.23712638077406467
+Greedy,15000,6,0.2330413695876632
+Greedy,15000,7,0.2362474377319943
+Greedy,15000,8,0.2369419891606781
+Greedy,15000,9,0.2362920807243145
+Greedy,15000,10,0.23071436538951495
+Greedy,15000,11,0.23268439569417043
+Greedy,15000,12,0.2338379985460275
+Greedy,15000,13,0.23126249685987554
+Greedy,15000,14,0.23671306044504714
+Greedy,15000,15,0.23476257525954303
+Greedy,15000,16,0.23751241843630666
+Greedy,15000,17,0.23515862596671222
+Greedy,15000,18,0.23410215652451627
+Greedy,15000,19,0.2351207579382888
+Greedy,15000,20,0.23537082565950773
+Greedy,15000,21,0.2288632004206177
+Greedy,15000,22,0.2352139854779185
+Greedy,15000,23,0.23474802670120054
+Greedy,15000,24,0.2325459870309965
+Greedy,15000,25,0.23047709382312642
+Greedy,15000,26,0.2325880923804713
+Greedy,15000,27,0.23360252919336544
+Greedy,15000,28,0.2317248261301279
+Greedy,15000,29,0.23513847633271578
+Greedy,18000,0,0.11061872049694188
+Greedy,18000,1,0.11048140610325285
+Greedy,18000,2,0.11065394379213722
+Greedy,18000,3,0.11158379616921321
+Greedy,18000,4,0.11157870964516314
+Greedy,18000,5,0.11006474486469597
+Greedy,18000,6,0.11050065660051456
+Greedy,18000,7,0.10931543381465725
+Greedy,18000,8,0.10883607012040142
+Greedy,18000,9,0.11176431459637459
+Greedy,18000,10,0.10976390010085313
+Greedy,18000,11,0.11109237071368538
+Greedy,18000,12,0.11148197256728276
+Greedy,18000,13,0.11057031727656141
+Greedy,18000,14,0.11111217204593771
+Greedy,18000,15,0.1103834583025346
+Greedy,18000,16,0.11084119866422582
+Greedy,18000,17,0.11292208783999824
+Greedy,18000,18,0.10999460641144176
+Greedy,18000,19,0.10974921357072198
+Greedy,18000,20,0.11259690725875815
+Greedy,18000,21,0.11103490292749008
+Greedy,18000,22,0.11054951807438129
+Greedy,18000,23,0.11029148500597008
+Greedy,18000,24,0.11233528060480236
+Greedy,18000,25,0.11172566963433095
+Greedy,18000,26,0.11139550431060741
+Greedy,18000,27,0.11152009108624361
+Greedy,18000,28,0.10973915963007563
+Greedy,18000,29,0.11084653077096396

BIN
add_linkselfie/outputs/plot_ciwidth_best_vs_budget_Depolar_mean_bestby-mean.pickle


+ 361 - 0
add_linkselfie/outputs/plot_ciwidth_best_vs_budget_Depolar_mean_bestby-mean_gaps.csv

@@ -0,0 +1,361 @@
+scheduler,budget,trial_idx,gap
+LNaive,3000,0,-0.11525232625795723
+LNaive,3000,1,-0.1162814635380931
+LNaive,3000,2,-0.11551019510829863
+LNaive,3000,3,-0.11578460032602256
+LNaive,3000,4,-0.1168991513005484
+LNaive,3000,5,-0.11474698109340775
+LNaive,3000,6,-0.11497327736693819
+LNaive,3000,7,-0.11275637400928828
+LNaive,3000,8,-0.11624163715605995
+LNaive,3000,9,-0.11386484827034127
+LNaive,3000,10,-0.11416710728552326
+LNaive,3000,11,-0.11651576085099058
+LNaive,3000,12,-0.11533031247191894
+LNaive,3000,13,-0.11406256413918703
+LNaive,3000,14,-0.11511433453208864
+LNaive,3000,15,-0.11491153507306862
+LNaive,3000,16,-0.11517702896500737
+LNaive,3000,17,-0.11515555434496139
+LNaive,3000,18,-0.11647905931956459
+LNaive,3000,19,-0.11332103610047217
+LNaive,3000,20,-0.11477871981890231
+LNaive,3000,21,-0.11528005898978089
+LNaive,3000,22,-0.11521974853001682
+LNaive,3000,23,-0.11526682919731202
+LNaive,3000,24,-0.11483393188245583
+LNaive,3000,25,-0.11604973245452976
+LNaive,3000,26,-0.11601627167684603
+LNaive,3000,27,-0.11498501355879442
+LNaive,3000,28,-0.11336483399843922
+LNaive,3000,29,-0.11411357081000006
+LNaive,6000,0,-0.08410053607175727
+LNaive,6000,1,-0.08621707049825411
+LNaive,6000,2,-0.08424618675234807
+LNaive,6000,3,-0.08465800379733879
+LNaive,6000,4,-0.08515169687302315
+LNaive,6000,5,-0.08412673466893905
+LNaive,6000,6,-0.08414399169494835
+LNaive,6000,7,-0.08563398717853521
+LNaive,6000,8,-0.08557804895502297
+LNaive,6000,9,-0.08592465738069044
+LNaive,6000,10,-0.08516015630053952
+LNaive,6000,11,-0.0849386698781548
+LNaive,6000,12,-0.08342706071341288
+LNaive,6000,13,-0.08534575371908071
+LNaive,6000,14,-0.0858827255771959
+LNaive,6000,15,-0.08566092505053668
+LNaive,6000,16,-0.08546618601739919
+LNaive,6000,17,-0.08472149067973589
+LNaive,6000,18,-0.08390470326136512
+LNaive,6000,19,-0.08592953965469963
+LNaive,6000,20,-0.08629504718703163
+LNaive,6000,21,-0.08360568438788851
+LNaive,6000,22,-0.08549599662260277
+LNaive,6000,23,-0.08626749446333892
+LNaive,6000,24,-0.08522178337115482
+LNaive,6000,25,-0.08532563980022778
+LNaive,6000,26,-0.08643554785645013
+LNaive,6000,27,-0.08794586362430934
+LNaive,6000,28,-0.08469812807472832
+LNaive,6000,29,-0.08400907489567622
+LNaive,9000,0,-0.06706929999458755
+LNaive,9000,1,-0.06719176019389805
+LNaive,9000,2,-0.06847094382512631
+LNaive,9000,3,-0.06526765674904389
+LNaive,9000,4,-0.0659777734064041
+LNaive,9000,5,-0.06903576955642243
+LNaive,9000,6,-0.06666184163014321
+LNaive,9000,7,-0.06727799114826416
+LNaive,9000,8,-0.06683021782917309
+LNaive,9000,9,-0.06750585414715649
+LNaive,9000,10,-0.06762111958611605
+LNaive,9000,11,-0.06760298362193295
+LNaive,9000,12,-0.06846468246680504
+LNaive,9000,13,-0.06785821138656167
+LNaive,9000,14,-0.06630217831537122
+LNaive,9000,15,-0.06717584001673715
+LNaive,9000,16,-0.0672001407748789
+LNaive,9000,17,-0.07061517636075754
+LNaive,9000,18,-0.06591584415634077
+LNaive,9000,19,-0.06552229395447795
+LNaive,9000,20,-0.06964788144933887
+LNaive,9000,21,-0.0677077831833327
+LNaive,9000,22,-0.06715073505720526
+LNaive,9000,23,-0.07022556113748535
+LNaive,9000,24,-0.06591741786876026
+LNaive,9000,25,-0.06768736428949107
+LNaive,9000,26,-0.06831537963798129
+LNaive,9000,27,-0.0658430998057028
+LNaive,9000,28,-0.06671158206955563
+LNaive,9000,29,-0.0676154516658154
+LNaive,12000,0,-0.058544923367648716
+LNaive,12000,1,-0.056432418818347374
+LNaive,12000,2,-0.05570096088439569
+LNaive,12000,3,-0.05701798371636757
+LNaive,12000,4,-0.05912758199447987
+LNaive,12000,5,-0.057539983657202476
+LNaive,12000,6,-0.055641875494184645
+LNaive,12000,7,-0.05624362366780444
+LNaive,12000,8,-0.056488534177082994
+LNaive,12000,9,-0.05571491498873815
+LNaive,12000,10,-0.056503244937608166
+LNaive,12000,11,-0.055944163268356606
+LNaive,12000,12,-0.05556887071511152
+LNaive,12000,13,-0.055296518386941385
+LNaive,12000,14,-0.057779288815738794
+LNaive,12000,15,-0.05812085229700059
+LNaive,12000,16,-0.056774091783305836
+LNaive,12000,17,-0.057237707740509514
+LNaive,12000,18,-0.0568832978738385
+LNaive,12000,19,-0.05675254283354847
+LNaive,12000,20,-0.05832459125442091
+LNaive,12000,21,-0.05617372161817846
+LNaive,12000,22,-0.05603652121303271
+LNaive,12000,23,-0.057553450050187305
+LNaive,12000,24,-0.057432033544936756
+LNaive,12000,25,-0.05756115356322988
+LNaive,12000,26,-0.05678748001755618
+LNaive,12000,27,-0.057016274124603195
+LNaive,12000,28,-0.05707397496610889
+LNaive,12000,29,-0.056437265566944284
+LNaive,15000,0,-0.0476723763507807
+LNaive,15000,1,-0.04800210017035045
+LNaive,15000,2,-0.048009178567418154
+LNaive,15000,3,-0.04838738248920671
+LNaive,15000,4,-0.047670257985745645
+LNaive,15000,5,-0.048407268872576736
+LNaive,15000,6,-0.04824012166374636
+LNaive,15000,7,-0.047624054752827494
+LNaive,15000,8,-0.04569789758371845
+LNaive,15000,9,-0.0488464106442873
+LNaive,15000,10,-0.046753112029086275
+LNaive,15000,11,-0.049306713651953604
+LNaive,15000,12,-0.047498996255456616
+LNaive,15000,13,-0.04933460449762839
+LNaive,15000,14,-0.048096519895612255
+LNaive,15000,15,-0.04886615828379437
+LNaive,15000,16,-0.04892750482224917
+LNaive,15000,17,-0.04829790907395792
+LNaive,15000,18,-0.047648622313834044
+LNaive,15000,19,-0.04847281255448166
+LNaive,15000,20,-0.04831851947376897
+LNaive,15000,21,-0.04640452463499645
+LNaive,15000,22,-0.04842256674786194
+LNaive,15000,23,-0.04766644205552828
+LNaive,15000,24,-0.04775117722367006
+LNaive,15000,25,-0.04758827844628
+LNaive,15000,26,-0.04793959509230683
+LNaive,15000,27,-0.04779434457972864
+LNaive,15000,28,-0.04802690104292051
+LNaive,15000,29,-0.048070782592939176
+LNaive,18000,0,-0.03285328678983923
+LNaive,18000,1,-0.03418379515034442
+LNaive,18000,2,-0.0339449449691307
+LNaive,18000,3,-0.03342130772811447
+LNaive,18000,4,-0.033580329045689306
+LNaive,18000,5,-0.033827917991081535
+LNaive,18000,6,-0.03405689578836968
+LNaive,18000,7,-0.03410341032338149
+LNaive,18000,8,-0.03409021316365868
+LNaive,18000,9,-0.03337322392319109
+LNaive,18000,10,-0.03282605584345222
+LNaive,18000,11,-0.03420217053309971
+LNaive,18000,12,-0.03430192489396677
+LNaive,18000,13,-0.03350386005781991
+LNaive,18000,14,-0.03374399354719615
+LNaive,18000,15,-0.03413562780217294
+LNaive,18000,16,-0.0338250698581779
+LNaive,18000,17,-0.03394311668420502
+LNaive,18000,18,-0.03384920772272282
+LNaive,18000,19,-0.033400235164445125
+LNaive,18000,20,-0.03472046021581898
+LNaive,18000,21,-0.0331739878321049
+LNaive,18000,22,-0.033271491491977834
+LNaive,18000,23,-0.03336753481857124
+LNaive,18000,24,-0.03292697387312438
+LNaive,18000,25,-0.03387107645718834
+LNaive,18000,26,-0.03468662894912011
+LNaive,18000,27,-0.03365161706293396
+LNaive,18000,28,-0.03435181990677738
+LNaive,18000,29,-0.03464046206926352
+Greedy,3000,0,-0.13972885170603044
+Greedy,3000,1,-0.1403460531063233
+Greedy,3000,2,-0.14222176546769427
+Greedy,3000,3,-0.13730469438911652
+Greedy,3000,4,-0.14195098438465625
+Greedy,3000,5,-0.13841492932030186
+Greedy,3000,6,-0.14176650279367253
+Greedy,3000,7,-0.13798968768180853
+Greedy,3000,8,-0.1391306757469577
+Greedy,3000,9,-0.13860516987828952
+Greedy,3000,10,-0.13894445679573542
+Greedy,3000,11,-0.14059768257365923
+Greedy,3000,12,-0.13791351114537975
+Greedy,3000,13,-0.14147759937534
+Greedy,3000,14,-0.13723457683714946
+Greedy,3000,15,-0.1408789231610349
+Greedy,3000,16,-0.14322930079230134
+Greedy,3000,17,-0.1396819062510981
+Greedy,3000,18,-0.14232023392058712
+Greedy,3000,19,-0.1417571389699006
+Greedy,3000,20,-0.1171285375431651
+Greedy,3000,21,-0.13755193692423373
+Greedy,3000,22,-0.138383294236186
+Greedy,3000,23,-0.13973747257238278
+Greedy,3000,24,-0.14122032623008018
+Greedy,3000,25,-0.14050113825462685
+Greedy,3000,26,-0.13988077998529447
+Greedy,3000,27,-0.14203808259634454
+Greedy,3000,28,-0.1395084023371176
+Greedy,3000,29,-0.14128578783292234
+Greedy,6000,0,-0.11153394393534899
+Greedy,6000,1,-0.11396050550207326
+Greedy,6000,2,-0.11508176645044199
+Greedy,6000,3,-0.1107893906070111
+Greedy,6000,4,-0.14669178976529307
+Greedy,6000,5,-0.11466077434944222
+Greedy,6000,6,-0.11206348126442245
+Greedy,6000,7,-0.11223774697997224
+Greedy,6000,8,-0.11266616921821282
+Greedy,6000,9,-0.1109496251163633
+Greedy,6000,10,-0.11012340565875478
+Greedy,6000,11,-0.11268742915067953
+Greedy,6000,12,-0.11134789611679019
+Greedy,6000,13,-0.11275115668892077
+Greedy,6000,14,-0.11117280856121636
+Greedy,6000,15,-0.11064044914852111
+Greedy,6000,16,-0.1127852138836829
+Greedy,6000,17,-0.11174942800151866
+Greedy,6000,18,-0.1126725408528898
+Greedy,6000,19,-0.11552334392128416
+Greedy,6000,20,-0.11226041011771626
+Greedy,6000,21,-0.11285737662602191
+Greedy,6000,22,-0.11463586698814943
+Greedy,6000,23,-0.11254464799291009
+Greedy,6000,24,-0.11315247293928732
+Greedy,6000,25,-0.11267768487878838
+Greedy,6000,26,-0.11304603353529563
+Greedy,6000,27,-0.11352231627474585
+Greedy,6000,28,-0.11184227865145158
+Greedy,6000,29,-0.1124183101031665
+Greedy,9000,0,-0.056359429280879336
+Greedy,9000,1,-0.12871584118717483
+Greedy,9000,2,-0.12358776506982616
+Greedy,9000,3,-0.12358895541278903
+Greedy,9000,4,-0.12496222761761067
+Greedy,9000,5,-0.11909401550899301
+Greedy,9000,6,-0.12449521763918903
+Greedy,9000,7,-0.11201845002488353
+Greedy,9000,8,-0.13173879286181478
+Greedy,9000,9,-0.0592323169237885
+Greedy,9000,10,-0.12407976786054653
+Greedy,9000,11,-0.1165000556831346
+Greedy,9000,12,-0.12747199941587883
+Greedy,9000,13,-0.12760550300055973
+Greedy,9000,14,-0.1618891772911667
+Greedy,9000,15,-0.12525166064796
+Greedy,9000,16,-0.15828018897796425
+Greedy,9000,17,-0.1175759938093508
+Greedy,9000,18,-0.1283332600822188
+Greedy,9000,19,-0.054764187759823724
+Greedy,9000,20,-0.12607590454515305
+Greedy,9000,21,-0.1272488450100676
+Greedy,9000,22,-0.1614704834120304
+Greedy,9000,23,-0.1281008896565181
+Greedy,9000,24,-0.12423650295136868
+Greedy,9000,25,-0.055532192360656873
+Greedy,9000,26,-0.11806766763155152
+Greedy,9000,27,-0.12446542021876761
+Greedy,9000,28,-0.1232855937380547
+Greedy,9000,29,-0.11117958963077268
+Greedy,12000,0,-0.19308881528450206
+Greedy,12000,1,-0.0599807617167033
+Greedy,12000,2,-0.059750513567686014
+Greedy,12000,3,-0.06187789019571921
+Greedy,12000,4,-0.06350897192254523
+Greedy,12000,5,-0.10505559521947683
+Greedy,12000,6,-0.13707939870241326
+Greedy,12000,7,-0.05748732668709877
+Greedy,12000,8,-0.06064680214773366
+Greedy,12000,9,-0.05899421009277617
+Greedy,12000,10,-0.05726160491970289
+Greedy,12000,11,-0.060498616098134894
+Greedy,12000,12,-0.06011962362693779
+Greedy,12000,13,-0.19087920211304032
+Greedy,12000,14,-0.19311673857312606
+Greedy,12000,15,-0.19447442946484772
+Greedy,12000,16,-0.059453330403918536
+Greedy,12000,17,-0.05832860020131014
+Greedy,12000,18,-0.10331965680082511
+Greedy,12000,19,-0.05870447373951937
+Greedy,12000,20,-0.0640002245040584
+Greedy,12000,21,-0.19327415585791607
+Greedy,12000,22,-0.19199589785955018
+Greedy,12000,23,-0.05935788367481465
+Greedy,12000,24,-0.1377102059785391
+Greedy,12000,25,-0.19664789202727206
+Greedy,12000,26,-0.05961027895029569
+Greedy,12000,27,-0.05745977113669509
+Greedy,12000,28,-0.19290196529912862
+Greedy,12000,29,-0.06263305432690303
+Greedy,15000,0,-0.2312602521716809
+Greedy,15000,1,-0.2349234134006688
+Greedy,15000,2,-0.23021164479799228
+Greedy,15000,3,-0.2367385567651843
+Greedy,15000,4,-0.2353637192938116
+Greedy,15000,5,-0.23712638115319296
+Greedy,15000,6,-0.23304136923404895
+Greedy,15000,7,-0.23624743807182824
+Greedy,15000,8,-0.2369419891809903
+Greedy,15000,9,-0.23629208084019337
+Greedy,15000,10,-0.23071436531264133
+Greedy,15000,11,-0.23268439567971733
+Greedy,15000,12,-0.23383799902794755
+Greedy,15000,13,-0.23126249637732887
+Greedy,15000,14,-0.23671306016973603
+Greedy,15000,15,-0.23476257550352697
+Greedy,15000,16,-0.2375124181608883
+Greedy,15000,17,-0.23515862610237326
+Greedy,15000,18,-0.23410215682623603
+Greedy,15000,19,-0.23512075812304567
+Greedy,15000,20,-0.2353708258885725
+Greedy,15000,21,-0.22886320061158227
+Greedy,15000,22,-0.23521398524219417
+Greedy,15000,23,-0.23474802688206764
+Greedy,15000,24,-0.2325459868447648
+Greedy,15000,25,-0.23047709432490637
+Greedy,15000,26,-0.23258809228289512
+Greedy,15000,27,-0.23360252961171568
+Greedy,15000,28,-0.2317248261342022
+Greedy,15000,29,-0.23513847652516207
+Greedy,18000,0,-0.050689208742866976
+Greedy,18000,1,-0.05610178956226186
+Greedy,18000,2,-0.05529292089111382
+Greedy,18000,3,-0.05391095884112296
+Greedy,18000,4,-0.05527537718604414
+Greedy,18000,5,-0.05291576386440888
+Greedy,18000,6,-0.05589718674837563
+Greedy,18000,7,-0.05703460112363601
+Greedy,18000,8,-0.05288260378610621
+Greedy,18000,9,-0.05093272821328232
+Greedy,18000,10,-0.05263941358712931
+Greedy,18000,11,-0.05127495876849786
+Greedy,18000,12,-0.056588230391489636
+Greedy,18000,13,-0.054617362841273276
+Greedy,18000,14,-0.05491780932389867
+Greedy,18000,15,-0.05488966361316072
+Greedy,18000,16,-0.0546800527835567
+Greedy,18000,17,-0.055645831741658935
+Greedy,18000,18,-0.05289644107860947
+Greedy,18000,19,-0.052083270065799825
+Greedy,18000,20,-0.056565310358409615
+Greedy,18000,21,-0.055960761254003843
+Greedy,18000,22,-0.05416885311036168
+Greedy,18000,23,-0.053975184026726186
+Greedy,18000,24,-0.05460168862819825
+Greedy,18000,25,-0.052125137973311086
+Greedy,18000,26,-0.05207579322379363
+Greedy,18000,27,-0.050152668213635176
+Greedy,18000,28,-0.05450366795772399
+Greedy,18000,29,-0.05424090126270076

+ 361 - 0
add_linkselfie/outputs/plot_ciwidth_best_vs_budget_Depolar_mean_bestby-mean_widths.csv

@@ -0,0 +1,361 @@
+scheduler,budget,trial_idx,width
+LNaive,3000,0,0.10199818777583403
+LNaive,3000,1,0.10278264569241251
+LNaive,3000,2,0.10176420116603713
+LNaive,3000,3,0.10282694630758364
+LNaive,3000,4,0.10279064148250232
+LNaive,3000,5,0.10277776759496826
+LNaive,3000,6,0.10210270036016507
+LNaive,3000,7,0.1031471849590984
+LNaive,3000,8,0.1024002046888266
+LNaive,3000,9,0.1017882775264906
+LNaive,3000,10,0.10224311092409925
+LNaive,3000,11,0.10205555748670576
+LNaive,3000,12,0.10217474547008669
+LNaive,3000,13,0.10193310815982648
+LNaive,3000,14,0.10229085996873961
+LNaive,3000,15,0.10269266453386443
+LNaive,3000,16,0.10237885319386242
+LNaive,3000,17,0.10252208368379023
+LNaive,3000,18,0.10295973270276544
+LNaive,3000,19,0.10215583541525537
+LNaive,3000,20,0.10128346498349146
+LNaive,3000,21,0.10230628083759459
+LNaive,3000,22,0.10194315194661407
+LNaive,3000,23,0.10274534117897664
+LNaive,3000,24,0.10192977589278862
+LNaive,3000,25,0.10289085423178275
+LNaive,3000,26,0.10325932183493214
+LNaive,3000,27,0.10236657888782259
+LNaive,3000,28,0.10150638089870638
+LNaive,3000,29,0.10241959226891233
+LNaive,6000,0,0.08918083710123621
+LNaive,6000,1,0.08955686212422913
+LNaive,6000,2,0.08960607985358167
+LNaive,6000,3,0.08973690909546599
+LNaive,6000,4,0.08935087171686358
+LNaive,6000,5,0.08957749616282817
+LNaive,6000,6,0.08924178745552298
+LNaive,6000,7,0.08952220312646952
+LNaive,6000,8,0.08920844029501844
+LNaive,6000,9,0.08946447569812414
+LNaive,6000,10,0.08989020379315742
+LNaive,6000,11,0.08944341839871343
+LNaive,6000,12,0.08914405428418444
+LNaive,6000,13,0.08942015103654981
+LNaive,6000,14,0.08964170525582453
+LNaive,6000,15,0.09004057255670155
+LNaive,6000,16,0.0896119196496672
+LNaive,6000,17,0.08953295702067095
+LNaive,6000,18,0.08996394807536297
+LNaive,6000,19,0.09007309521344857
+LNaive,6000,20,0.08996444739523395
+LNaive,6000,21,0.08958695396587217
+LNaive,6000,22,0.08939193399426455
+LNaive,6000,23,0.08947050691219323
+LNaive,6000,24,0.08971435085820345
+LNaive,6000,25,0.08979458668436047
+LNaive,6000,26,0.08912208060928566
+LNaive,6000,27,0.08997823907155682
+LNaive,6000,28,0.08995013708616728
+LNaive,6000,29,0.08973120075181547
+LNaive,9000,0,0.0748498449503822
+LNaive,9000,1,0.07431983976791841
+LNaive,9000,2,0.07452330241287904
+LNaive,9000,3,0.07487894325665641
+LNaive,9000,4,0.0745099879384435
+LNaive,9000,5,0.07487203544733385
+LNaive,9000,6,0.07474966321097698
+LNaive,9000,7,0.07432818348287262
+LNaive,9000,8,0.07473467480260432
+LNaive,9000,9,0.07456870473131982
+LNaive,9000,10,0.07459488903144906
+LNaive,9000,11,0.07457746165859698
+LNaive,9000,12,0.0743916613650359
+LNaive,9000,13,0.07479696502973594
+LNaive,9000,14,0.0746473377994018
+LNaive,9000,15,0.0745402179795089
+LNaive,9000,16,0.07438634745986457
+LNaive,9000,17,0.07426124374172305
+LNaive,9000,18,0.07481220023835129
+LNaive,9000,19,0.07467450176856778
+LNaive,9000,20,0.07455197685729135
+LNaive,9000,21,0.07463738328686553
+LNaive,9000,22,0.07497033327730603
+LNaive,9000,23,0.07424733406595534
+LNaive,9000,24,0.07470751995803981
+LNaive,9000,25,0.0746529054904274
+LNaive,9000,26,0.07412479530908063
+LNaive,9000,27,0.07433852568534505
+LNaive,9000,28,0.07462104119614459
+LNaive,9000,29,0.07480865153812662
+LNaive,12000,0,0.07025416522682996
+LNaive,12000,1,0.06955544881604385
+LNaive,12000,2,0.06977534554998173
+LNaive,12000,3,0.070226454124883
+LNaive,12000,4,0.07030073496843108
+LNaive,12000,5,0.07005157511592193
+LNaive,12000,6,0.0697290498664787
+LNaive,12000,7,0.06995698915128871
+LNaive,12000,8,0.06994842632259597
+LNaive,12000,9,0.06955070518482602
+LNaive,12000,10,0.07026358778194271
+LNaive,12000,11,0.06991838201775706
+LNaive,12000,12,0.06974890926252719
+LNaive,12000,13,0.06957344993393029
+LNaive,12000,14,0.06995965129016346
+LNaive,12000,15,0.07027649687405106
+LNaive,12000,16,0.06981098511378044
+LNaive,12000,17,0.07000925551737362
+LNaive,12000,18,0.06996212519365679
+LNaive,12000,19,0.06956058897815358
+LNaive,12000,20,0.07005591485204939
+LNaive,12000,21,0.07012861333231575
+LNaive,12000,22,0.06978457693169766
+LNaive,12000,23,0.07007191090549318
+LNaive,12000,24,0.06994950548310781
+LNaive,12000,25,0.06998343931838276
+LNaive,12000,26,0.07007996121111482
+LNaive,12000,27,0.06981279476269835
+LNaive,12000,28,0.06943957193402865
+LNaive,12000,29,0.06990941656847005
+LNaive,15000,0,0.06299726980006055
+LNaive,15000,1,0.06292151291291048
+LNaive,15000,2,0.0629426898350361
+LNaive,15000,3,0.06266619557864916
+LNaive,15000,4,0.06277044437623196
+LNaive,15000,5,0.06265088064062056
+LNaive,15000,6,0.06297031317388287
+LNaive,15000,7,0.06270740309316714
+LNaive,15000,8,0.06248483246320994
+LNaive,15000,9,0.06290670532414466
+LNaive,15000,10,0.06264643198675605
+LNaive,15000,11,0.06298203782441043
+LNaive,15000,12,0.0628210183578739
+LNaive,15000,13,0.06286991769858212
+LNaive,15000,14,0.06276808641243337
+LNaive,15000,15,0.0629914700957304
+LNaive,15000,16,0.06312851334007874
+LNaive,15000,17,0.0630118688467592
+LNaive,15000,18,0.06260022107163388
+LNaive,15000,19,0.06272416733162449
+LNaive,15000,20,0.06301929550926062
+LNaive,15000,21,0.06258816726796683
+LNaive,15000,22,0.0629825885326647
+LNaive,15000,23,0.06270470960251433
+LNaive,15000,24,0.06276325990161558
+LNaive,15000,25,0.06287025700437239
+LNaive,15000,26,0.06306170796381434
+LNaive,15000,27,0.06305973308944668
+LNaive,15000,28,0.06258443517139282
+LNaive,15000,29,0.06271271154573439
+LNaive,18000,0,0.06051332565787763
+LNaive,18000,1,0.06081526922350614
+LNaive,18000,2,0.06083427614877527
+LNaive,18000,3,0.06072347254276259
+LNaive,18000,4,0.06079547643139779
+LNaive,18000,5,0.06069543697841014
+LNaive,18000,6,0.060826022868405404
+LNaive,18000,7,0.0606575570108829
+LNaive,18000,8,0.060893597508170506
+LNaive,18000,9,0.060791964542773136
+LNaive,18000,10,0.06062959071712385
+LNaive,18000,11,0.060878919791841235
+LNaive,18000,12,0.06080423716453165
+LNaive,18000,13,0.06070068663150078
+LNaive,18000,14,0.06072085096839086
+LNaive,18000,15,0.06071687091480652
+LNaive,18000,16,0.06077964157989072
+LNaive,18000,17,0.06093118698196528
+LNaive,18000,18,0.06080334375794427
+LNaive,18000,19,0.06069538076796188
+LNaive,18000,20,0.0608482926064798
+LNaive,18000,21,0.06071804211199531
+LNaive,18000,22,0.060642749952236764
+LNaive,18000,23,0.06067182495328175
+LNaive,18000,24,0.060673921841431576
+LNaive,18000,25,0.06070140854360673
+LNaive,18000,26,0.060810705626123375
+LNaive,18000,27,0.06074470099727025
+LNaive,18000,28,0.060716686911185445
+LNaive,18000,29,0.06096131431648233
+Greedy,3000,0,0.1166279071912184
+Greedy,3000,1,0.11647896273266674
+Greedy,3000,2,0.11734728867470112
+Greedy,3000,3,0.11580392182733723
+Greedy,3000,4,0.11849079829782942
+Greedy,3000,5,0.11598169420777656
+Greedy,3000,6,0.1182207592275711
+Greedy,3000,7,0.11662574986144691
+Greedy,3000,8,0.11604164510883952
+Greedy,3000,9,0.11628759813617535
+Greedy,3000,10,0.11736349415795562
+Greedy,3000,11,0.11856500626314614
+Greedy,3000,12,0.11474286544572106
+Greedy,3000,13,0.11733191933326208
+Greedy,3000,14,0.11516186366336438
+Greedy,3000,15,0.11538562651029782
+Greedy,3000,16,0.11770217522768738
+Greedy,3000,17,0.11714889475178432
+Greedy,3000,18,0.11802773925547234
+Greedy,3000,19,0.11781206691034192
+Greedy,3000,20,0.13570626791565946
+Greedy,3000,21,0.11541079140428316
+Greedy,3000,22,0.1169532393898971
+Greedy,3000,23,0.11676514452735005
+Greedy,3000,24,0.11795102449975821
+Greedy,3000,25,0.11675108618881391
+Greedy,3000,26,0.1167857110204145
+Greedy,3000,27,0.11878518698064881
+Greedy,3000,28,0.11516627804092476
+Greedy,3000,29,0.11736201067873446
+Greedy,6000,0,0.09009095428591085
+Greedy,6000,1,0.09055693334851393
+Greedy,6000,2,0.0911639166417421
+Greedy,6000,3,0.08968241058086635
+Greedy,6000,4,0.10123420599875184
+Greedy,6000,5,0.09116329570191377
+Greedy,6000,6,0.09036102563958455
+Greedy,6000,7,0.0900018703713521
+Greedy,6000,8,0.09047981499105932
+Greedy,6000,9,0.0897939605276683
+Greedy,6000,10,0.08899989455566781
+Greedy,6000,11,0.08993071573004859
+Greedy,6000,12,0.08992024968478574
+Greedy,6000,13,0.09070041592682758
+Greedy,6000,14,0.08932328823143405
+Greedy,6000,15,0.08969333755236837
+Greedy,6000,16,0.08969816781322078
+Greedy,6000,17,0.08973353015295497
+Greedy,6000,18,0.09054414670655409
+Greedy,6000,19,0.0911472609259673
+Greedy,6000,20,0.08979557893364065
+Greedy,6000,21,0.09022209395471115
+Greedy,6000,22,0.09069316548501498
+Greedy,6000,23,0.08965934675464644
+Greedy,6000,24,0.09044595675329208
+Greedy,6000,25,0.09034010701559037
+Greedy,6000,26,0.09004474173052952
+Greedy,6000,27,0.09000130161557889
+Greedy,6000,28,0.09016038733316352
+Greedy,6000,29,0.09038769271066671
+Greedy,9000,0,0.062320825849886595
+Greedy,9000,1,0.07591824927107034
+Greedy,9000,2,0.07495774316730386
+Greedy,9000,3,0.07506392785669365
+Greedy,9000,4,0.07464662022720703
+Greedy,9000,5,0.0756074331307028
+Greedy,9000,6,0.07521805849188538
+Greedy,9000,7,0.07577848234586304
+Greedy,9000,8,0.07730249830972187
+Greedy,9000,9,0.06276344363214699
+Greedy,9000,10,0.07434511552144189
+Greedy,9000,11,0.07518425814762449
+Greedy,9000,12,0.07551446247835132
+Greedy,9000,13,0.07598781208742063
+Greedy,9000,14,0.08716478842692461
+Greedy,9000,15,0.07494810946000348
+Greedy,9000,16,0.0871432384276211
+Greedy,9000,17,0.07583489558341831
+Greedy,9000,18,0.07576363698629067
+Greedy,9000,19,0.06232804577291803
+Greedy,9000,20,0.07535510447408089
+Greedy,9000,21,0.07642193651869038
+Greedy,9000,22,0.08697713170967976
+Greedy,9000,23,0.07598518813596582
+Greedy,9000,24,0.07479214510684244
+Greedy,9000,25,0.06259438537761715
+Greedy,9000,26,0.07539343355386081
+Greedy,9000,27,0.07537088224713535
+Greedy,9000,28,0.07403131280055768
+Greedy,9000,29,0.07474192136823436
+Greedy,12000,0,0.09716226700410006
+Greedy,12000,1,0.13789120772359764
+Greedy,12000,2,0.13540030105902687
+Greedy,12000,3,0.13335293778302307
+Greedy,12000,4,0.13554651719533886
+Greedy,12000,5,0.08520109506098521
+Greedy,12000,6,0.07855025185283167
+Greedy,12000,7,0.1333952392564138
+Greedy,12000,8,0.13881203225116856
+Greedy,12000,9,0.13401331124596605
+Greedy,12000,10,0.13727485454724797
+Greedy,12000,11,0.13588048823348
+Greedy,12000,12,0.1352935732007786
+Greedy,12000,13,0.09642572928027948
+Greedy,12000,14,0.09717157476697473
+Greedy,12000,15,0.09762413839754862
+Greedy,12000,16,0.13720050719695923
+Greedy,12000,17,0.13565800619107873
+Greedy,12000,18,0.08462244892143463
+Greedy,12000,19,0.13572937440930954
+Greedy,12000,20,0.13796508500675117
+Greedy,12000,21,0.09722404719523807
+Greedy,12000,22,0.09679796119578277
+Greedy,12000,23,0.135369537981048
+Greedy,12000,24,0.07876052094487362
+Greedy,12000,25,0.09834862591835673
+Greedy,12000,26,0.13721188932326167
+Greedy,12000,27,0.13551525588678373
+Greedy,12000,28,0.09709998367564225
+Greedy,12000,29,0.13594968739455524
+Greedy,15000,0,0.11394814537671875
+Greedy,15000,1,0.11555025952831399
+Greedy,15000,2,0.1139763877357151
+Greedy,15000,3,0.11584848658347613
+Greedy,15000,4,0.115626276260634
+Greedy,15000,5,0.11675884850417262
+Greedy,15000,6,0.11494493278262759
+Greedy,15000,7,0.11606415498283273
+Greedy,15000,8,0.11676112953780031
+Greedy,15000,9,0.11593639742321393
+Greedy,15000,10,0.1142265038013816
+Greedy,15000,11,0.11524553700811165
+Greedy,15000,12,0.11519745802883359
+Greedy,15000,13,0.11405524333216821
+Greedy,15000,14,0.11639700572455906
+Greedy,15000,15,0.11557162424474354
+Greedy,15000,16,0.11639303768978297
+Greedy,15000,17,0.11601886817972613
+Greedy,15000,18,0.11524282162854038
+Greedy,15000,19,0.1157029464040847
+Greedy,15000,20,0.11564035872047033
+Greedy,15000,21,0.11387702746501908
+Greedy,15000,22,0.11563054970917068
+Greedy,15000,23,0.11508382801234436
+Greedy,15000,24,0.11481132493131052
+Greedy,15000,25,0.11419527257179962
+Greedy,15000,26,0.11474677730320544
+Greedy,15000,27,0.11495259528681549
+Greedy,15000,28,0.11456827469496766
+Greedy,15000,29,0.11567476677341888
+Greedy,18000,0,0.08506558862550324
+Greedy,18000,1,0.08592040899836266
+Greedy,18000,2,0.08602657597789017
+Greedy,18000,3,0.08648757283008768
+Greedy,18000,4,0.08632132953183262
+Greedy,18000,5,0.08530113683377527
+Greedy,18000,6,0.0855990695994751
+Greedy,18000,7,0.08549350676479588
+Greedy,18000,8,0.08512322767912106
+Greedy,18000,9,0.08585356006443212
+Greedy,18000,10,0.08535786960420348
+Greedy,18000,11,0.08545855634118926
+Greedy,18000,12,0.08638328351183788
+Greedy,18000,13,0.085329199493265
+Greedy,18000,14,0.08510510464180136
+Greedy,18000,15,0.08606131723542476
+Greedy,18000,16,0.08532142663653068
+Greedy,18000,17,0.08615646349371005
+Greedy,18000,18,0.0855825865656296
+Greedy,18000,19,0.08528238398044914
+Greedy,18000,20,0.08582647081450893
+Greedy,18000,21,0.08622365546838262
+Greedy,18000,22,0.08620812014116434
+Greedy,18000,23,0.08597723194751883
+Greedy,18000,24,0.085502355173531
+Greedy,18000,25,0.08576536461498219
+Greedy,18000,26,0.08696225661454442
+Greedy,18000,27,0.08642667827794244
+Greedy,18000,28,0.08504092455068057
+Greedy,18000,29,0.08532758390925095

BIN
add_linkselfie/outputs/plot_ciwidth_vs_budget_Depolar_max.pickle


+ 361 - 0
add_linkselfie/outputs/plot_ciwidth_vs_budget_Depolar_max_widths.csv

@@ -0,0 +1,361 @@
+scheduler,budget,trial_idx,width
+LNaive,3000,0,0.1730818382602286
+LNaive,3000,1,0.1730818382602286
+LNaive,3000,2,0.1730818382602286
+LNaive,3000,3,0.1730818382602286
+LNaive,3000,4,0.1730818382602286
+LNaive,3000,5,0.1730818382602286
+LNaive,3000,6,0.1730818382602286
+LNaive,3000,7,0.1730818382602286
+LNaive,3000,8,0.1730818382602286
+LNaive,3000,9,0.1730818382602286
+LNaive,3000,10,0.1730818382602286
+LNaive,3000,11,0.1730818382602286
+LNaive,3000,12,0.1730818382602286
+LNaive,3000,13,0.1730818382602286
+LNaive,3000,14,0.1730818382602286
+LNaive,3000,15,0.1730818382602286
+LNaive,3000,16,0.1730818382602286
+LNaive,3000,17,0.1730818382602286
+LNaive,3000,18,0.1730818382602286
+LNaive,3000,19,0.1730818382602286
+LNaive,3000,20,0.1730818382602286
+LNaive,3000,21,0.1730818382602286
+LNaive,3000,22,0.1730818382602286
+LNaive,3000,23,0.1730818382602286
+LNaive,3000,24,0.1730818382602286
+LNaive,3000,25,0.1730818382602286
+LNaive,3000,26,0.1730818382602286
+LNaive,3000,27,0.1730818382602286
+LNaive,3000,28,0.1730818382602286
+LNaive,3000,29,0.1730818382602286
+LNaive,6000,0,0.12238734153404085
+LNaive,6000,1,0.12238734153404085
+LNaive,6000,2,0.12238734153404085
+LNaive,6000,3,0.12238734153404085
+LNaive,6000,4,0.12238734153404085
+LNaive,6000,5,0.12238734153404085
+LNaive,6000,6,0.12238734153404085
+LNaive,6000,7,0.12238734153404085
+LNaive,6000,8,0.12238734153404085
+LNaive,6000,9,0.12238734153404085
+LNaive,6000,10,0.12238734153404085
+LNaive,6000,11,0.12238734153404085
+LNaive,6000,12,0.12238734153404085
+LNaive,6000,13,0.12238734153404085
+LNaive,6000,14,0.12238734153404085
+LNaive,6000,15,0.12238734153404085
+LNaive,6000,16,0.12238734153404085
+LNaive,6000,17,0.12238734153404085
+LNaive,6000,18,0.12238734153404085
+LNaive,6000,19,0.12238734153404085
+LNaive,6000,20,0.12238734153404085
+LNaive,6000,21,0.12238734153404085
+LNaive,6000,22,0.12238734153404085
+LNaive,6000,23,0.12238734153404085
+LNaive,6000,24,0.12238734153404085
+LNaive,6000,25,0.12238734153404085
+LNaive,6000,26,0.12238734153404085
+LNaive,6000,27,0.12238734153404085
+LNaive,6000,28,0.12238734153404085
+LNaive,6000,29,0.12238734153404085
+LNaive,9000,0,0.0999288459113783
+LNaive,9000,1,0.0999288459113783
+LNaive,9000,2,0.0999288459113783
+LNaive,9000,3,0.0999288459113783
+LNaive,9000,4,0.0999288459113783
+LNaive,9000,5,0.0999288459113783
+LNaive,9000,6,0.0999288459113783
+LNaive,9000,7,0.0999288459113783
+LNaive,9000,8,0.0999288459113783
+LNaive,9000,9,0.0999288459113783
+LNaive,9000,10,0.0999288459113783
+LNaive,9000,11,0.0999288459113783
+LNaive,9000,12,0.0999288459113783
+LNaive,9000,13,0.0999288459113783
+LNaive,9000,14,0.0999288459113783
+LNaive,9000,15,0.0999288459113783
+LNaive,9000,16,0.0999288459113783
+LNaive,9000,17,0.0999288459113783
+LNaive,9000,18,0.0999288459113783
+LNaive,9000,19,0.0999288459113783
+LNaive,9000,20,0.0999288459113783
+LNaive,9000,21,0.0999288459113783
+LNaive,9000,22,0.0999288459113783
+LNaive,9000,23,0.0999288459113783
+LNaive,9000,24,0.0999288459113783
+LNaive,9000,25,0.0999288459113783
+LNaive,9000,26,0.0999288459113783
+LNaive,9000,27,0.0999288459113783
+LNaive,9000,28,0.0999288459113783
+LNaive,9000,29,0.0999288459113783
+LNaive,12000,0,0.0865409191301143
+LNaive,12000,1,0.0865409191301143
+LNaive,12000,2,0.0865409191301143
+LNaive,12000,3,0.0865409191301143
+LNaive,12000,4,0.0865409191301143
+LNaive,12000,5,0.0865409191301143
+LNaive,12000,6,0.0865409191301143
+LNaive,12000,7,0.0865409191301143
+LNaive,12000,8,0.0865409191301143
+LNaive,12000,9,0.0865409191301143
+LNaive,12000,10,0.0865409191301143
+LNaive,12000,11,0.0865409191301143
+LNaive,12000,12,0.0865409191301143
+LNaive,12000,13,0.0865409191301143
+LNaive,12000,14,0.0865409191301143
+LNaive,12000,15,0.0865409191301143
+LNaive,12000,16,0.0865409191301143
+LNaive,12000,17,0.0865409191301143
+LNaive,12000,18,0.0865409191301143
+LNaive,12000,19,0.0865409191301143
+LNaive,12000,20,0.0865409191301143
+LNaive,12000,21,0.0865409191301143
+LNaive,12000,22,0.0865409191301143
+LNaive,12000,23,0.0865409191301143
+LNaive,12000,24,0.0865409191301143
+LNaive,12000,25,0.0865409191301143
+LNaive,12000,26,0.0865409191301143
+LNaive,12000,27,0.0865409191301143
+LNaive,12000,28,0.0865409191301143
+LNaive,12000,29,0.0865409191301143
+LNaive,15000,0,0.07740455120409906
+LNaive,15000,1,0.07740455120409906
+LNaive,15000,2,0.07740455120409906
+LNaive,15000,3,0.07740455120409906
+LNaive,15000,4,0.07740455120409906
+LNaive,15000,5,0.07740455120409906
+LNaive,15000,6,0.07740455120409906
+LNaive,15000,7,0.07740455120409906
+LNaive,15000,8,0.07740455120409906
+LNaive,15000,9,0.07740455120409906
+LNaive,15000,10,0.07740455120409906
+LNaive,15000,11,0.07740455120409906
+LNaive,15000,12,0.07740455120409906
+LNaive,15000,13,0.07740455120409906
+LNaive,15000,14,0.07740455120409906
+LNaive,15000,15,0.07740455120409906
+LNaive,15000,16,0.07740455120409906
+LNaive,15000,17,0.07740455120409906
+LNaive,15000,18,0.07740455120409906
+LNaive,15000,19,0.07740455120409906
+LNaive,15000,20,0.07740455120409906
+LNaive,15000,21,0.07740455120409906
+LNaive,15000,22,0.07740455120409906
+LNaive,15000,23,0.07740455120409906
+LNaive,15000,24,0.07740455120409906
+LNaive,15000,25,0.07740455120409906
+LNaive,15000,26,0.07740455120409906
+LNaive,15000,27,0.07740455120409906
+LNaive,15000,28,0.07740455120409906
+LNaive,15000,29,0.07740455120409906
+LNaive,18000,0,0.07066036458008118
+LNaive,18000,1,0.07066036458008118
+LNaive,18000,2,0.07066036458008118
+LNaive,18000,3,0.07066036458008118
+LNaive,18000,4,0.07066036458008118
+LNaive,18000,5,0.07066036458008118
+LNaive,18000,6,0.07066036458008118
+LNaive,18000,7,0.07066036458008118
+LNaive,18000,8,0.07066036458008118
+LNaive,18000,9,0.07066036458008118
+LNaive,18000,10,0.07066036458008118
+LNaive,18000,11,0.07066036458008118
+LNaive,18000,12,0.07066036458008118
+LNaive,18000,13,0.07066036458008118
+LNaive,18000,14,0.07066036458008118
+LNaive,18000,15,0.07066036458008118
+LNaive,18000,16,0.07066036458008118
+LNaive,18000,17,0.07066036458008118
+LNaive,18000,18,0.07066036458008118
+LNaive,18000,19,0.07066036458008118
+LNaive,18000,20,0.07066036458008118
+LNaive,18000,21,0.07066036458008118
+LNaive,18000,22,0.07066036458008118
+LNaive,18000,23,0.07066036458008118
+LNaive,18000,24,0.07066036458008118
+LNaive,18000,25,0.07066036458008118
+LNaive,18000,26,0.07066036458008118
+LNaive,18000,27,0.07066036458008118
+LNaive,18000,28,0.07066036458008118
+LNaive,18000,29,0.07066036458008118
+Greedy,3000,0,0.34723916799351384
+Greedy,3000,1,0.3459652120721066
+Greedy,3000,2,0.3622313030705129
+Greedy,3000,3,0.3629449445309261
+Greedy,3000,4,0.34820279169581014
+Greedy,3000,5,0.35439536398837435
+Greedy,3000,6,0.3628327255275745
+Greedy,3000,7,0.3496325266609508
+Greedy,3000,8,0.36205731363488325
+Greedy,3000,9,0.3574963572766112
+Greedy,3000,10,0.3475526982986106
+Greedy,3000,11,0.35199775783773823
+Greedy,3000,12,0.36423615354166117
+Greedy,3000,13,0.35219732741511
+Greedy,3000,14,0.3483256434338864
+Greedy,3000,15,0.3505957901380361
+Greedy,3000,16,0.3653564875913793
+Greedy,3000,17,0.37583869519405533
+Greedy,3000,18,0.3508138028558039
+Greedy,3000,19,0.36691586525275643
+Greedy,3000,20,0.20687236484481342
+Greedy,3000,21,0.35634394253378465
+Greedy,3000,22,0.3474380210343706
+Greedy,3000,23,0.36061193853338525
+Greedy,3000,24,0.368099312289935
+Greedy,3000,25,0.3621017132828408
+Greedy,3000,26,0.3659211228106558
+Greedy,3000,27,0.36933241301581377
+Greedy,3000,28,0.35257054333864235
+Greedy,3000,29,0.35125944862837133
+Greedy,6000,0,0.27366641525559876
+Greedy,6000,1,0.27366641525559876
+Greedy,6000,2,0.27366641525559876
+Greedy,6000,3,0.27366641525559876
+Greedy,6000,4,0.37267299218416317
+Greedy,6000,5,0.27366641525559876
+Greedy,6000,6,0.27366641525559876
+Greedy,6000,7,0.27366641525559876
+Greedy,6000,8,0.27366641525559876
+Greedy,6000,9,0.27366641525559876
+Greedy,6000,10,0.27366641525559876
+Greedy,6000,11,0.27366641525559876
+Greedy,6000,12,0.27366641525559876
+Greedy,6000,13,0.27366641525559876
+Greedy,6000,14,0.27366641525559876
+Greedy,6000,15,0.27366641525559876
+Greedy,6000,16,0.27366641525559876
+Greedy,6000,17,0.27366641525559876
+Greedy,6000,18,0.27366641525559876
+Greedy,6000,19,0.27366641525559876
+Greedy,6000,20,0.27366641525559876
+Greedy,6000,21,0.27366641525559876
+Greedy,6000,22,0.27366641525559876
+Greedy,6000,23,0.27366641525559876
+Greedy,6000,24,0.27366641525559876
+Greedy,6000,25,0.27366641525559876
+Greedy,6000,26,0.27366641525559876
+Greedy,6000,27,0.27366641525559876
+Greedy,6000,28,0.27366641525559876
+Greedy,6000,29,0.27366641525559876
+Greedy,9000,0,0.20687236484481342
+Greedy,9000,1,0.27366641525559876
+Greedy,9000,2,0.27366641525559876
+Greedy,9000,3,0.27366641525559876
+Greedy,9000,4,0.27366641525559876
+Greedy,9000,5,0.20687236484481342
+Greedy,9000,6,0.20687236484481342
+Greedy,9000,7,0.20687236484481342
+Greedy,9000,8,0.20687236484481342
+Greedy,9000,9,0.20687236484481342
+Greedy,9000,10,0.27366641525559876
+Greedy,9000,11,0.20687236484481342
+Greedy,9000,12,0.27366641525559876
+Greedy,9000,13,0.20687236484481342
+Greedy,9000,14,0.27366641525559876
+Greedy,9000,15,0.27366641525559876
+Greedy,9000,16,0.27366641525559876
+Greedy,9000,17,0.20687236484481342
+Greedy,9000,18,0.27366641525559876
+Greedy,9000,19,0.20687236484481342
+Greedy,9000,20,0.20687236484481342
+Greedy,9000,21,0.20687236484481342
+Greedy,9000,22,0.27366641525559876
+Greedy,9000,23,0.27366641525559876
+Greedy,9000,24,0.20687236484481342
+Greedy,9000,25,0.20687236484481342
+Greedy,9000,26,0.20687236484481342
+Greedy,9000,27,0.27366641525559876
+Greedy,9000,28,0.27366641525559876
+Greedy,9000,29,0.20687236484481342
+Greedy,12000,0,0.38204198687702706
+Greedy,12000,1,0.315513083874587
+Greedy,12000,2,0.3080403640785656
+Greedy,12000,3,0.3018982736555398
+Greedy,12000,4,0.3084790118536205
+Greedy,12000,5,0.20687236484481342
+Greedy,12000,6,0.27366641525559876
+Greedy,12000,7,0.302025178078035
+Greedy,12000,8,0.31827555736442403
+Greedy,12000,9,0.3038793943427103
+Greedy,12000,10,0.3136640241066311
+Greedy,12000,11,0.30948092523810367
+Greedy,12000,12,0.3077201806493213
+Greedy,12000,13,0.3472779591214208
+Greedy,12000,14,0.3822367988564699
+Greedy,12000,15,0.3590698975519264
+Greedy,12000,16,0.3134409815731516
+Greedy,12000,17,0.30881347903408707
+Greedy,12000,18,0.20687236484481342
+Greedy,12000,19,0.3090275835443683
+Greedy,12000,20,0.31573471604898984
+Greedy,12000,21,0.38167819510687573
+Greedy,12000,22,0.3808562840650509
+Greedy,12000,23,0.30794807480734665
+Greedy,12000,24,0.27366641525559876
+Greedy,12000,25,0.3870227560204951
+Greedy,12000,26,0.31347512848879844
+Greedy,12000,27,0.3083852282126054
+Greedy,12000,28,0.3870227560204951
+Greedy,12000,29,0.30968852291522975
+Greedy,15000,0,0.32471897682560424
+Greedy,15000,1,0.30332447673103036
+Greedy,15000,2,0.31998602646313024
+Greedy,15000,3,0.30950840137077806
+Greedy,15000,4,0.3102178671110267
+Greedy,15000,5,0.32265188974967596
+Greedy,15000,6,0.32019717557200456
+Greedy,15000,7,0.3122922240930024
+Greedy,15000,8,0.2783673425605997
+Greedy,15000,9,0.3178204546416248
+Greedy,15000,10,0.3050536682422891
+Greedy,15000,11,0.3255048888110519
+Greedy,15000,12,0.3132067133651055
+Greedy,15000,13,0.32184006182182645
+Greedy,15000,14,0.31607043272836033
+Greedy,15000,15,0.3174185926912929
+Greedy,15000,16,0.3106470045708809
+Greedy,15000,17,0.30911174259816865
+Greedy,15000,18,0.30699798789830357
+Greedy,15000,19,0.3063621889479904
+Greedy,15000,20,0.3068965201171874
+Greedy,15000,21,0.31724432840168393
+Greedy,15000,22,0.3221096787288211
+Greedy,15000,23,0.3200331208160905
+Greedy,15000,24,0.3119177205942725
+Greedy,15000,25,0.3214941160443803
+Greedy,15000,26,0.3115135341753803
+Greedy,15000,27,0.3076298016735426
+Greedy,15000,28,0.32220863445933934
+Greedy,15000,29,0.31537766061757067
+Greedy,18000,0,0.18244427683706577
+Greedy,18000,1,0.18244427683706577
+Greedy,18000,2,0.20687236484481342
+Greedy,18000,3,0.18244427683706577
+Greedy,18000,4,0.20687236484481342
+Greedy,18000,5,0.18244427683706577
+Greedy,18000,6,0.18244427683706577
+Greedy,18000,7,0.20687236484481342
+Greedy,18000,8,0.20687236484481342
+Greedy,18000,9,0.20687236484481342
+Greedy,18000,10,0.18244427683706577
+Greedy,18000,11,0.18244427683706577
+Greedy,18000,12,0.20687236484481342
+Greedy,18000,13,0.18244427683706577
+Greedy,18000,14,0.12394647880423704
+Greedy,18000,15,0.20687236484481342
+Greedy,18000,16,0.18244427683706577
+Greedy,18000,17,0.20687236484481342
+Greedy,18000,18,0.20687236484481342
+Greedy,18000,19,0.18244427683706577
+Greedy,18000,20,0.20687236484481342
+Greedy,18000,21,0.20687236484481342
+Greedy,18000,22,0.20687236484481342
+Greedy,18000,23,0.20687236484481342
+Greedy,18000,24,0.18244427683706577
+Greedy,18000,25,0.18244427683706577
+Greedy,18000,26,0.20687236484481342
+Greedy,18000,27,0.20687236484481342
+Greedy,18000,28,0.20687236484481342
+Greedy,18000,29,0.18244427683706577

BIN
add_linkselfie/outputs/plot_ciwidth_vs_budget_Depolar_mean.pickle


+ 361 - 0
add_linkselfie/outputs/plot_ciwidth_vs_budget_Depolar_mean_widths.csv

@@ -0,0 +1,361 @@
+scheduler,budget,trial_idx,width
+LNaive,3000,0,0.15485068457168077
+LNaive,3000,1,0.15502019412818455
+LNaive,3000,2,0.15487491278629187
+LNaive,3000,3,0.15497742389379213
+LNaive,3000,4,0.1550047941271319
+LNaive,3000,5,0.15541597663452278
+LNaive,3000,6,0.15506326790417826
+LNaive,3000,7,0.15528126214469415
+LNaive,3000,8,0.15493208008776987
+LNaive,3000,9,0.15500727956958532
+LNaive,3000,10,0.15507317106986107
+LNaive,3000,11,0.15494858871477893
+LNaive,3000,12,0.15498466248465992
+LNaive,3000,13,0.15513231257975962
+LNaive,3000,14,0.15469363579937295
+LNaive,3000,15,0.15510829800305226
+LNaive,3000,16,0.15528056035590082
+LNaive,3000,17,0.1550845558257326
+LNaive,3000,18,0.15505631520123628
+LNaive,3000,19,0.15504658748506103
+LNaive,3000,20,0.15461513428677348
+LNaive,3000,21,0.15470957673435168
+LNaive,3000,22,0.1548081565272979
+LNaive,3000,23,0.15508693544006627
+LNaive,3000,24,0.15517802848428788
+LNaive,3000,25,0.15540436028150126
+LNaive,3000,26,0.1554615888889591
+LNaive,3000,27,0.1549754480782745
+LNaive,3000,28,0.15456401977238893
+LNaive,3000,29,0.15515088958297296
+LNaive,6000,0,0.11509287734993452
+LNaive,6000,1,0.11524225798815114
+LNaive,6000,2,0.11534236836778525
+LNaive,6000,3,0.11524429010760089
+LNaive,6000,4,0.11515551522046343
+LNaive,6000,5,0.11513330662996361
+LNaive,6000,6,0.1152207664352098
+LNaive,6000,7,0.11524524113070406
+LNaive,6000,8,0.11509776080458939
+LNaive,6000,9,0.11520546291120078
+LNaive,6000,10,0.11530238339768976
+LNaive,6000,11,0.1151841249550993
+LNaive,6000,12,0.1151350728076638
+LNaive,6000,13,0.1151973298731296
+LNaive,6000,14,0.11524441581390563
+LNaive,6000,15,0.11521623472618979
+LNaive,6000,16,0.11527372252143156
+LNaive,6000,17,0.11512721115284102
+LNaive,6000,18,0.11527377126876358
+LNaive,6000,19,0.11523118529857096
+LNaive,6000,20,0.11534854284095335
+LNaive,6000,21,0.11530516250691598
+LNaive,6000,22,0.11520058487665688
+LNaive,6000,23,0.11511617535255292
+LNaive,6000,24,0.11523307333813643
+LNaive,6000,25,0.11526994632260038
+LNaive,6000,26,0.11515872638364094
+LNaive,6000,27,0.11542811182655294
+LNaive,6000,28,0.11521651678833225
+LNaive,6000,29,0.11529870847274076
+LNaive,9000,0,0.09458056953857129
+LNaive,9000,1,0.09441669520072822
+LNaive,9000,2,0.09448882782821395
+LNaive,9000,3,0.09453211188519892
+LNaive,9000,4,0.09445309323815829
+LNaive,9000,5,0.09455193203992289
+LNaive,9000,6,0.09450726990683413
+LNaive,9000,7,0.09446202182584094
+LNaive,9000,8,0.09451727136031221
+LNaive,9000,9,0.09451079247214826
+LNaive,9000,10,0.09448048494857884
+LNaive,9000,11,0.09442933793811953
+LNaive,9000,12,0.0944641364023581
+LNaive,9000,13,0.09452429938155044
+LNaive,9000,14,0.09458126442166291
+LNaive,9000,15,0.09447583786702654
+LNaive,9000,16,0.09447089603992079
+LNaive,9000,17,0.09445669253790999
+LNaive,9000,18,0.09442648138268481
+LNaive,9000,19,0.09447823500350579
+LNaive,9000,20,0.09452902836045057
+LNaive,9000,21,0.09453207905700017
+LNaive,9000,22,0.09444815548233639
+LNaive,9000,23,0.09448775014379386
+LNaive,9000,24,0.09455800674998184
+LNaive,9000,25,0.09450298010931543
+LNaive,9000,26,0.09435366625637244
+LNaive,9000,27,0.09435616281108024
+LNaive,9000,28,0.09450597466336115
+LNaive,9000,29,0.09458025102705635
+LNaive,12000,0,0.08328356834980749
+LNaive,12000,1,0.08314382507289414
+LNaive,12000,2,0.08318780441569405
+LNaive,12000,3,0.08327802612058147
+LNaive,12000,4,0.08329288229099795
+LNaive,12000,5,0.08324305033040007
+LNaive,12000,6,0.08317854528845307
+LNaive,12000,7,0.08322413313534179
+LNaive,12000,8,0.08322242056793867
+LNaive,12000,9,0.08314287635192015
+LNaive,12000,10,0.08328545286185525
+LNaive,12000,11,0.08321641170070697
+LNaive,12000,12,0.08318251714769218
+LNaive,12000,13,0.08314742528799722
+LNaive,12000,14,0.08322466555101823
+LNaive,12000,15,0.08328803468428995
+LNaive,12000,16,0.08319493232850655
+LNaive,12000,17,0.08323458641574306
+LNaive,12000,18,0.0832251603368434
+LNaive,12000,19,0.08314485309555014
+LNaive,12000,20,0.08324391827258117
+LNaive,12000,21,0.08325845796605487
+LNaive,12000,22,0.08318965068291967
+LNaive,12000,23,0.08324711749346954
+LNaive,12000,24,0.08322263640529161
+LNaive,12000,25,0.08322942316832295
+LNaive,12000,26,0.0832487275422831
+LNaive,12000,27,0.08319529426219617
+LNaive,12000,28,0.08312064969270049
+LNaive,12000,29,0.08321461862403154
+LNaive,15000,0,0.07452309492984957
+LNaive,15000,1,0.07450794354605145
+LNaive,15000,2,0.07451217892752515
+LNaive,15000,3,0.07445688008537829
+LNaive,15000,4,0.07447772983160218
+LNaive,15000,5,0.07445381709482107
+LNaive,15000,6,0.0745177035954168
+LNaive,15000,7,0.07446512157605983
+LNaive,15000,8,0.07442060745470468
+LNaive,15000,9,0.07450498202212642
+LNaive,15000,10,0.07445292735570595
+LNaive,15000,11,0.07452004853325404
+LNaive,15000,12,0.07448784462690171
+LNaive,15000,13,0.07449762450339685
+LNaive,15000,14,0.07447725824868508
+LNaive,15000,15,0.074521934995716
+LNaive,15000,16,0.07454934362473921
+LNaive,15000,17,0.07452601473380868
+LNaive,15000,18,0.07444368516904357
+LNaive,15000,19,0.07446847442989539
+LNaive,15000,20,0.0745275000625166
+LNaive,15000,21,0.074441274420766
+LNaive,15000,22,0.0745201586634468
+LNaive,15000,23,0.07446458288587235
+LNaive,15000,24,0.07447629295219331
+LNaive,15000,25,0.07449769236614961
+LNaive,15000,26,0.07453598254903641
+LNaive,15000,27,0.07453558757404527
+LNaive,15000,28,0.07444052799470205
+LNaive,15000,29,0.07446618326576403
+LNaive,18000,0,0.0686309567918666
+LNaive,18000,1,0.06869134551446304
+LNaive,18000,2,0.06869514689274236
+LNaive,18000,3,0.06867298617462873
+LNaive,18000,4,0.06868738695101602
+LNaive,18000,5,0.06866737906145826
+LNaive,18000,6,0.06869349623594655
+LNaive,18000,7,0.06865980306132
+LNaive,18000,8,0.06870701116394246
+LNaive,18000,9,0.06868668457337218
+LNaive,18000,10,0.06865420980827514
+LNaive,18000,11,0.06870407562529098
+LNaive,18000,12,0.06868913909640394
+LNaive,18000,13,0.06866842898642656
+LNaive,18000,14,0.0686724618643888
+LNaive,18000,15,0.06867166584896918
+LNaive,18000,16,0.06868421998037583
+LNaive,18000,17,0.06871452906081102
+LNaive,18000,18,0.06868896041117385
+LNaive,18000,19,0.0686673678167125
+LNaive,18000,20,0.06869795018596755
+LNaive,18000,21,0.0686719000855651
+LNaive,18000,22,0.06865684165916344
+LNaive,18000,23,0.06866265665776439
+LNaive,18000,24,0.068663076031885
+LNaive,18000,25,0.06866857337206204
+LNaive,18000,26,0.06869043278752963
+LNaive,18000,27,0.06867723186819541
+LNaive,18000,28,0.06867162904842265
+LNaive,18000,29,0.06872055452616331
+Greedy,3000,0,0.19067726530880932
+Greedy,3000,1,0.18870294172595503
+Greedy,3000,2,0.19058580752782378
+Greedy,3000,3,0.19039476674982148
+Greedy,3000,4,0.19123747144051464
+Greedy,3000,5,0.19116505352545912
+Greedy,3000,6,0.19260612990777956
+Greedy,3000,7,0.19088835920323882
+Greedy,3000,8,0.1916479546138514
+Greedy,3000,9,0.19050637758804434
+Greedy,3000,10,0.1909889563102278
+Greedy,3000,11,0.19109779431552135
+Greedy,3000,12,0.1918413832203051
+Greedy,3000,13,0.1901077079099537
+Greedy,3000,14,0.18982676544709978
+Greedy,3000,15,0.18991083548310955
+Greedy,3000,16,0.19213284373449563
+Greedy,3000,17,0.1917736752509453
+Greedy,3000,18,0.19057727288443865
+Greedy,3000,19,0.19237001463603853
+Greedy,3000,20,0.14148792020122428
+Greedy,3000,21,0.19222473894251055
+Greedy,3000,22,0.19116567170110266
+Greedy,3000,23,0.191337653699954
+Greedy,3000,24,0.19173528910993892
+Greedy,3000,25,0.1923986349443716
+Greedy,3000,26,0.19274208968196985
+Greedy,3000,27,0.19186351694644277
+Greedy,3000,28,0.18993647758475743
+Greedy,3000,29,0.1913564231164088
+Greedy,6000,0,0.14657783480744505
+Greedy,6000,1,0.14669854795607942
+Greedy,6000,2,0.14662940421693296
+Greedy,6000,3,0.1465709338233267
+Greedy,6000,4,0.16172586981404108
+Greedy,6000,5,0.1466302480656654
+Greedy,6000,6,0.14657792544379433
+Greedy,6000,7,0.1465109562665693
+Greedy,6000,8,0.1464784255958976
+Greedy,6000,9,0.14655721094911384
+Greedy,6000,10,0.14612740741229863
+Greedy,6000,11,0.1464239656449017
+Greedy,6000,12,0.14649070112431353
+Greedy,6000,13,0.14677758774672128
+Greedy,6000,14,0.14608023974165973
+Greedy,6000,15,0.1465986427481613
+Greedy,6000,16,0.14656533398416444
+Greedy,6000,17,0.1464008312024358
+Greedy,6000,18,0.14654300594372452
+Greedy,6000,19,0.14669927137355626
+Greedy,6000,20,0.14642310423464225
+Greedy,6000,21,0.14637573037372317
+Greedy,6000,22,0.14677829078271898
+Greedy,6000,23,0.14624495926128833
+Greedy,6000,24,0.14651491056528743
+Greedy,6000,25,0.14675568044186538
+Greedy,6000,26,0.14659783029137347
+Greedy,6000,27,0.14648513656152204
+Greedy,6000,28,0.14659026950331142
+Greedy,6000,29,0.14654791435966094
+Greedy,9000,0,0.1315552782865432
+Greedy,9000,1,0.14368450394347168
+Greedy,9000,2,0.14382038790110224
+Greedy,9000,3,0.14384162485001348
+Greedy,9000,4,0.14374478265142449
+Greedy,9000,5,0.14117850993600164
+Greedy,9000,6,0.139880363487722
+Greedy,9000,7,0.14121271976517444
+Greedy,9000,8,0.13971436671788054
+Greedy,9000,9,0.13740406189893256
+Greedy,9000,10,0.14369786238325727
+Greedy,9000,11,0.1410938749412158
+Greedy,9000,12,0.1436474301431309
+Greedy,9000,13,0.13969064407605777
+Greedy,9000,14,0.14505060727008512
+Greedy,9000,15,0.14370226552909765
+Greedy,9000,16,0.14550451443225204
+Greedy,9000,17,0.14122400242917704
+Greedy,9000,18,0.14363975926176442
+Greedy,9000,19,0.13155672228209464
+Greedy,9000,20,0.13944951007735126
+Greedy,9000,21,0.13977856404615915
+Greedy,9000,22,0.1493412431501384
+Greedy,9000,23,0.14402587687524152
+Greedy,9000,24,0.13937094863868868
+Greedy,9000,25,0.13160999019514366
+Greedy,9000,26,0.14101620093343145
+Greedy,9000,27,0.14390301573205097
+Greedy,9000,28,0.14343983718406683
+Greedy,9000,29,0.14088589849879585
+Greedy,12000,0,0.167503099611028
+Greedy,12000,1,0.12479420346339219
+Greedy,12000,2,0.12411486527901715
+Greedy,12000,3,0.12355649348157342
+Greedy,12000,4,0.12415474236142302
+Greedy,12000,5,0.13005785181842336
+Greedy,12000,6,0.15057594238021163
+Greedy,12000,7,0.12356803020781006
+Greedy,12000,8,0.1250453373808907
+Greedy,12000,9,0.12373659530164273
+Greedy,12000,10,0.12462610711016052
+Greedy,12000,11,0.12424582538633179
+Greedy,12000,12,0.12408575769548046
+Greedy,12000,13,0.1651044081542615
+Greedy,12000,14,0.16717525052398757
+Greedy,12000,15,0.1656169602338579
+Greedy,12000,16,0.12460583053610125
+Greedy,12000,17,0.12418514848213379
+Greedy,12000,18,0.1300159153646925
+Greedy,12000,19,0.12420461255115972
+Greedy,12000,20,0.12481435182441566
+Greedy,12000,21,0.16773044747485036
+Greedy,12000,22,0.16698969592968194
+Greedy,12000,23,0.12410647534375557
+Greedy,12000,24,0.1501646145474665
+Greedy,12000,25,0.16770731739285374
+Greedy,12000,26,0.12460893478600271
+Greedy,12000,27,0.12414621657111378
+Greedy,12000,28,0.16807792124509985
+Greedy,12000,29,0.12426469792651354
+Greedy,15000,0,0.16883128381117013
+Greedy,15000,1,0.15723303097230726
+Greedy,15000,2,0.15839145159254472
+Greedy,15000,3,0.15704839825887643
+Greedy,15000,4,0.15739661961957077
+Greedy,15000,5,0.1589227743609069
+Greedy,15000,6,0.15827920096219655
+Greedy,15000,7,0.15756205734552386
+Greedy,15000,8,0.14628994084882072
+Greedy,15000,9,0.15738562376889803
+Greedy,15000,10,0.1565992942761182
+Greedy,15000,11,0.1580962414589838
+Greedy,15000,12,0.15759658744697105
+Greedy,15000,13,0.15744365447019343
+Greedy,15000,14,0.15835904338891613
+Greedy,15000,15,0.15695885278520758
+Greedy,15000,16,0.157292671608181
+Greedy,15000,17,0.15775613823565937
+Greedy,15000,18,0.15750371866224924
+Greedy,15000,19,0.15680089648467246
+Greedy,15000,20,0.15698542805068857
+Greedy,15000,21,0.15717650639884592
+Greedy,15000,22,0.1581195529321024
+Greedy,15000,23,0.15747354989387854
+Greedy,15000,24,0.15733235463930825
+Greedy,15000,25,0.15794488935740622
+Greedy,15000,26,0.15644603588405928
+Greedy,15000,27,0.15709097977189676
+Greedy,15000,28,0.16815724264798593
+Greedy,15000,29,0.1574031096278783
+Greedy,18000,0,0.11237448050703322
+Greedy,18000,1,0.11254544456667756
+Greedy,18000,2,0.11841912722342356
+Greedy,18000,3,0.11265887736229506
+Greedy,18000,4,0.11847807793394984
+Greedy,18000,5,0.11242159016029175
+Greedy,18000,6,0.112481176705376
+Greedy,18000,7,0.1138799456790494
+Greedy,18000,8,0.11823845757030878
+Greedy,18000,9,0.11838452405302262
+Greedy,18000,10,0.11243293669883231
+Greedy,18000,11,0.11245307406698982
+Greedy,18000,12,0.11849046873443839
+Greedy,18000,13,0.11242720268576259
+Greedy,18000,14,0.10794981600876609
+Greedy,18000,15,0.11842607548321388
+Greedy,18000,16,0.11242564812002524
+Greedy,18000,17,0.11844510473356981
+Greedy,18000,18,0.11833032934573078
+Greedy,18000,19,0.11241783958052014
+Greedy,18000,20,0.11837910619934776
+Greedy,18000,21,0.11845854311189874
+Greedy,18000,22,0.11845543605475022
+Greedy,18000,23,0.11840925840681066
+Greedy,18000,24,0.11246183383289732
+Greedy,18000,25,0.11251443570517798
+Greedy,18000,26,0.11860626333930227
+Greedy,18000,27,0.11849914768799248
+Greedy,18000,28,0.11822199692096488
+Greedy,18000,29,0.11242687957351091

BIN
add_linkselfie/outputs/plot_minwidthsum_perpair_vs_budget_Depolar.pickle


BIN
add_linkselfie/outputs/plot_minwidthsum_perpair_weighted_vs_budget_Depolar.pickle


BIN
add_linkselfie/outputs/plot_widthsum_alllinks_vs_budget_Depolar.pickle


BIN
add_linkselfie/outputs/plot_widthsum_alllinks_weighted_vs_budget_Depolar.pickle


BIN
add_linkselfie/plot_accuracy_vs_budget_Depolar.pdf


BIN
add_linkselfie/plot_ciwidth_best_vs_budget_Depolar_max_bestby-mean.pdf


BIN
add_linkselfie/plot_ciwidth_best_vs_budget_Depolar_max_bestby-mean_gap.pdf


BIN
add_linkselfie/plot_ciwidth_best_vs_budget_Depolar_mean_bestby-mean.pdf


BIN
add_linkselfie/plot_ciwidth_best_vs_budget_Depolar_mean_bestby-mean_gap.pdf


BIN
add_linkselfie/plot_ciwidth_vs_budget_Depolar_max.pdf


BIN
add_linkselfie/plot_ciwidth_vs_budget_Depolar_mean.pdf


BIN
add_linkselfie/plot_minwidthsum_perpair_vs_budget_Depolar.pdf


BIN
add_linkselfie/plot_minwidthsum_perpair_weighted_vs_budget_Depolar.pdf


BIN
add_linkselfie/plot_value_vs_budget_Depolar.pdf


BIN
add_linkselfie/plot_value_vs_budget_target_Depolar.pdf


BIN
add_linkselfie/plot_value_vs_used_Depolar.pdf


BIN
add_linkselfie/plot_weighted_errorrate_vs_budget_Depolar.pdf


BIN
add_linkselfie/plot_widthsum_alllinks_vs_budget_Depolar.pdf


BIN
add_linkselfie/plot_widthsum_alllinks_weighted_vs_budget_Depolar.pdf


+ 26 - 0
add_linkselfie/schedulers/__init__.py

@@ -0,0 +1,26 @@
+from .lnaive_scheduler import lnaive_budget_scheduler
+from .greedy_scheduler import greedy_budget_scheduler
+
+
+
+
+def run_scheduler(
+    node_path_list,
+    importance_list,
+    scheduler_name,
+    bounces,
+    C_total,
+    network_generator,
+    return_details=False,  
+):
+    if scheduler_name == "LNaive":
+        return lnaive_budget_scheduler(
+            node_path_list, importance_list, bounces, C_total, network_generator,
+            return_details=return_details,   
+        )
+    elif scheduler_name == "Greedy":
+        return greedy_budget_scheduler(
+            node_path_list, importance_list, bounces, C_total, network_generator,
+            return_details=return_details,   
+        )
+    raise ValueError(f"Unknown scheduler name: {scheduler_name}")

+ 37 - 0
add_linkselfie/schedulers/__init__.py~

@@ -0,0 +1,37 @@
+# schedulers/__init__.py
+
+from .scheduler_naive import naive_budget_scheduler  # noqa: F401
+
+__all__ = [
+    "naive_budget_scheduler",
+    "run_scheduler",
+]
+
+
+def run_scheduler(
+    node_path_list,
+    importance_list,
+    scheduler_name,
+    bounces,
+    C_total,
+    network_generator,
+):
+    """
+    スケジューラ名で分岐して実行するディスパッチ関数。
+    戻り値は (per_pair_results, total_cost) を期待(各スケジューラ共通化)。
+    """
+    if scheduler_name == "NaiveBudget":
+        return naive_budget_scheduler(
+            node_path_list=node_path_list,
+            importance_list=importance_list,
+            bounces=bounces,
+            C_total=C_total,
+            network_generator=network_generator,
+        )
+
+    # 将来追加例:
+    # elif scheduler_name == "WeightedBudget":
+    #     from .scheduler_weighted import weighted_budget_scheduler
+    #     return weighted_budget_scheduler(...)
+
+    raise ValueError(f"Unknown scheduler name: {scheduler_name}")

BIN
add_linkselfie/schedulers/__pycache__/__init__.cpython-38.pyc


BIN
add_linkselfie/schedulers/__pycache__/greedy_scheduler.cpython-38.pyc


BIN
add_linkselfie/schedulers/__pycache__/lnaive_nb.cpython-38.pyc


BIN
add_linkselfie/schedulers/__pycache__/lnaive_scheduler.cpython-38.pyc


BIN
add_linkselfie/schedulers/__pycache__/lonline_nb.cpython-38.pyc


BIN
add_linkselfie/schedulers/__pycache__/pac_greedy_scheduler.cpython-38.pyc


BIN
add_linkselfie/schedulers/__pycache__/pac_naive_scheduler.cpython-38.pyc


BIN
add_linkselfie/schedulers/__pycache__/pac_wrapper.cpython-38.pyc


+ 95 - 0
add_linkselfie/schedulers/greedy_scheduler.py

@@ -0,0 +1,95 @@
+# schedulers/greedy_scheduler.py
+from .lonline_nb import lonline_network_benchmarking
+def greedy_budget_scheduler(
+    node_path_list,      # 例: [2, 2, 2] … 各ペアのパス本数
+    importance_list,     # 例: [0.3, 0.5, 0.7] … 長さは node_path_list と同じ
+    bounces,             # 例: [1,2,3,4](重複なし)
+    C_total,             # 総予算
+    network_generator,   # callable: (path_num, pair_idx) -> network
+    C_initial_per_pair=40,  # 各ペアの初期プローブ予算
+    return_details=False,
+):
+    num_pairs = len(node_path_list)
+    assert num_pairs == len(importance_list), "length mismatch: node_path_list vs importance_list"
+    if num_pairs == 0:
+        return ([], 0, []) if return_details else ([], 0)
+
+    assert len(bounces) == len(set(bounces)), "bounces must be unique"
+    assert all(isinstance(w, int) and w > 0 for w in bounces), "bounces must be positive ints"
+
+    # --- Step 1: 各ペアを軽くプローブ(初期推定) ---
+    initial_est_fids = [0.0] * num_pairs
+    initial_costs    = [0]   * num_pairs
+    per_pair_results = [(False, 0, None)] * num_pairs
+    per_pair_details = [{"alloc_by_path": {}, "est_fid_by_path": {}} for _ in range(num_pairs)]
+    consumed_total   = 0
+
+    for pair_idx, path_num in enumerate(node_path_list):
+        if consumed_total >= C_total or path_num <= 0:
+            continue
+        C_probe = min(int(C_initial_per_pair), max(int(C_total) - int(consumed_total), 0))
+        if C_probe <= 0:
+            break
+
+        network = network_generator(path_num, pair_idx)
+        path_list = list(range(1, path_num + 1))
+
+        if return_details:
+            correctness, cost, best_path_fid, alloc0, est0 = lonline_network_benchmarking(
+                network, path_list, list(bounces), int(C_probe), return_details=True
+            )
+            # 詳細をマージ(配分は加算・推定は後勝ち)
+            for l, b in alloc0.items():
+                per_pair_details[pair_idx]["alloc_by_path"][int(l)] = \
+                    per_pair_details[pair_idx]["alloc_by_path"].get(int(l), 0) + int(b)
+            per_pair_details[pair_idx]["est_fid_by_path"].update({int(k): float(v) for k, v in est0.items()})
+        else:
+            correctness, cost, best_path_fid = lonline_network_benchmarking(
+                network, path_list, list(bounces), int(C_probe)
+            )
+
+        consumed_total += int(cost)
+        initial_costs[pair_idx]    = int(cost)
+        initial_est_fids[pair_idx] = float(best_path_fid) if best_path_fid is not None else 0.0
+        per_pair_results[pair_idx] = (bool(correctness), int(cost), best_path_fid)
+
+    remaining = max(int(C_total) - int(consumed_total), 0)
+
+    # --- Step 2: importance * estimated_fidelity で優先度付け ---
+    scores = [(idx, importance_list[idx] * initial_est_fids[idx]) for idx in range(num_pairs)]
+    scores.sort(key=lambda x: x[1], reverse=True)
+
+    # --- Step 3: 残余予算を Greedy に配分(上位にまとめて) ---
+    for pair_idx, _score in scores:
+        if remaining <= 0:
+            break
+        path_num = node_path_list[pair_idx]
+        if path_num <= 0:
+            continue
+
+        network = network_generator(path_num, pair_idx)
+        path_list = list(range(1, path_num + 1))
+
+        if return_details:
+            correctness, cost, best_path_fid, alloc1, est1 = lonline_network_benchmarking(
+                network, path_list, list(bounces), int(remaining), return_details=True
+            )
+            for l, b in alloc1.items():
+                per_pair_details[pair_idx]["alloc_by_path"][int(l)] = \
+                    per_pair_details[pair_idx]["alloc_by_path"].get(int(l), 0) + int(b)
+            per_pair_details[pair_idx]["est_fid_by_path"].update({int(k): float(v) for k, v in est1.items()})
+        else:
+            correctness, cost, best_path_fid = lonline_network_benchmarking(
+                network, path_list, list(bounces), int(remaining)
+            )
+
+        per_pair_results[pair_idx] = (
+            bool(correctness),
+            int(initial_costs[pair_idx] + int(cost)),
+            best_path_fid,
+        )
+        remaining      -= int(cost)
+        consumed_total += int(cost)
+
+    return (per_pair_results, int(consumed_total), per_pair_details) if return_details \
+           else (per_pair_results, int(consumed_total))

+ 91 - 0
add_linkselfie/schedulers/greedy_scheduler.py~

@@ -0,0 +1,91 @@
+# schedulers/greedy_scheduler.py
+from .lonline_nb import lonline_network_benchmarking
+
+def greedy_budget_scheduler(
+    node_path_list,      # 例: [2, 2, 2] … 各ペアのパス本数
+    importance_list,     # 例: [0.3, 0.5, 0.7] … 長さは node_path_list と同じ
+    bounces,             # 例: [1,2,3,4](重複なし)
+    C_total,             # 総予算
+    network_generator,   # callable: (path_num, pair_idx) -> network
+    C_initial_per_pair=40,  # 各ペアの初期プローブ予算
+):
+    """
+    Greedy スケジューラ(最小構成)
+
+    手順:
+      1) 各ペアに小さな初期予算 C_initial_per_pair を配って lonline を一度だけ実行し、
+         おおまかなベスト経路忠実度を得る。
+      2) importance * estimated_fidelity のスコアでペアを降順ソート。
+      3) 残余予算をスコア上位のペアにまとめて与え、lonline をもう一度実行。
+         予算が尽きるまで繰り返す(この実装では「まとめて全部」与える)。
+
+    返り値:
+      per_pair_results: List[ (correct: bool, cost: int, best_path_fidelity: float|None) ] (ペア順)
+      total_cost: int
+    """
+    num_pairs = len(node_path_list)
+    assert num_pairs == len(importance_list), "length mismatch: node_path_list vs importance_list"
+    if num_pairs == 0:
+        return [], 0
+
+    # bounces は重複なし・正の整数を仮定
+    assert len(bounces) == len(set(bounces)), "bounces must be unique"
+    assert all(isinstance(w, int) and w > 0 for w in bounces), "bounces must be positive ints"
+
+    # --- Step 1: 各ペアを軽くプローブ(初期推定) ---
+    initial_est_fids = [0.0] * num_pairs
+    initial_costs    = [0]   * num_pairs
+    per_pair_results = [(False, 0, None)] * num_pairs  # プレースホルダ
+    consumed_total   = 0
+
+    for pair_idx, path_num in enumerate(node_path_list):
+        if consumed_total >= C_total or path_num <= 0:
+            continue
+        C_probe = min(int(C_initial_per_pair), max(int(C_total) - int(consumed_total), 0))
+        if C_probe <= 0:
+            break
+
+        network = network_generator(path_num, pair_idx)
+        path_list = list(range(1, path_num + 1))
+
+        correctness, cost, best_path_fid = lonline_network_benchmarking(
+            network, path_list, list(bounces), int(C_probe)
+        )
+
+        consumed_total += int(cost)
+        initial_costs[pair_idx] = int(cost)
+        initial_est_fids[pair_idx] = float(best_path_fid) if best_path_fid is not None else 0.0
+        per_pair_results[pair_idx] = (bool(correctness), int(cost), best_path_fid)
+
+    remaining = max(int(C_total) - int(consumed_total), 0)
+
+    # --- Step 2: importance * estimated_fidelity で優先度付け ---
+    scores = [(idx, importance_list[idx] * initial_est_fids[idx]) for idx in range(num_pairs)]
+    scores.sort(key=lambda x: x[1], reverse=True)
+
+    # --- Step 3: 残余予算を Greedy に配分(上位にまとめて) ---
+    for pair_idx, _score in scores:
+        if remaining <= 0:
+            break
+
+        path_num = node_path_list[pair_idx]
+        if path_num <= 0:
+            continue
+
+        network = network_generator(path_num, pair_idx)
+        path_list = list(range(1, path_num + 1))
+
+        # 残りを丸ごと与える(シンプル設計)
+        correctness, cost, best_path_fid = lonline_network_benchmarking(
+            network, path_list, list(bounces), int(remaining)
+        )
+
+        per_pair_results[pair_idx] = (
+            bool(correctness),
+            int(initial_costs[pair_idx] + int(cost)),
+            best_path_fid,
+        )
+        remaining      -= int(cost)
+        consumed_total += int(cost)
+
+    return per_pair_results, int(consumed_total)

+ 65 - 0
add_linkselfie/schedulers/lnaive_nb.py

@@ -0,0 +1,65 @@
+# lnaive_nb.py
+
+def naive_network_benchmarking_with_budget(network, path_list, bounces, C_budget, return_details=False):
+    """
+    均等配分(L-Naive)版 NB。
+
+    既存の戻り値:
+      correctness: bool
+      cost: int
+      best_path_fidelity: float | None
+
+    return_details=True のとき追加で返す:
+      alloc_by_path:   dict[int,int]    {path_id: バウンス総数}
+      est_fid_by_path: dict[int,float]  {path_id: 推定忠実度}
+
+    想定:
+      - network.benchmark_path(path, bounces, sample_times) -> (p, used_cost)
+      - 忠実度変換は既存と同じ: fidelity = p + (1 - p)/2
+    """
+    fidelity = {}
+    cost = 0
+    n_paths = len(path_list)
+    if n_paths == 0:
+        if return_details:
+            return False, 0, None, {}, {}
+        return False, 0, None
+
+    per_sample_cost = sum(bounces) or 1
+    per_path_budget = int(C_budget) // n_paths
+    Ns = per_path_budget // per_sample_cost  # 各パスのサンプル数
+    if Ns <= 0:
+        if return_details:
+            return False, 0, None, {}, {}
+        return False, 0, None
+
+    # 各 hop に同じ Ns を配る(既存 naive と同じ割当表)
+    sample_times = {h: int(Ns) for h in bounces}
+
+    # 追加: 詳細記録用
+    alloc_by_path = {int(p): 0 for p in path_list}
+    est_fid_by_path = {}
+
+    # 各パスを均等回数でベンチマーク
+    for path in path_list:
+        p, used = network.benchmark_path(path, bounces, sample_times)
+        f = p + (1 - p) / 2.0  # 忠実度変換(既存式)
+        fidelity[path] = f
+        cost += int(used)
+
+        # 追加: 詳細記録
+        alloc_by_path[int(path)] = alloc_by_path.get(int(path), 0) + int(used)
+        est_fid_by_path[int(path)] = float(f)
+
+    if not fidelity:
+        if return_details:
+            return False, int(cost), None, alloc_by_path, est_fid_by_path
+        return False, int(cost), None
+
+    best_path = max(fidelity, key=fidelity.get)
+    correctness = (best_path == getattr(network, "best_path", None))
+    best_path_fidelity = fidelity[best_path]
+
+    if return_details:
+        return bool(correctness), int(cost), best_path_fidelity, alloc_by_path, est_fid_by_path
+    return bool(correctness), int(cost), best_path_fidelity

+ 55 - 0
add_linkselfie/schedulers/lnaive_scheduler.py

@@ -0,0 +1,55 @@
+# schedulers/lnaive_scheduler.py
+from .lnaive_nb import naive_network_benchmarking_with_budget
+
+def lnaive_budget_scheduler(
+    node_path_list,      # 例: [2, 2, 2] … 各ペアのパス本数
+    importance_list,     # 例: [0.3, 0.5, 0.7] … 長さは node_path_list と同じ(ここでは未使用)
+    bounces,             # 例: [1,2,3,4](重複なし)
+    C_total,             # 総予算(切り捨て配分、超過しない)
+    network_generator,   # callable: (path_num, pair_idx) -> network
+    return_details=False,
+):
+    num_pairs = len(node_path_list)
+    assert num_pairs == len(importance_list), "length mismatch: node_path_list vs importance_list"
+    if num_pairs == 0:
+        return ([], 0, []) if return_details else ([], 0)
+
+    assert len(bounces) == len(set(bounces)), "bounces must be unique"
+    assert all(isinstance(w, int) and w > 0 for w in bounces), "bounces must be positive ints"
+
+    # 均等配分:1ペアあたりの割当
+    C_per_pair = int(C_total // max(num_pairs, 1))
+
+    per_pair_results = []
+    per_pair_details = []
+    total_cost = 0
+
+    for pair_idx, path_num in enumerate(node_path_list):
+        if path_num <= 0:
+            per_pair_results.append((False, 0, None))
+            if return_details:
+                per_pair_details.append({"alloc_by_path": {}, "est_fid_by_path": {}})
+            continue
+
+        network = network_generator(path_num, pair_idx)
+        path_list = list(range(1, path_num + 1))
+
+        if return_details:
+            correctness, cost, best_path_fidelity, alloc_by_path, est_fid_by_path = \
+                naive_network_benchmarking_with_budget(
+                    network, path_list, list(bounces), C_per_pair, return_details=True
+                )
+            per_pair_details.append({
+                "alloc_by_path": {int(k): int(v) for k, v in alloc_by_path.items()},
+                "est_fid_by_path": {int(k): float(v) for k, v in est_fid_by_path.items()},
+            })
+        else:
+            correctness, cost, best_path_fidelity = naive_network_benchmarking_with_budget(
+                network, path_list, list(bounces), C_per_pair
+            )
+
+        per_pair_results.append((bool(correctness), int(cost), best_path_fidelity))
+        total_cost += int(cost)
+
+    return (per_pair_results, total_cost, per_pair_details) if return_details \
+           else (per_pair_results, total_cost)

+ 37 - 0
add_linkselfie/schedulers/lnaive_scheduler.py~

@@ -0,0 +1,37 @@
+# schedulers/lnaive_scheduler.py
+from lnaive_nb import naive_network_benchmarking_with_budget  # 既存実装を利用
+
+def lnaive_budget_scheduler(
+    node_path_list,      # 例: [2, 2, 2] … 各ペアのパス本数
+    importance_list,     # 例: [0.3, 0.5, 0.7] … 長さは node_path_list と同じ(ここでは未使用)
+    bounces,             # 例: [1,2,3,4](重複なし)
+    C_total,             # 総予算(切り捨て配分、超過しない)
+    network_generator,   # callable: (path_num, pair_idx) -> network
+):
+    num_pairs = len(node_path_list)
+    assert num_pairs == len(importance_list), "length mismatch: node_path_list vs importance_list"
+    if num_pairs == 0:
+        return [], 0
+
+    # bounces は重複なし・正の整数を仮定
+    assert len(bounces) == len(set(bounces)), "bounces must be unique"
+    assert all(isinstance(w, int) and w > 0 for w in bounces), "bounces must be positive ints"
+
+    C_per_pair = int(C_total) // num_pairs  # 等分(余りは未使用)
+    per_pair_results, total_cost = [], 0
+
+    for pair_idx, path_num in enumerate(node_path_list):
+        if path_num <= 0:
+            per_pair_results.append((False, 0, None))
+            continue
+
+        network = network_generator(path_num, pair_idx)
+        path_list = list(range(1, path_num + 1))
+
+        correctness, cost, best_path_fidelity = naive_network_benchmarking_with_budget(
+            network, path_list, list(bounces), C_per_pair
+        )
+        per_pair_results.append((bool(correctness), int(cost), best_path_fidelity))
+        total_cost += int(cost)
+
+    return per_pair_results, total_cost

+ 113 - 0
add_linkselfie/schedulers/lonline_nb.py

@@ -0,0 +1,113 @@
+# lonline_nb.py
+import math
+
+def lonline_network_benchmarking(network, path_list, bounces, C_budget, return_details=False):
+    """
+    L-Online 風の逐次削除型 NB。
+
+    返り値(常に一貫):
+      return_details=False:
+        (correctness: bool, cost: int, best_path_fidelity: float|None)
+      return_details=True:
+        (correctness: bool, cost: int, best_path_fidelity: float|None,
+         alloc_by_path: dict[int,int], est_fid_by_path: dict[int,float])
+
+    想定 I/F:
+      network.benchmark_path(path, bounces, sample_times) -> (p, used_cost)
+      忠実度変換: fidelity = p + (1 - p)/2
+    """
+    candidate_set = list(path_list)
+    # 既存コード由来のパラメータ(必要に応じて合わせてください)
+    s = 0
+    C = 0.01
+    delta = 0.1
+
+    # 集計器
+    cost = 0
+    estimated_fidelities = {}
+
+    # 詳細返却用の器(return_details に関わらず初期化:どの分岐でも形を揃える)
+    alloc_by_path = {int(p): 0 for p in path_list}
+    est_fid_by_path = {}
+
+    if not candidate_set or C_budget <= 0:
+        # 何も測れないケースでも形は揃えて返す
+        if return_details:
+            return False, int(cost), None, alloc_by_path, est_fid_by_path
+        return False, int(cost), None
+
+    # 1 経路を 1 サンプル測るコストの近似(ここでは hop 重みの和)
+    cost_per_sample_unit = sum(bounces) if sum(bounces) > 0 else 1
+
+    # ---- メインループ ----
+    while cost < C_budget and len(candidate_set) > 1:
+        s += 1
+        # ラウンド s のサンプル回数(既存式)
+        Ns = math.ceil(C * (2 ** (2 * s)) * math.log2(max((2 ** s) * len(candidate_set) / delta, 2)))
+        if Ns < 4:
+            Ns = 4
+
+        # このラウンドで 1 経路に必要なコスト目安
+        cost_needed_for_one_path = Ns * cost_per_sample_unit
+
+        # 2 ラウンド目以降で 1 経路すら回せないなら終了
+        if cost + cost_needed_for_one_path > C_budget and s > 1:
+            break
+
+        # hop ごとに同じ Ns を配る(network 側の想定 I/F に合わせる)
+        sample_times = {h: int(Ns) for h in bounces}
+
+        # ラウンド内の観測
+        p_s = {}
+        measured_paths = []
+
+        for path in list(candidate_set):
+            if cost + cost_needed_for_one_path > C_budget:
+                continue  # 予算が入らない経路はこのラウンドでは測らない
+
+            # 実測
+            p, used = network.benchmark_path(path, bounces, sample_times)
+            cost += int(used)
+
+            # 忠実度推定を更新(既存式)
+            fidelity = p + (1 - p) / 2.0
+            estimated_fidelities[path] = fidelity
+            p_s[path] = p
+            measured_paths.append(path)
+
+            # 詳細集計
+            alloc_by_path[int(path)] = alloc_by_path.get(int(path), 0) + int(used)
+            est_fid_by_path[int(path)] = float(fidelity)
+
+        # このラウンドで 1 本も測れなかったら終了
+        if not p_s:
+            break
+
+        # 連続削除(幅 2^{-s})
+        p_max = max(p_s.values())
+        new_candidate_set = []
+        for path in measured_paths:
+            if p_s[path] + 2 ** (-s) > p_max - 2 ** (-s):
+                new_candidate_set.append(path)
+
+        # 全消し回避:空になったら据え置き
+        candidate_set = new_candidate_set or candidate_set
+
+    # 1 本も推定できなかった場合
+    if not estimated_fidelities:
+        if return_details:
+            return False, int(cost), None, alloc_by_path, est_fid_by_path
+        return False, int(cost), None
+
+    # 最良推定パスと正解判定
+    best_path = max(estimated_fidelities, key=estimated_fidelities.get)
+    best_path_fidelity = estimated_fidelities[best_path]
+    correctness = (best_path == getattr(network, "best_path", None))
+
+    if return_details:
+        return bool(correctness), int(cost), best_path_fidelity, alloc_by_path, est_fid_by_path
+    return bool(correctness), int(cost), best_path_fidelity
+
+
+# 互換用エイリアス(古い呼び名を使っているコード向け)
+lonline_network_benchmarking_with_budget = lonline_network_benchmarking

+ 35 - 0
add_linkselfie/schedulers/memo.txt

@@ -0,0 +1,35 @@
+schedulerの入出力
+
+入力
+def naive_budget_scheduler(
+    node_path_list,      # 例: [2, 2, 2]  … 各ペアのリンク(パス)本数
+    importance_list,     # 例: [0.3, 0.5, 0.7] … 各ペアの重み(長さは node_path_list と同じ)
+    bounces,             # 例: [1,2,3,4](重複なし)… 1サンプルの重み(sum(bounces) が単価)
+    C_total,             # 総予算(整数推奨。超過しないよう切り捨て配分)
+    network_generator,   # callable: (path_num, pair_idx) -> network
+):
+
+
+
+置き場所:scheduler を叩く関数は evaluation.py。main はそれを呼ぶだけ(linkselfie流)。
+network_generator:evaluation の中で noise_model を閉じ込める factory を定義(既存パターンと一致)。
+
+
+出力
+per_pair_results: 入力の順(= node_path_list の順)で並べたタプルのリスト
+各要素は (correctness, cost, best_path_fidelity)
+
+total_cost: すべてのペアの cost 合計(予算チェックに便利)
+
+
+
+main -> evalation -> schedular -> algorithms
+という呼び出しになっている
+
+
+
+lnaive = 隣接ノードに配る測定予算が等しい。ノード間で等しくリンクに測
+定資源を配る。
+
+
+

+ 11 - 0
add_linkselfie/schedulers/memo.txt~

@@ -0,0 +1,11 @@
+
+
+
+
+neighbor_info_dict,
+    network_generator,
+    fidelity_generator,
+    bounces,
+    C_total,
+    C_initial_per_pair=0 # インターフェース互換性のため
+):

+ 278 - 0
add_linkselfie/utils.py

@@ -0,0 +1,278 @@
+# The code mainly comes from the tutorial of NetSquid:
+# https://docs.netsquid.org/latest-release/tutorial.intro.html
+
+import itertools
+import math
+import random
+
+import netsquid as ns
+import netsquid.qubits.ketstates as ks
+import numpy
+import numpy as np
+from netsquid.components import (DephaseNoiseModel, DepolarNoiseModel,
+                                 PhysicalInstruction, QuantumChannel,
+                                 QuantumProcessor)
+from netsquid.components.instructions import (INSTR_MEASURE_BELL, INSTR_X,
+                                              INSTR_Z)
+from netsquid.components.models.qerrormodels import QuantumErrorModel
+from netsquid.components.qsource import QSource, SourceStatus
+from netsquid.nodes.connections import Connection
+from netsquid.qubits import StateSampler
+
+
+def set_random_seed(seed):
+    random.seed(seed)
+    numpy.random.seed(seed)
+    ns.set_random_state(seed=seed)
+
+
+def pairwise(iterable):
+    """E.g., pairwise([1, 2, 3, 4]) outputs [(1, 2), (2, 3), (3, 4)]
+       If input size is less or equal to 1, output []
+    """
+    a, b = itertools.tee(iterable)
+    next(b, None)
+    return zip(a, b)
+
+
+def pairs(lst):
+    """Iterate over pairs in a list (circular fashion).
+    E.g., if `lst=[0, 1, 2, ..., 9]`, the function returns (0, 1) (1, 2) (2, 3) (3, 4) (4, 5) (5, 6) (6, 7) (7, 8) (8, 9) (9, 0).
+    Reference: https://stackoverflow.com/questions/1257413/iterate-over-pairs-in-a-list-circular-fashion-in-python
+    """
+    n = len(lst)
+    for i in range(n):
+        yield lst[i], lst[(i + 1) % n]
+
+
+def fidelity_to_error_param(f, noise_model):
+    if noise_model == "Depolar":
+        # Deploarizing channel: E[ρ] = pρ+(1-p)I/2
+        # f = p + (1 - p)/2  ==>  p = -1 + 2f
+        # The domain of f is [0.5, 1]
+        assert f >= 0.5 and f <= 1
+        p = -1 + 2 * f
+        return 1 - p
+    elif noise_model == "Dephase":
+        # Dephasing channel: E[ρ] = pρ+(1-p)ZρZ'
+        # f = (2 p + 1)/3  ==>  p = 1/2 (-1 + 3 f)
+        # The domain of f is [1/3, 1]
+        assert f >= 1 / 3 and f <= 1
+        p = 0.5 * (-1 + 3 * f)
+        return 1 - p
+    elif noise_model == "AmplitudeDamping":
+        # Amplitude damping channel
+        # f = 2/3 - p/6 + Sqrt[1 - p]/3  ==> p = 2 (1 - 3 f + Sqrt[2] Sqrt[-1 + 3 f])
+        # The domain of f is [1/2, 1]
+        # print("AAAAA", f, 2 * (1 - 3 * f + math.sqrt(2) * math.sqrt(-1 + 3 * f)))
+        assert f >= 1 / 2 and f <= 1
+        return 2 * (1 - 3 * f + math.sqrt(2) * math.sqrt(-1 + 3 * f))
+    elif noise_model == "BitFlip":
+        # Bit flip channel: E[ρ] = pρ+(1-p)XρX'
+        # f = (2 p + 1)/3  ==>  p = 1/2 (-1 + 3 f)
+        # The domain of f is [1/3, 1]
+        assert f >= 1 / 3 and f <= 1
+        p = 0.5 * (-1 + 3 * f)
+        return 1 - p
+    else:
+        print("Error: Unknown error model")
+        exit(1)
+
+
+class EntanglingConnectionOnDemand(Connection):
+    """A connection that generates an entanglement upon receiving a request in port "trigger".
+
+    Consists of a midpoint holding a quantum source that connects to
+    outgoing quantum channels.
+
+    Parameters
+    ----------
+    fidelity : float
+
+    """
+
+    # Static variable used in the name of QSource. This guarantees that all the generated qubits' name are distinct.
+    qsource_index = 1
+
+    def __init__(self, noise_model, fidelity):
+        name = "EntanglingConnection"
+        name = name + str(EntanglingConnectionOnDemand.qsource_index)
+        EntanglingConnectionOnDemand.qsource_index += 1
+        super().__init__(name=name)
+        qsource = QSource(f"qsource_{name}", StateSampler([ks.b00], [1.0]), num_ports=2, status=SourceStatus.EXTERNAL)
+        self.add_subcomponent(qsource, name="qsource")
+        self.fidelity = fidelity
+        error_parameter = fidelity_to_error_param(fidelity, noise_model)
+
+        if noise_model == "Depolar":
+            noise_model = DepolarNoiseModel(error_parameter, time_independent=True)
+        elif noise_model == "Dephase":
+            noise_model = DephaseNoiseModel(error_parameter, time_independent=True)
+        elif noise_model == "AmplitudeDamping":
+            noise_model = AmplitudeDampingNoiseModel(error_parameter)
+        elif noise_model == "BitFlip":
+            noise_model = BitFlipNoiseModel(error_parameter)
+        else:
+            print("Error: Unknown error model")
+            exit(1)
+
+        qchannel_c2a = QuantumChannel("qchannel_C2A", models={"quantum_noise_model": noise_model})
+        qchannel_c2b = QuantumChannel("qchannel_C2B")
+        # Add channels and forward quantum channel output to external port output:
+        self.add_subcomponent(qchannel_c2a, forward_output=[("A", "recv")])
+        self.add_subcomponent(qchannel_c2b, forward_output=[("B", "recv")])
+        # Connect qsource output to quantum channel input:
+        qsource.ports["qout0"].connect(qchannel_c2a.ports["send"])
+        qsource.ports["qout1"].connect(qchannel_c2b.ports["send"])
+
+
+def create_qprocessor(num_positions, gate_noise_rate=0, mem_noise_rate=0):
+    """Factory to create a quantum processor for each node in the repeater chain network.
+
+    Has memory positions and the physical instructions necessary for teleportation.
+
+    Parameters
+    ----------
+    num_positions : int
+        The number of qubits that the quantum memory can maintain.
+
+    gate_noise_rate : float
+        The probability that quantum operation results will depolarize.
+
+    mem_noise_rate : float
+        The probability that qubits stored in quantum memory will depolarize.
+
+    Returns
+    -------
+    :class:`~netsquid.components.qprocessor.QuantumProcessor`
+        A quantum processor to specification.
+
+    """
+    gate_noise_model = DepolarNoiseModel(gate_noise_rate, time_independent=True)
+    mem_noise_model = DepolarNoiseModel(mem_noise_rate, time_independent=True)
+    physical_instructions = [
+        PhysicalInstruction(INSTR_X, duration=1, quantum_noise_model=None),
+        PhysicalInstruction(INSTR_Z, duration=1, quantum_noise_model=None),
+        # We have to set `apply_q_noise_after=False` to make sure the noise is added before measurement
+        # Otherwise the measurement results will be precise
+        PhysicalInstruction(INSTR_MEASURE_BELL,
+                            duration=7,
+                            quantum_noise_model=gate_noise_model,
+                            apply_q_noise_after=False),
+    ]
+    qproc = QuantumProcessor("QuantumProcessor",
+                             num_positions=num_positions,
+                             fallback_to_nonphysical=False,
+                             mem_noise_models=[mem_noise_model] * num_positions,
+                             phys_instructions=physical_instructions)
+    return qproc
+
+
+class BitFlipNoiseModel(QuantumErrorModel):
+    """Bit Flip Noise Model.
+
+       (1-gamma) * |PHI><PHI| + gamma * X|PHI><PHI|X.
+    Parameters
+    ----------
+    gamma : float
+        Bit flip parameter
+    Raises
+    ------
+    ValueError
+        If gamma is <0 or >1
+    """
+
+    def __init__(self, gamma, **kwargs):
+        super().__init__(**kwargs)
+        self._properties.update({'gamma': gamma})
+        if gamma < 0:
+            raise ValueError("gamma {} is negative".format(self.gamma))
+        if gamma > 1:
+            raise ValueError("gamma {} is larger than one".format(self.gamma))
+
+        self._properties.update({'gamma': gamma})
+
+    @property
+    def gamma(self):
+        return self._properties['gamma']
+
+    @gamma.setter
+    def gamma(self, value):
+        self._properties['gamma'] = value
+
+    def error_operation(self, qubits, delta_time=0, **kwargs):
+        """Error operation to apply to qubits.
+
+        Parameters
+        ----------
+        qubits : tuple of :obj:`~netsquid.qubits.qubit.Qubit`
+            Qubits to apply noise to.
+        delta_time : float, optional
+            Time qubits have spent on component [ns].
+
+        """
+        for qubit in qubits:
+            self.apply_noise(qubit)
+
+    def apply_noise(self, qubit):
+        """Applies noise to the qubit, depending on gamma."""
+        # Check whether the memory is empty, if so we do nothing
+        if qubit is None:
+            return
+        # Apply noise
+        ns.qubits.qubitapi.apply_pauli_noise(qubit, (1 - self.gamma, self.gamma, 0, 0))
+
+
+class AmplitudeDampingNoiseModel(QuantumErrorModel):
+    """Amplitude Damping Noise model
+
+    Parameters
+    ----------
+    gamma : float
+        Damping parameter
+
+    Raises
+    ------
+    ValueError
+        If gamma is <0 or >1
+    """
+
+    def __init__(self, gamma, **kwargs):
+        super().__init__(**kwargs)
+        self._properties.update({'gamma': gamma})
+        if gamma < 0:
+            raise ValueError("gamma {} is negative".format(self.gamma))
+        if gamma > 1:
+            raise ValueError("gamma {} is larger than one".format(self.gamma))
+
+        self._properties.update({'gamma': gamma})
+
+    @property
+    def gamma(self):
+        return self._properties['gamma']
+
+    @gamma.setter
+    def gamma(self, value):
+        self._properties['gamma'] = value
+
+    def error_operation(self, qubits, delta_time=0, **kwargs):
+        """Error operation to apply to qubits.
+
+        Parameters
+        ----------
+        qubits : tuple of :obj:`~netsquid.qubits.qubit.Qubit`
+            Qubits to apply noise to.
+        delta_time : float, optional
+            Time qubits have spent on component [ns].
+
+        """
+        for qubit in qubits:
+            self.apply_noise(qubit)
+
+    def apply_noise(self, qubit):
+        """Applies noise to the qubit, depending on gamma."""
+        # Check whether the memory is empty, if so we do nothing
+        if qubit is None:
+            return
+        # Apply noise
+        ns.qubits.qubitapi.amplitude_dampen(qubit, gamma=self.gamma, prob=1)

+ 171 - 0
memo.org

@@ -0,0 +1,171 @@
+** iccに論文を出すまでの予定
+- week1,week2(9月)
+  - _シュミレーション環境を大幅に変える_
+    - _どう変えるか_
+    - 見やすいコードにする
+    - linkselfieと全く同じ基盤にする
+    - _なぜ変えるか_
+    - 手を加えやすいようなシュミレーション環境にするため
+    - どこに手を加えたか分かりやすくするため
+    - 今は自分一人でシュミレーションをしているが、yutoさんやshotaさん
+      でも触りやすくするため
+    - 一人でシュミレーションを作るのは自信ない。自分で気付かないだけで
+      致命的なミスをする(している?)可能性が高い。
+    - 今のシュミレーションに手を加えるのは後々厳しい
+
+  - どうやって変えるか
+    - linkselfieをクローンして同じ構成にする
+    - 関数などから取得する値を後から追加したりするのが面倒なら、先にど
+      の実験をするのかを決めてそこから逆算してどの引数をとるべきなのか
+      を考えて、その後に実装する。
+      
+- 実験設定を論文に書く
+  - 細かくかく
+    - なんでシュミレーションができたかを理由として話せないとだめ
+  - なんでこのような実験をしたかを書く
+  - 細かいところまで理解しないとだめ
+
+** iccに向けて
+- 何の学会だすか
+- IEEE ICC 2026 の論文提出締切は 2025年9月29日。
+
+- 担当
+- 論文をかく yutoさん
+  - 1章、2章などの現状の論文と変わらない部分をまずは埋めてもらう
+- 実験をまわす shun
+  - 目的を考えて実験をする 
+
+- gitのリポジトリをICC用に作る
+- icc-shun-quantum
+
+
+** 現段階で決まっている実験で取るデータの種類
+
+- linkselfieでやってる系の実験
+  - エラー率をとる
+    - リンク群の中から忠実度が最も高いリンクを選べる確率を手法ごとに
+      - 縦軸 エラー率
+      - 横軸 測定予算
+  - 忠実度のgapを変える
+    - リンク群の中から最も高い忠実度とそれ以外のリンクの忠実度が今は別
+      の分布から出力されている。忠実度平均が0.9が1本、それ以外の4本は平均
+      0.85から出力するなど設定されている。
+      - linkselfieでは横軸 gap, 縦軸 バウンスだった
+      - 本実験では、横軸 gap, 縦軸 エラー率 (gapが小さいと他のリンクに
+        手が回らなくなり、提案手法が劣る結果になるはず)?
+  - ノイズモデルを増やす
+    - 他の3つのノイズモデルで実験をとる
+
+
+
+- linkselfieでやってない系の実験
+- 重要度が一様分布
+  - 重要度が何を考慮しているかによる。
+    - 通信需要やそれ以外の要因をまとめて重要度という指標でブラックボッ
+      クス化しているなら何を分布を使うのが最適か考える
+
+- リンクの本数を全てのノードペア間で5本にしているが、現実的ではない
+  - ランダムにリンクの本数を変える?
+  - 特定の分布からリンクの本数を決める?
+    - 事前にリンクの本数を知っていることが前提なので、ノードペア間のリ
+      ンクの本数を重要度に与えるのもあり?
+      
+- gapがある状態で実験しているのがそもそもおかしい?
+  - gapを0にして今回の実験をするとどうなるか
+
+- 隣接ノード数を変える
+  - 横軸隣接ノード数、縦軸総価値スコア(sum f*w*b)
+
+- 総価値スコアを変える(足す。)
+  - 提案手法に有利すぎ。評価指標として適切ではない。重要度x忠実度が最
+    も高いリンクに全てのバウンスをかける手法が一番すごいことになるが、
+    linkselfieは一定以上のバウンスをかけない仕組みになっている。これは
+    最も忠実度が高いリンクにバウンスをかけて高精度な推定をすることを目
+    的としているがコストをかければかけるほどいいという意味ではない。
+    精度と測定資源の節約のトレードオフを信頼度deltaという変数で制御し
+    ているところがすごいのにその目的から逸れた手法が勝ってしまうような
+    評価指標になっているのが問題。なので評価指標に忠実度のエラー率を組
+    みこんだような指標にするべき。
+    - 信頼度をあらかじめ設定する。90%で最も忠実度が高いリンクを選ぶよ
+      うな通信をしたい状況を考えるのなら、linkselfieでdelta = 0.1にし
+      てトポロジを揃えて実験をし、理想的なバウンスのかけかたを算出し、
+      それとどの程度離れているかを調べるなど。
+      - linkselfieを理想的なバウンスのかけ方としたが、自分で考えてもい
+        い(時間あるなら)
+
+	
+- 処理時間を考える。計算量
+
+
+- ベースライン
+  - linkselfieだけ
+  - 素朴にやるならどうか
+    - unirom-linkselfieとnaive以外を考える
+
+      
+- ストーリーどうするか
+  - 全く変えないのは違う
+  - 大きな論文を書くためのストーリーをかく
+
+- iccはのびる
+  - 28ではない予定(2週間から1ヶ月伸びる)
+
+- 現状のストーリーを考える
+  - 作って変えてをくりかえす
+    
+
+
+
+
+
+
+背景 重要度が大事
+
+linkselfie 高精度な推定と測定予算をできるだけ削る。トレードオフ
+信頼度 delta
+
+トレードオフを調節する値
+
+
+総価値スコア sum(w x sum(fxb))
+maxなとき... 重要度が最も高い宛先の最も忠実度が高いリンクに全てのバウ
+ンスをかければ最大となるのがおかしい?
+
+->いいのがみつかったらそれでいく
+
+
+
+現状
+背景 量子ネットワークにおいて忠実度を高いリンクを効率的に判定する手法 LinkSelFiE が提案されている
+動機 LinkSelFiE は通信需要を考慮していないが、現実には通信需要が高くかつ忠実度の高いリンクの判定が望まれる
+目的 少ない計測 (バウンス) により利用率 x 忠実度が高いリンクの判定を可能とする
+
+
+linkselfie -> 1本の最高忠実度のリンクを探す
+提案手法 -> 1つの宛先ノード?利用率次第?
+
+
+背景、動機を考える
+
+ストーリー案を考える
+
+実験はいろんなやつをとる
+
+実験ごとに実験の目的を書く
+- なんでその実験をしたのか
+
+
+順番にとっていく
+実験の目的のリスト
+とりやすい実験からとっていく
+
+
+ストーリー案を考えて実験をとる
+-> そこから実験をして意味のある結果がとれるのか
+それと実験の種類
+
+月曜までにストーリー案3つ
+
+背景 量子ネットワークにおいて忠実度を高いリンクを効率的に判定する手法 LinkSelFiE が提案されている
+動機 LinkSelFiE は通信需要を考慮していないが、現実には通信需要が高くかつ忠実度の高いリンクの判定が望まれる
+目的 少ない計測 (バウンス) により利用率 x 忠実度が高いリンクの判定を可能とする

+ 124 - 0
memo.org~

@@ -0,0 +1,124 @@
+** iccに論文を出すまでの予定
+- week1,week2(9月)
+  - _シュミレーション環境を大幅に変える_
+    - _どう変えるか_
+    - 見やすいコードにする
+    - linkselfieと全く同じ基盤にする
+    - _なぜ変えるか_
+    - 手を加えやすいようなシュミレーション環境にするため
+    - どこに手を加えたか分かりやすくするため
+    - 今は自分一人でシュミレーションをしているが、yutoさんやshotaさん
+      でも触りやすくするため
+    - 一人でシュミレーションを作るのは自信ない。自分で気付かないだけで
+      致命的なミスをする(している?)可能性が高い。
+    - 今のシュミレーションに手を加えるのは後々厳しい
+
+  - どうやって変えるか
+    - linkselfieをクローンして同じ構成にする
+    - 関数などから取得する値を後から追加したりするのが面倒なら、先にど
+      の実験をするのかを決めてそこから逆算してどの引数をとるべきなのか
+      を考えて、その後に実装する。
+      
+- 実験設定を論文に書く
+  - 細かくかく
+    - なんでシュミレーションができたかを理由として話せないとだめ
+  - なんでこのような実験をしたかを書く
+  - 細かいところまで理解しないとだめ
+
+** iccに向けて
+- 何の学会だすか
+- IEEE ICC 2026 の論文提出締切は 2025年9月29日。
+
+- 担当
+- 論文をかく yutoさん
+  - 1章、2章などの現状の論文と変わらない部分をまずは埋めてもらう
+- 実験をまわす shun
+  - 目的を考えて実験をする 
+
+- gitのリポジトリをICC用に作る
+- icc-shun-quantum
+
+
+** 現段階で決まっている実験で取るデータの種類
+
+- linkselfieでやってる系の実験
+  - エラー率をとる
+    - リンク群の中から忠実度が最も高いリンクを選べる確率を手法ごとに
+      - 縦軸 エラー率
+      - 横軸 測定予算
+  - 忠実度のgapを変える
+    - リンク群の中から最も高い忠実度とそれ以外のリンクの忠実度が今は別
+      の分布から出力されている。忠実度平均が0.9が1本、それ以外の4本は平均
+      0.85から出力するなど設定されている。
+      - linkselfieでは横軸 gap, 縦軸 バウンスだった
+      - 本実験では、横軸 gap, 縦軸 エラー率 (gapが小さいと他のリンクに
+        手が回らなくなり、提案手法が劣る結果になるはず)?
+  - ノイズモデルを増やす
+    - 他の3つのノイズモデルで実験をとる
+
+
+
+- linkselfieでやってない系の実験
+- 重要度が一様分布
+  - 重要度が何を考慮しているかによる。
+    - 通信需要やそれ以外の要因をまとめて重要度という指標でブラックボッ
+      クス化しているなら何を分布を使うのが最適か考える
+
+- リンクの本数を全てのノードペア間で5本にしているが、現実的ではない
+  - ランダムにリンクの本数を変える?
+  - 特定の分布からリンクの本数を決める?
+    - 事前にリンクの本数を知っていることが前提なので、ノードペア間のリ
+      ンクの本数を重要度に与えるのもあり?
+      
+- gapがある状態で実験しているのがそもそもおかしい?
+  - gapを0にして今回の実験をするとどうなるか
+
+- 隣接ノード数を変える
+  - 横軸隣接ノード数、縦軸総価値スコア(sum f*w*b)
+
+- 総価値スコアを変える(足す。)
+  - 提案手法に有利すぎ。評価指標として適切ではない。重要度x忠実度が最
+    も高いリンクに全てのバウンスをかける手法が一番すごいことになるが、
+    linkselfieは一定以上のバウンスをかけない仕組みになっている。これは
+    最も忠実度が高いリンクにバウンスをかけて高精度な推定をすることを目
+    的としているがコストをかければかけるほどいいという意味ではない。
+    精度と測定資源の節約のトレードオフを信頼度deltaという変数で制御し
+    ているところがすごいのにその目的から逸れた手法が勝ってしまうような
+    評価指標になっているのが問題。なので評価指標に忠実度のエラー率を組
+    みこんだような指標にするべき。
+    - 信頼度をあらかじめ設定する。90%で最も忠実度が高いリンクを選ぶよ
+      うな通信をしたい状況を考えるのなら、linkselfieでdelta = 0.1にし
+      てトポロジを揃えて実験をし、理想的なバウンスのかけかたを算出し、
+      それとどの程度離れているかを調べるなど。
+      - linkselfieを理想的なバウンスのかけ方としたが、自分で考えてもい
+        い(時間あるなら)
+
+	
+- 処理時間を考える。計算量
+
+
+- ベースライン
+  - linkselfieだけ
+  - 素朴にやるならどうか
+    - unirom-linkselfieとnaive以外を考える
+
+      
+- ストーリーどうするか
+  - 全く変えないのは違う
+  - 大きな論文を書くためのストーリーをかく
+
+- iccはのびる
+  - 28ではない予定(2週間から1ヶ月伸びる)
+
+- 現状のストーリーを考える
+  - 作って変えてをくりかえす
+    
+
+
+
+
+
+
+
+
+ミーティング