Gravar-mail: Memory and Fitness Optimization of Bacteria under Fluctuating Environments