Constrained Control and Observer Design by Inverse Optimality