A generic optimization framework for resilient systems. (4th March 2023)