Added selection of closest shelf with enough resources by minimum distance =)