I am testing an optimization algorithm and would like to view the decision variable as it evolves on a plot of the cost function and constraints. For example, the following code:
import matplotlib.pyplot as plt
from sympy import symbols, plot_implicit
from sympy.plotting.plot import Plot, ContourSeries
from sympy.utilities.lambdify import lambdify
(x1, x2) = symbols('x1 x2')
func = x1**4 + x2**4
p1 = Plot(ContourSeries(func,(x1,-1,5),(x2,-1,5)))
p1.extend(plot_implicit(x1 < 0,(x1,-1,5),(x2,-1,5),line_color='red',show=False))
p1.extend(plot_implicit(x2 < 2,(x1,-1,5),(x2,-1,5),line_color='red',show=False))
p1.show()
produces a contour plot of a cost function, and shows some constraints as a red area, but how would I add a single point to this plot? The following:
x1 = [4,4]
x2 = [4,4]
plt.scatter(x1,x2)
creates a new, separate plot.