- Bitvector.unsafe_set unstable node_id unstable_self;
- TRACE((if not unstable_self then
- Html.finalize_node
- node_id
- _i
- Ata.(StateSet.intersect config3.Config.node.sat auto.selection_states)));
- unstable_self
- end
- in
- run.redo <- loop (T.root tree);
- run.pass <- run.pass + 1
-
-(*
- let stats run =
- let count = ref 0 in
- let len = Bitvector.length run.unstable in
- for i = 0 to len - 1 do
- if not (Bitvector.unsafe_get run.unstable i) then
- incr count
- done;
- Logger.msg `STATS
- "%i nodes over %i were skipped in iteration %i (%.2f %%), redo is: %b"
- !count len run.pass (100. *. (float !count /. float len))
- run.redo
-
-
- let eval auto tree node =
- let len = T.size tree in
- let run = { config = Array.create len Ata.dummy_config;
- unstable = Bitvector.create ~init:true len;
- redo = true;
- pass = 0
- }
- in
- while run.redo do
- run.redo <- false;
- Ata.reset auto; (* prevents the .cache2 and .cache4 memoization tables from growing too much *)
- run.redo <- top_down_run auto tree node run;
- stats run;
- run.pass <- run.pass + 1;
- done;
- at_exit (fun () -> Logger.msg `STATS "%i iterations" run.pass);
- at_exit (fun () -> stats run);
- let r = get_results auto tree node run.config in
-
- TRACE(Html.gen_trace (module T : Tree.S with type t = T.t) (tree));
-
- r
-*)
-
- let get_results run =
- let cache = run.status in
- let auto = run.auto in
- let tree = run.tree in
- let rec loop node acc =
- if node == T.nil then acc
- else
- let acc0 = loop (T.next_sibling tree node) acc in
- let acc1 = loop (T.first_child tree node) acc0 in
-
- if Ata.(
- StateSet.intersect
- cache.(T.preorder tree node).NodeStatus.node.sat
- (get_selecting_states auto)) then node::acc1
- else acc1
+ 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 run 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