compute direction plan