  The COVID-19 crisis highlighted the importance of non-medical interventions,
such as testing and isolation of infected individuals, in the control of
epidemics. Here, we show how to minimize testing needs while maintaining the
number of infected individuals below a desired threshold. We find that the
optimal policy is adaptive, with testing rates that depend on the epidemic
state. Additionally, we show that such epidemic state is difficult to infer
with molecular tests alone, which are highly sensitive but have a short
detectability window. Instead, we propose the use of baseline serology testing,
which is less sensitive but detects past infections, for the purpose of state
estimation. Validation of such combined testing approach with a stochastic
model of epidemics shows significant cost savings compared to non-adaptive
testing strategies that are the current standard for COVID-19.
