all paths to a goal are found, later choose optimal