New planning algorithm before testing