//undoes the last literal decision and the corresponding implications obtained by unit resolution // //if the current decision level is L in the beginning of the call, it should be updated //to L-1 before the call ends void sat_undo_decide_literal(SatState* sat_state) { Lit* lit = vector_top(&sat_state->ds); sat_restore_literal(sat_state, lit); vector_pop(&sat_state->ds); vector_pop(&sat_state->s); sat_undo_unit_resolution(sat_state); }
//undoes the last literal decision and the corresponding implications obtained by unit resolution // //if the current decision level is L in the beginning of the call, it should be updated //to L-1 before the call ends void sat_undo_decide_literal(SatState* sat_state) { c2dSize sz = sat_state->num_decided_literals; while (sz > 0 && sat_state->decided_literals[sz - 1]->decision_level == sat_state->cur_level) { undo_instantiate_literal(sat_state->decided_literals[sz - 1]); --sz; } sat_state->num_decided_literals = sz; sat_undo_unit_resolution(sat_state); --sat_state->cur_level; }
NnfManager* compile_vtree(VtreeManager* manager, SatState* sat_state) { NNF_NODE node; Clause* learned_clause = NULL; DVtree* vtree = manager->vtree; NnfManager* nnf_manager = nnf_manager_new(sat_state,UNIQUE_TABLE_CAPACITY); if(sat_unit_resolution(sat_state)) { //unit resolution succeeded compile_dispatcher(&node,&learned_clause,vtree,manager,nnf_manager,sat_state); if(learned_clause!=NULL) node = ZERO_NNF_NODE; //cnf is inconsistent } else node = ZERO_NNF_NODE; //cnf is inconsistent sat_undo_unit_resolution(sat_state); nnf_manager_set_root(node,nnf_manager); return nnf_manager; }