Skip to content

Commit

Permalink
remove casadi code
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanJamesLew committed Apr 12, 2024
1 parent c51b7db commit 8bd658b
Showing 1 changed file with 0 additions and 63 deletions.
63 changes: 0 additions & 63 deletions notebooks/weighted-cost-func.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -228,69 +228,6 @@
"plt.plot(trajectory_uw.states[:, 1], label='Trajectory Prediction')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bbe8ef2b-3169-476f-ad8c-003f92469247",
"metadata": {},
"outputs": [],
"source": [
"from casadi import *\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b656fb35-a5e0-4405-9564-332d427bfe47",
"metadata": {},
"outputs": [],
"source": [
"X = np.vstack([t.states[:-1] for t in training_data])\n",
"Xp = np.vstack([t.states[1:] for t in training_data])\n",
"W = [w[:-1] for w in weights]\n",
"g = experiment_results['tuned_model'].obs_func\n",
"gd = experiment_results['tuned_model'].obs.obs_grad\n",
"G = np.vstack([np.atleast_2d(g(x)).T for x in X])\n",
"Gp = np.vstack([np.atleast_2d(g(x)).T for x in Xp])\n",
"\n",
"G, Gd = G.T, Gp.T\n",
"Js = [gd(xi) for xi in X]\n",
"Wy = np.vstack(\n",
" [(np.abs(J) @ w.T).T \n",
" for J, w in zip(Js, W)\n",
" ])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "861fef48-3b9c-4686-ab7d-11183a80eff0",
"metadata": {},
"outputs": [],
"source": [
"(Js[0] @ W[0].T).shape"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ed116b64-098f-481b-bc5c-958b6a12c096",
"metadata": {},
"outputs": [],
"source": [
"Wy.T * G"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "51ac108b-7e59-4248-adf0-4c0042dac586",
"metadata": {},
"outputs": [],
"source": [
"J.shape"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit 8bd658b

Please sign in to comment.