COMPUTER-IMPLEMENTED METHOD AND APPARATUS FOR PLANNING A PATH OR TRAJECTORY OF AN AGENT