Multiple interval methods for ODEs with an optimization constraint