Bilevel Optimization In Learning And Control With Applications To Network Flow Estimation