Commit 9571a33
Update IFP lectures: add dynamics plots and adjust parameters (#741)
* Update IFP lectures: add dynamics plots and adjust parameters
Changes to ifp_discrete.md:
- Add asset dynamics plot showing 45-degree diagram of asset evolution
- Increase a_max from 5.0 to 10.0 (double the asset grid maximum)
- Reduce y_size from 100 to 12 for faster computation
- Plot shows low and high income states with 45-degree reference line
Changes to ifp_opi.md:
- Increase a_max from 5.0 to 10.0 (double the asset grid maximum)
- Reduce y_size from 100 to 12 for faster computation
- Fix "Policies match: False" issue by checking value functions instead
- Add side-by-side asset dynamics plots comparing VFI and OPI
- Visual comparison confirms both algorithms converge to same solution
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Adjust parameters: y_size=100 and m=50 for better OPI speedup demonstration
- Change y_size back to 100 in both ifp_discrete.md and ifp_opi.md
- Change OPI timing comparison to use m=50 instead of m=10
- With these settings, OPI shows 6.7x speedup vs VFI (compared to 3.9x with m=10)
- Provides better demonstration of OPI's performance advantage
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Remove @jax.jit decorators from intermediate functions for code simplicity
- Remove @jax.jit from B, T, get_greedy, T_σ_vec, and iterate_policy_operator
- Keep @jax.jit on main solver functions (value_function_iteration, optimistic_policy_iteration)
- Performance testing shows no significant difference (within measurement noise)
- Simplifies code while maintaining ~6x OPI speedup over VFI
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Use vmap strategy for T operator to match T_σ implementation
- Replace vectorized B with vmap-based B(v, model, i, j, ip)
- Add staged vmap application: B_1, B_2, B_vmap
- Update T and get_greedy to use B_vmap with index arrays
- Consistent with T_σ implementation which also uses vmap
- Performance: ~6.7x speedup (slightly better than vectorized version)
This makes the codebase more consistent by using the same vmap strategy
for both the Bellman operator and the policy operator.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 76631c4 commit 9571a33
2 files changed
+90
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
351 | 384 | | |
352 | 385 | | |
353 | 386 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
| 112 | + | |
114 | 113 | | |
115 | | - | |
116 | | - | |
| 114 | + | |
| 115 | + | |
117 | 116 | | |
118 | 117 | | |
119 | 118 | | |
120 | | - | |
| 119 | + | |
121 | 120 | | |
122 | | - | |
123 | | - | |
124 | 121 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 122 | + | |
131 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
132 | 127 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
| 128 | + | |
137 | 129 | | |
138 | | - | |
139 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
140 | 134 | | |
141 | 135 | | |
142 | 136 | | |
143 | 137 | | |
144 | 138 | | |
145 | | - | |
146 | 139 | | |
147 | 140 | | |
148 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
149 | 145 | | |
150 | 146 | | |
151 | 147 | | |
152 | 148 | | |
153 | 149 | | |
154 | | - | |
155 | 150 | | |
156 | 151 | | |
157 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
158 | 156 | | |
159 | 157 | | |
160 | 158 | | |
| |||
194 | 192 | | |
195 | 193 | | |
196 | 194 | | |
197 | | - | |
198 | 195 | | |
199 | 196 | | |
200 | 197 | | |
| |||
206 | 203 | | |
207 | 204 | | |
208 | 205 | | |
209 | | - | |
210 | 206 | | |
211 | 207 | | |
212 | 208 | | |
| |||
324 | 320 | | |
325 | 321 | | |
326 | 322 | | |
327 | | - | |
| 323 | + | |
328 | 324 | | |
329 | | - | |
| 325 | + | |
330 | 326 | | |
331 | 327 | | |
332 | 328 | | |
| |||
336 | 332 | | |
337 | 333 | | |
338 | 334 | | |
339 | | - | |
| 335 | + | |
340 | 336 | | |
341 | 337 | | |
342 | 338 | | |
| |||
345 | 341 | | |
346 | 342 | | |
347 | 343 | | |
348 | | - | |
| 344 | + | |
349 | 345 | | |
350 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
351 | 376 | | |
352 | 377 | | |
353 | 378 | | |
| |||
384 | 409 | | |
385 | 410 | | |
386 | 411 | | |
387 | | - | |
388 | | - | |
389 | | - | |
| 412 | + | |
390 | 413 | | |
391 | 414 | | |
392 | 415 | | |
| |||
0 commit comments