  There is a deep connection between thermodynamics, information and work extraction. Ever since the birth of thermodynamics, various types of Maxwell demons have been introduced in order to deepen our understanding of the second law. Thanks to them it has been shown that there is a deep connection between thermodynamics and information, and between information and work in a thermal system. In this paper, we study the problem of energy extraction from a thermodynamic system satisfying detailed balance, from an agent with perfect information, e.g. that has an optimal strategy, given by the solution of the Bellman equation, in the context of Ising models. We call these agents kobolds, in contrast to Maxwell's demons which do not necessarily need to satisfy detailed balance. This is in stark contrast with typical Monte Carlo algorithms, which choose an action at random at each time step. It is thus natural to compare the behavior of these kobolds to a Metropolis algorithm. For various Ising models, we study numerically and analytically the properties of the optimal strategies, showing that there is a transition in the behavior of the kobold as a function of the parameter characterizing its strategy. 
The Bellman equation and optimal local flipping strategies for kinetic   Ising models