Optimal management and design of hydraulic systems