|
| 1 | +import numpy as np |
| 2 | +import matplotlib.pyplot as plt |
| 3 | + |
| 4 | + |
| 5 | +xmin = -0.5 |
| 6 | +xmax = 2.0 |
| 7 | + |
| 8 | +xgrid = np.linspace(xmin, xmax, 1000) |
| 9 | + |
| 10 | +a1, b1 = 0.15, 0.5 # first T_σ |
| 11 | +a2, b2 = 0.5, 0.4 # second T_σ |
| 12 | +a3, b3 = 0.75, 0.2 # third T_σ |
| 13 | + |
| 14 | +v1 = b1/(1-a1) |
| 15 | +v2 = b2/(1-a2) |
| 16 | +v3 = b3/(1-a3) |
| 17 | + |
| 18 | +T1 = a1 * xgrid + b1 |
| 19 | +T2 = a2 * xgrid + b2 |
| 20 | +T3 = a3 * xgrid + b3 |
| 21 | +T = np.maximum.reduce([T1, T2, T3]) |
| 22 | + |
| 23 | +fig, ax = plt.subplots(figsize=(6, 5)) |
| 24 | +for spine in ["left", "bottom"]: |
| 25 | + ax.spines[spine].set_position("zero") |
| 26 | + |
| 27 | +for spine in ["right", "top"]: |
| 28 | + ax.spines[spine].set_color("none") |
| 29 | + |
| 30 | +ax.plot(xgrid, T1, "k-", lw=1) |
| 31 | +ax.plot(xgrid, T2, "k-", lw=1) |
| 32 | +ax.plot(xgrid, T3, "k-", lw=1) |
| 33 | + |
| 34 | +ax.plot(xgrid, T, lw=6, alpha=0.3, color="blue", |
| 35 | + label=r"$T = \bigvee_{\sigma \in \Sigma} T_\sigma$") |
| 36 | + |
| 37 | + |
| 38 | +ax.text(2.1, 0.6, r"$T_{\sigma'}$") |
| 39 | +ax.text(2.1, 1.4, r"$T_{\sigma''}$") |
| 40 | +ax.text(2.1, 1.9, r"$T_{\sigma'''}$") |
| 41 | + |
| 42 | +ax.legend(frameon=False, loc="upper center") |
| 43 | + |
| 44 | + |
| 45 | +ax.set_xlim(xmin, xmax+0.5) |
| 46 | +ax.set_ylim(-0.2, 2.5) |
| 47 | +ax.text(2.4, -0.15, r"$v$") |
| 48 | + |
| 49 | +ax.set_xticks([]) |
| 50 | +ax.set_yticks([]) |
| 51 | + |
| 52 | +plt.show() |
| 53 | + |
| 54 | +file_name = "../figures_py/bellman_envelope.png" |
| 55 | +fig.savefig(file_name) |
| 56 | + |
0 commit comments