Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/CyberBattleSim
Path: blob/main/notebooks/run_benchmark.sh
597 views
1
2
#!/usr/bin/python3.10
3
4
# Copyright (c) Microsoft Corporation.
5
# Licensed under the MIT License.
6
7
# Run all notebooks fully to produce publishable benchmark results
8
# and reusable notebooks
9
10
set -ex
11
12
kernel=$1
13
if [ -z "$kernel" ]; then
14
kernel=cybersim
15
fi
16
17
script_dir=$(dirname "$0")
18
19
pushd "$script_dir/.."
20
21
output_dir=notebooks/output/benchmark
22
output_plot_dir=$output_dir/plots
23
24
25
run () {
26
base=$1
27
suffix=$2
28
cat notebook notebooks/$base.py \
29
| jupytext --to ipynb - \
30
| papermill --kernel $kernel $output_dir/$base$suffix.ipynb "${@:3}"
31
}
32
33
jupyter kernelspec list
34
35
mkdir $output_dir -p
36
mkdir $output_plot_dir -p
37
38
# run c2_interactive_interface '' # disabled: not deterministic and can fail
39
40
# run random_active_directory '' # disabled: not deterministic and can fail
41
42
# run notebook_dql_debug.py ''
43
44
45
run toyctf-blank ''
46
47
run toyctf-random ''
48
49
run toyctf-solved ''
50
51
run chainnetwork-optionwrapper ''
52
53
run chainnetwork-random '' -y "
54
iterations: 100
55
"
56
57
run randomnetwork ''
58
59
run notebook_benchmark '-chain' -y "
60
gymid: 'CyberBattleChain-v0'
61
iteration_count: 2000 # iteration_count = 9000
62
training_episode_count: 20 # training_episode_count = 50
63
eval_episode_count: 3 # eval_episode_count = 5
64
maximum_node_count: 20 # maximum_node_count = 22
65
maximum_total_credentials: 20 # maximum_total_credentials = 22
66
env_size: 10
67
plots_dir: $output_plot_dir
68
"
69
70
run notebook_benchmark '-toyctf' -y "
71
gymid: 'CyberBattleToyCtf-v0'
72
env_size: null
73
iteration_count: 1500
74
training_episode_count: 20
75
eval_episode_count: 10
76
maximum_node_count: 12
77
maximum_total_credentials: 10
78
plots_dir: $output_plot_dir
79
"
80
81
run notebook_benchmark '-tiny' -y "
82
gymid: 'CyberBattleTiny-v0'
83
env_size: null
84
iteration_count: 200
85
training_episode_count: 10
86
eval_episode_count: 10
87
maximum_node_count: 5
88
maximum_total_credentials: 3
89
plots_dir: $output_plot_dir
90
"
91
92
run notebook_dql_transfer '' -y "
93
plots_dir: $output_plot_dir
94
"
95
96
run notebook_randlookups '' -y "
97
plots_dir: $output_plot_dir
98
"
99
100
run notebook_tabularq '' -y "
101
plots_dir: $output_plot_dir
102
"
103
104
run notebook_withdefender '' -y "
105
plots_dir: $output_plot_dir
106
"
107
108
run dql_active_directory '' -y "
109
iteration_count: 50
110
"
111
112
popd
113
114