A Learning Based Approach for Planning with Safe Actions