Optimal design of statically determinate beams for given deflection