We introduce a Lyapunov function for the dynamics of memristive circuits, and compare the effectiveness of memristors in minimizing the function to widely used optimization software. We study in particular three classes of problems which can be directly embedded in a circuit topology, and show that memristors effectively attempt at (quickly) extremizing these functionals.