path finding optimize