Skip to content
Snippets Groups Projects
Commit 9f6c91ef authored by tuhe's avatar tuhe
Browse files

Solutions for week 4 and 5

parent 254abc81
No related branches found
No related tags found
No related merge requests found
hk = (ts[k + 1] - ts[k])
J += .5 * hk * (cs[k] + cs[k + 1])
\ No newline at end of file
Ieq.append((xs[k+1][j] - xs[k][j]) - 0.5*hk*(fs[k+1][j] + fs[k][j]))
\ No newline at end of file
Iineq += model.sym_h(x=xs[k], u=us[k], t=ts[k])
\ No newline at end of file
J_jac = sym.lambdify([z], sym.derive_by_array(J, z), modules='numpy')
\ No newline at end of file
for k in range(len(ts) - 1):
if ts[k] <= t_new and t_new <= ts[k + 1]:
break
\ No newline at end of file
self.ufun = solutions[-1]['fun']['u']
\ No newline at end of file
t = info['time_seconds']
if t > self.ts_grid[-1]:
print("Simulation time is", t, "which exceeds the maximal planning horizon t_F =", self.ts_grid[-1])
raise Exception("Time exceed agents planning horizon")
u = self.ufun(t)
u = np.asarray(self.env.discrete_model.phi_u(u))
\ No newline at end of file
Q = np.zeros((4, 4))
return SymbolicQRCost(Q=Q, R=np.asarray([[1.0]]) )
\ No newline at end of file
duration = 2
return Box(duration, duration, shape=(1,))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment