Skip to content

Commit 7107a96

Browse files
committed
new figures
1 parent dc171c3 commit 7107a96

60 files changed

Lines changed: 50306 additions & 95124 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,15 @@ baseline_controllers/alpha/v2/lev1/results/constant-flow_param=0.0_data_log.pkl
6161
*.pkl
6262
*.pkl
6363
*.pkl
64+
baseline_controllers/theta/v2/equal-filling_level_3_data_log.pkl
65+
baseline_controllers/theta/v2/equal-filling_level_2_data_log.pkl
66+
baseline_controllers/theta/v2/constant-flow_level_3_data_log.pkl
67+
baseline_controllers/theta/v2/constant-flow_level_2_data_log.pkl
68+
baseline_controllers/theta/v2/constant-flow_level_1_data_log.pkl
69+
baseline_controllers/theta/bo_efd_params.pkl
70+
baseline_controllers/theta/bo_constant_flows.pkl
71+
baseline_controllers/epsilon/v2/lev1/results/equal-filling_param=0.0_data_log.pkl
72+
baseline_controllers/epsilon/v2/lev1/results/constant-flow_param=0.0_data_log.pkl
73+
baseline_controllers/alpha/v2/results/uncontrolled_data_log.pkl
74+
baseline_controllers/alpha/v2/lev1/results/equal-filling_param=0.0_data_log.pkl
75+
baseline_controllers/alpha/v2/lev1/results/constant-flow_param=0.0_data_log.pkl

baseline_controllers/alpha/compare_levels.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@
4444
level3_actions = pd.read_csv("./v" + version + "/lev3/results/actions_" + control + "_param=0.0.csv",index_col=0,parse_dates=True)
4545
level3_states = pd.read_csv("./v" + version + "/lev3/results/states_" + control + "_param=0.0.csv",index_col=0,parse_dates=True)
4646

47+
# don't plot the states with "C" in them
48+
states_to_plot = [state for state in env.config['states'] if "C" not in state[0]]
4749

48-
49-
plots_high = max(len(env.config['action_space']) , len(env.config['states']))
50+
plots_high = max(len(env.config['action_space']) , len(states_to_plot))
5051

5152
fig = plt.figure(figsize=(10,2*plots_high))
5253
gs = GridSpec(plots_high,2,figure=fig)
@@ -73,29 +74,29 @@
7374
ax.annotate(str(env.config['action_space'][idx]), xy=(0.5, 0.8), xycoords='axes fraction', ha='center', va='center',fontsize='xx-large')
7475

7576
# plot the states
76-
for idx in range(len(env.config['states'])):
77+
for idx in range(len(states_to_plot)):
7778
ax = fig.add_subplot(gs[idx,1] )
78-
ax.plot(uncontrolled_states.index, uncontrolled_states[str(env.config['states'][idx])], label='Uncontrolled',color='black',alpha=0.6)
79-
ax.plot(level1_states.index, level1_states[str(env.config['states'][idx])], label='Level 1',color='blue',alpha=0.6)
80-
ax.plot(level2_states.index, level2_states[str(env.config['states'][idx])], label='Level 2',color='green',alpha=0.6)
81-
ax.plot(level3_states.index, level3_states[str(env.config['states'][idx])], label='Level 3',color='red',alpha=0.6)
79+
ax.plot(uncontrolled_states.index, uncontrolled_states[str(states_to_plot[idx])], label='Uncontrolled',color='black',alpha=0.6)
80+
ax.plot(level1_states.index, level1_states[str(states_to_plot[idx])], label='Level 1',color='blue',alpha=0.6)
81+
ax.plot(level2_states.index, level2_states[str(states_to_plot[idx])], label='Level 2',color='green',alpha=0.6)
82+
ax.plot(level3_states.index, level3_states[str(states_to_plot[idx])], label='Level 3',color='red',alpha=0.6)
8283

83-
ax.annotate(str(env.config['states'][idx]), xy=(0.5, 0.8), xycoords='axes fraction', ha='center', va='center',fontsize='xx-large')
84+
ax.annotate(str(states_to_plot[idx]), xy=(0.5, 0.8), xycoords='axes fraction', ha='center', va='center',fontsize='xx-large')
8485

8586

8687

87-
if idx == len(env.config['states']) - 1:
88+
if idx == len(states_to_plot) - 1:
8889
ax.set_xlabel("time")
8990
# just add ticks in the beginning, middle, and end of the index
9091
ax.set_xticks([level1_states.index[0],level1_states.index[int(len(level1_states.index)/2)],level1_states.index[-1]])
9192

9293
if idx == 0:
9394
ax.set_title("States")
94-
if idx != len(env.config['states']) - 1: # not the last row
95+
if idx != len(states_to_plot) - 1: # not the last row
9596
ax.set_xticks([])
9697
ax.set_xticklabels([])
9798

