  Calculations of topological observables in lattice gauge theories with
traditional Monte Carlo algorithms have long been known to be a difficult task,
owing to the effects of long autocorrelations times. Several mitigation
strategies have been put forward, including the use of open boundary conditions
and methods such as parallel tempering. In this contribution we examine a new
approach based on out-of-equilibrium Monte Carlo simulations. Starting from
thermalized configurations with open boundary conditions on a line defect,
periodic boundary conditions are gradually switched on. A sampling of
topological observables is then shown to be possible with a specific
reweighting-like technique inspired by Jarzynski's equality. We discuss the
efficiency of this approach using results obtained for the 2-dimensional
$\mathrm{CP}^{N-1}$ models. Furthermore, we outline the implementation of our
proposal in the context of Stochastic Normalizing Flows, as they share the same
theoretical framework of the non-equilibrium transformations we perform, and
can be thought of as their generalization.
