|
14 | 14 | from scipy.interpolate import interp1d
|
15 | 15 | if __name__ == '__main__':
|
16 | 16 |
|
17 |
| - algo = 'GLIS' |
18 |
| - #algo = 'BO' |
19 |
| - |
20 |
| - machine = 'PI' # PC or PI |
| 17 | + algo = 'GLIS' # GLIS or BO |
| 18 | + machine = 'PC' # PC or PI |
21 | 19 | eps_calc = 1.0
|
22 | 20 | iter_max_plot = 500
|
23 | 21 |
|
@@ -124,26 +122,26 @@ def xref_fun_def(t):
|
124 | 122 |
|
125 | 123 | # In[Iteration plot]
|
126 | 124 |
|
127 |
| - Y = results['J_sample'] |
| 125 | + J = results['J_sample'] |
128 | 126 | Ts_MPC = simout['Ts_MPC']
|
129 | 127 |
|
130 |
| - Y_best_curr = np.zeros(np.shape(Y)) |
131 |
| - Y_best_val = Y[0] |
| 128 | + J_best_curr = np.zeros(np.shape(J)) |
| 129 | + J_best_val = J[0] |
132 | 130 | iter_best_val = 0
|
133 | 131 |
|
134 | 132 | fig, axes = plt.subplots(1, 1, figsize=(6, 4))
|
135 | 133 | axes = [axes]
|
136 |
| - for i in range(len(Y_best_curr)): |
137 |
| - if Y[i] < Y_best_val: |
138 |
| - Y_best_val = Y[i] |
| 134 | + for i in range(len(J_best_curr)): |
| 135 | + if J[i] < J_best_val: |
| 136 | + J_best_val = J[i] |
139 | 137 | iter_best_val = i
|
140 |
| - Y_best_curr[i] = Y_best_val |
| 138 | + J_best_curr[i] = J_best_val |
141 | 139 |
|
142 |
| - N = len(Y) |
| 140 | + N = len(J) |
143 | 141 | iter = np.arange(1, N + 1, dtype=np.int)
|
144 |
| - axes[0].plot(iter, Y, 'k*', label='Current test point') |
| 142 | + axes[0].plot(iter, J, 'k*', label='Current test point') |
145 | 143 | # axes[0].plot(iter, Y_best_curr, 'r', label='Current best point')
|
146 |
| - axes[0].plot(iter, Y_best_val * np.ones(Y.shape), '-', label='Overall best point', color='red') |
| 144 | + axes[0].plot(iter, J_best_val * np.ones(J.shape), '-', label='Overall best point', color='red') |
147 | 145 | axes[0].set_xlabel("Iteration index n (-)")
|
148 | 146 | axes[0].set_ylabel(r"Performance cost $\tilde {J}^{\mathrm{cl}}$")
|
149 | 147 |
|
|
0 commit comments