def market_clearing(a_declare):
a_real = np.array([18.0, 20.0, 25.0, 22.0, 22.0, 16.0])
b_real = np.array([0.25, 0.20, 0.20, 0.20, 0.20, 0.25])
c_real = np.array([120.0, 130.0, 120.0, 135.0, 150.0, 95.0, 150.0, 125.0, 100.0, 150.0,
90.0, 95.0, 90.0, 90.0, 160.0, 120.0, 150.0, 100.0, 95.0, 125.0]) * -1
d_real = np.array([5.0, 5.5, 4.5, 5.0, 5.0, 3.0, 5.5, 4.0, 4.5, 5.0,
3.5, 3.5, 3.5, 3.5, 6.0, 5.0, 6.0, 4.5, 3.5, 4.5])
p_min = np.array([5.0, 5.0, 5.0, 5.0, 5.0, 5.0])
p_max = np.array([100.0, 80.0, 50.0, 80.0, 50.0, 120.0])
q_min = np.zeros(20)
q_max = np.array([24.0, 23.63636364, 26.66666667, 27.0, 30.0,
31.66666667, 27.27272727, 31.25, 22.22222222, 30.0,
25.71428571, 27.14285714, 25.71428571, 25.71428571, 26.66666667,
24.0, 25.0, 22.22222222, 27.14285714, 27.77777778])
plt.plot(strategic_variables[:, 0], lw=0.5, C=C[0], alpha=0.5, label=r"$\\alpha_{1t}$")
plt.plot(strategic_variables[:, 1], lw=0.5, C=C[1], alpha=0.5, label=r"$\\alpha_{2t}$")
plt.plot([0, 10000], [20.29, 20.29], '--', C=C[0], label=r"$\\alpha_{1t}^*$")
plt.plot([0, 10000], [22.98, 22.98], '--', C=C[1], label=r"$\\alpha_{2t}^*$")
plt.xlabel(r"$t$")
plt.ylabel(r"$\\alpha_{gt}$ (\$/MHh)")
plt.title("Q-Learning (3-Bus System)")
plt.legend()
plt.savefig('Q-Learning.png', dpi=600)
plt.show()