A decentralized closed-loop solution to the routing problem in networks