- if status1 == StateSet.empty && status0 != StateSet.empty
- then StateSet.empty else
- (* update the cache if the status of the node changed
- unsafe_set run.sat node_id status1 status0;*)
- if bu_todo == StateSet.empty then begin
- unsafe_set run.sat node_id status1 status0; (* write the td_states *)
- update_res false status1 node;
- let _ = loop_td_and_bu fc node status1 in
- loop_td_and_bu ns node status1 (* tail call *)
- end else
- let fcs1, nss1 =
- if last_run then
- let nss1 = loop_td_and_bu ns node status1 in
- let fcs1 = loop_td_and_bu fc node status1 in
- fcs1, nss1
- else
- let fcs1 = loop_td_and_bu fc node status1 in
- let nss1 = loop_td_and_bu ns node status1 in
- fcs1, nss1
- in
- let status2 =
- eval_trans auto run.fetch_trans_cache run.bu_cache tag
- summary fcs1
- nss1
- parent_sat
- status1 bu_todo
- in
- unsafe_set run.sat node_id status2 status0;
- if last_run && status2 != StateSet.empty then update_res true status2 node;
- status2
- end
+ kont summary tag parent_sat status0 status1 fc ns node node_id
+ end
+
+ and kont_pure_td summary tag parent_sat status0 status1 fc ns node node_id =
+ unsafe_set run_sat node_id status1 status0; (* write the td_states *)
+ update_res false status1 node;
+ if fc != Tree.nil then ignore (loop_td fc node status1);
+ if ns == Tree.nil then StateSet.empty else loop_td ns node status1 (* tail call *)
+ and kont_td_and_bu summary tag parent_sat status0 status1 fc ns node node_id =
+ let fcs1 = if fc == Tree.nil then StateSet.empty else loop_td_and_bu fc node status1 in
+ let nss1 = if ns == Tree.nil then StateSet.empty else loop_td_and_bu ns node status1 in
+ let status2 =
+ eval_trans run run.bu_cache tag
+ summary fcs1
+ nss1
+ parent_sat
+ status1 bu_todo
+ in
+ unsafe_set run_sat node_id status2 status0;
+ status2
+ and kont_td_and_bu_last summary tag parent_sat status0 status1 fc ns node node_id =
+ let nss1 = if ns == Tree.nil then StateSet.empty else loop_td_and_bu_last ns node status1 in
+ let fcs1 = if fc == Tree.nil then StateSet.empty else loop_td_and_bu_last fc node status1 in
+ let status2 =
+ eval_trans run run.bu_cache tag
+ summary fcs1
+ nss1
+ parent_sat
+ status1 bu_todo
+ in
+ unsafe_set run_sat node_id status2 status0;
+ if status2 != StateSet.empty then update_res true status2 node;
+ status2
+ and loop_td node parent parent_sat =
+ common node parent parent_sat kont_pure_td
+ and loop_td_and_bu node parent parent_sat =
+ common node parent parent_sat kont_td_and_bu
+ and loop_td_and_bu_last node parent parent_sat =
+ common node parent parent_sat kont_td_and_bu_last
+ in
+
+ let _ =
+ if bu_todo == StateSet.empty then
+ loop_td (Tree.root tree) Tree.nil dummy_set
+ else if last_run then
+ loop_td_and_bu_last (Tree.root tree) Tree.nil dummy_set
+ else
+ loop_td_and_bu (Tree.root tree) Tree.nil dummy_set
+ in
+ run.pass <- run.pass + 2;
+ run.stats.pass <- run.stats.pass + 1;
+ run.stats.nodes_per_run <- !num_visited :: run.stats.nodes_per_run
+
+
+ type res_op = Dummy | Prepend | Append | Nothing
+
+ let mk_update_result auto =
+ let sel_states = Ata.get_selecting_states auto in
+ let res = ResultSet.create () in
+ let cache = Cache.N2.create Dummy in
+ (fun prepend sat node ->
+ let sat_id = (sat.StateSet.id :> int) in
+ let prep_id : int = Obj.magic prepend in
+ let op = Cache.N2.find cache prep_id sat_id in
+ let op =
+ if op == Dummy then
+ let op =
+ if StateSet.intersect sel_states sat then
+ if prepend then
+ Prepend
+ else Append
+ else Nothing
+ in
+ let () = Cache.N2.add cache prep_id sat_id op in
+ op
+ else op
+ in
+ match op with
+ Dummy | Nothing -> ()
+ | Prepend -> ResultSet.push_front node res
+ | Append -> ResultSet.push_back node res
+ (*
+ if StateSet.intersect sel_states sat then begin
+ if prepend then L.push_front node res else
+ L.push_back node res
+ end*)),
+ (fun () -> res)
+
+
+ let mk_update_full_result auto =
+ let dummy = ResultSet.create () in
+ let res_mapper = Cache.N1.create dummy in
+ let () =
+ StateSet.iter
+ (fun q -> Cache.N1.add res_mapper (q :> int) (ResultSet.create()))
+ (Ata.get_selecting_states auto)