98-
if idx == len(env.config['states']) - 2: # second to last row, for the legend
99+
if idx == len(states_to_plot) - 2: # second to last row, for the legend
99100
ax = fig.add_subplot(gs[idx,0])
100101
ax.plot(uncontrolled_states.index[0:2], np.zeros((2,1)), label = 'Uncontrolled',color='black',alpha=0.6)
101102
ax.plot(level1_states.index[0:2], np.zeros((2,1)), label = 'Level 1',color='blue',alpha=0.6)

baseline_controllers/alpha/compare_timeseries.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@
4646
constant_flow_states = pd.read_csv(str("./v" + version + "/lev" + level + "/results/states_constant-flow_param=" + constant_flow_param + ".csv"),index_col=0,parse_dates=True)
4747

4848

49+
# don't plot the states with "C" in them
50+
states_to_plot = [state for state in env.config['states'] if "C" not in state[0]]
4951

50-
plots_high = max(len(env.config['action_space']) , len(env.config['states']))
52+
plots_high = max(len(env.config['action_space']) , len(states_to_plot))
5153

5254
fig = plt.figure(figsize=(10,2*plots_high))
5355
gs = GridSpec(plots_high,2,figure=fig)
@@ -72,29 +74,29 @@
7274
ax.annotate(str(env.config['action_space'][idx]), xy=(0.5, 0.8), xycoords='axes fraction', ha='center', va='center',fontsize='xx-large')
7375

7476
# plot the states
75-
for idx in range(len(env.config['states'])):
77+
for idx in range(len(states_to_plot)):
7678
ax = fig.add_subplot(gs[idx,1] )
77-
ax.plot(uncontrolled_states.index, uncontrolled_states[str(env.config['states'][idx])], label='Uncontrolled',color='black',alpha=0.6)
78-
ax.plot(structural_states.index, structural_states[str(env.config['states'][idx])], label='Structural',color='green',alpha=0.6)
79-
ax.plot(equal_filling_states.index, equal_filling_states[str(env.config['states'][idx])], label='Equal Filling',color='blue',alpha=0.6)
80-
ax.plot(constant_flow_states.index, constant_flow_states[str(env.config['states'][idx])], label='Constant Flow',color='red',alpha=0.6)
79+
ax.plot(uncontrolled_states.index, uncontrolled_states[str(states_to_plot[idx])], label='Uncontrolled',color='black',alpha=0.6)
80+
ax.plot(structural_states.index, structural_states[str(states_to_plot[idx])], label='Structural',color='green',alpha=0.6)
81+
ax.plot(equal_filling_states.index, equal_filling_states[str(states_to_plot[idx])], label='Equal Filling',color='blue',alpha=0.6)
82+
ax.plot(constant_flow_states.index, constant_flow_states[str(states_to_plot[idx])], label='Constant Flow',color='red',alpha=0.6)
8183

82-
ax.annotate(str(env.config['states'][idx]), xy=(0.5, 0.8), xycoords='axes fraction', ha='center', va='center',fontsize='xx-large')
84+
ax.annotate(str(states_to_plot[idx]), xy=(0.5, 0.8), xycoords='axes fraction', ha='center', va='center',fontsize='xx-large')
8385

8486

8587

86-
if idx == len(env.config['states']) - 1:
88+
if idx == len(states_to_plot) - 1:
8789
ax.set_xlabel("time")
8890
# just add ticks in the beginning, middle, and end of the index
8991
ax.set_xticks([equal_filling_states.index[0],equal_filling_states.index[int(len(equal_filling_states.index)/2)],equal_filling_states.index[-1]])
9092

9193
if idx == 0:
9294
ax.set_title("States")
93-
if idx != len(env.config['states']) - 1: # not the last row
95+
if idx != len(states_to_plot) - 1: # not the last row
9496
ax.set_xticks([])
9597
ax.set_xticklabels([])
9698

97-
if idx == len(env.config['states']) - 2: # second to last row, for the legend
99+
if idx == len(states_to_plot) - 2: # second to last row, for the legend
98100
ax = fig.add_subplot(gs[idx,0])
99101
ax.plot(uncontrolled_states.index[0:2], np.zeros((2,1)), label = 'Uncontrolled',color='black',alpha=0.6)
100102
ax.plot(equal_filling_states.index[0:2], np.zeros((2,1)), label = 'Equal Filling',color='blue',alpha=0.6)

baseline_controllers/alpha/evaluate_baseline_controllers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
# ALPHA
2323
# options are: 'equal-filling' and 'constant-flow' (or 'uncontrolled') or 'structural'
24-
evaluating = 'equal-filling'
24+
evaluating = 'constant-flow'
2525
verbose = True
2626
version = "2" # options are "1" and "2"
2727
level = "1" # options are "1" , "2", and "3"
-176 KB
Loading

0 commit comments

Comments
 (0)