let wr, mr = weight_of_term r in
weight_of_polynomial (wl+wr) (ml@mr)
;;
+
+let compute_goal_weight (_,l, _, _) =
+ let weight_of_polynomial w m =
+ let factor = 2 in
+ w + factor * List.fold_left (fun acc (_,occ) -> acc+occ) 0 m
+ in
+ match l with
+ | Terms.Predicate t ->
+ let w, m = weight_of_term t in
+ weight_of_polynomial w m
+ | Terms.Equation (l,r,_,_) ->
+ let wl, ml = weight_of_term l in
+ let wr, mr = weight_of_term r in
+ let wl = weight_of_polynomial wl ml in
+ let wr = weight_of_polynomial wr mr in
+ - (abs (wl-wr))
+ ;;
(* Riazanov: 3.1.5 pag 38 *)
(* Compare weights normalized in a new way :
WeightPassiveSet.add cl passives_w, AgePassiveSet.add cl passives_a
;;
+ let add_passive_goal ?(no_weight=false) (passives_w,passives_a) g =
+ let g = if no_weight then (0,g)
+ else Utils.mk_passive_goal g in
+ WeightPassiveSet.add g passives_w, AgePassiveSet.add g passives_a
+ ;;
+
let remove_passive_clause (passives_w,passives_a) cl =
let passives_w = WeightPassiveSet.remove cl passives_w in
let passives_a = AgePassiveSet.remove cl passives_a in
AgePassiveSet.union new_clauses_a passives_a)
;;
+ let add_passive_goals ?(no_weight=false)
+ (passives_w,passives_a) new_clauses =
+ let new_clauses_w,new_clauses_a =
+ List.fold_left (add_passive_goal ~no_weight)
+ (WeightPassiveSet.empty,AgePassiveSet.empty) new_clauses
+ in
+ (WeightPassiveSet.union new_clauses_w passives_w,
+ AgePassiveSet.union new_clauses_a passives_a)
+ ;;
+
let is_passive_set_empty (passives_w,passives_a) =
if (WeightPassiveSet.is_empty passives_w) then begin
assert (AgePassiveSet.is_empty passives_a); true
in
debug "Performed infer_left step";
bag, maxvar, actives, passives, g_current::g_actives,
- (add_passive_clauses g_passives new_goals)
+ (add_passive_goals g_passives new_goals)
;;
let forward_infer_step bag maxvar actives passives g_actives
in
bag, maxvar, actives,
add_passive_clauses passives new_clauses, g_actives,
- add_passive_clauses g_passives new_goals
+ add_passive_goals g_passives new_goals
;;
let rec given_clause ~noinfer
add_passive_clauses ~no_weight:true passive_empty_set passives
in
let g_passives =
- add_passive_clauses ~no_weight:true passive_empty_set g_passives
+ add_passive_goals ~no_weight:true passive_empty_set g_passives
in
let g_actives = [] in
let actives = [], IDX.DT.empty in