Skip to content

Commit 40b40e0

Browse files
committed
new alpha optimization
1 parent 10f864d commit 40b40e0

42 files changed

Lines changed: 36067 additions & 28768 deletions

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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ cover/
5050
profile_default/
5151
ipython_config.py
5252
/.vs
53+
*.pkl
54+
*.pkl
55+
baseline_controllers/alpha/v2/results/uncontrolled_data_log.pkl

baseline_controllers/alpha/compare_timeseries.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@
218218
elif "4" in node[0] or "4" in node[1]:
219219
pos[node][0] = 0.5
220220
elif "5" in node[0] or "5" in node[1]:
221-
if "C" not in node[0] and "C" not in node[1] and "I" not in node[0] and "I" not in node[1]:
222-
pos[node][0] = 1.0
221+
#if "C" not in node[0] and "C" not in node[1] and "I" not in node[0] and "I" not in node[1]:
222+
pos[node][0] = 1.0
223223

224224

225225
#nx.draw_networkx_nodes(subway['graph'], pos, node_size=500)

baseline_controllers/alpha/evaluate_baseline_controllers.py

Lines changed: 12 additions & 8 deletions
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')
24-
evaluating = 'constant-flow'
24+
evaluating = 'uncontrolled'
2525
verbose = True
2626
version = "2" # options are "1" and "2"
2727
level = "1" # options are "1" , "2", and "3"
@@ -52,8 +52,12 @@
5252

5353

5454
for parameter in tuning_values:
55-
optimal_constant_flows = np.loadtxt(str("./v" + version + "/optimal_constant_flows.txt"))
56-
optimal_efd_params = np.loadtxt(str("./v" + version + "/optimal_efd_params.txt"))
55+
if evaluating == "constant-flow" or evaluating == "uncontrolled":
56+
optimal_constant_flows = np.loadtxt(str("./v" + version + "/optimal_constant_flows.txt"))
57+
elif evaluating == "equal-filling":
58+
optimal_constant_flows = np.loadtxt(str("./v" + version + "/optimal_efd.txt"))[:-1]
59+
optimal_efd_params = np.loadtxt(str("./v" + version + "/optimal_efd.txt"))[-1]
60+
5761

5862
print("tuning value: ", parameter)
5963
optimal_constant_flows = optimal_constant_flows*(1+parameter)
@@ -156,8 +160,8 @@
156160
filling_degree_avg = np.mean(filling_degrees)
157161

158162
if evaluating == "constant-flow":
159-
160-
done = env.step(u_open_pct.flatten(),level=level)
163+
pass
164+
#done = env.step(u_open_pct.flatten(),level=level)
161165
elif evaluating == "equal-filling":
162166
for idx in orifice_indices:
163167
this_fd = filling_degrees[idx]
@@ -168,10 +172,10 @@
168172
u_open_pct[i] = 1.0
169173
elif u_open_pct[i] < 0.0:
170174
u_open_pct[i] = 0.0
171-
done = env.step(u_open_pct.flatten(),level=level)
175+
#done = env.step(u_open_pct.flatten(),level=level)
172176
elif evaluating == "uncontrolled":
173177
u_open_pct[0:4] = 1.0
174-
done = env.step(u_open_pct.flatten(),level=level)
178+
#done = env.step(u_open_pct.flatten(),level=level)
175179
else:
176180
print("error. control scenario not recongized.")
177181
done = True
@@ -202,7 +206,7 @@
202206
if (not done) and env.env.sim.current_time > env.env.sim.end_time - datetime.timedelta(hours=1):
203207
node_indices = [i for i in range(len(env.config['states'])) if 'depthN' in env.config['states'][i][1]]
204208
final_depths = env.state()[node_indices]
205-
209+
206210
done = env.step(u_open_pct.flatten(),level=level)
207211

208212
perf = sum(env.data_log["performance_measure"])

0 commit comments

Comments
 (0)