X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Feval.ml;h=22a3b5f483cdff0c0e7bc3140c8d8a2dbfce703c;hp=e8e1d5af195fb7f1a072e7e4dd2e564815391a09;hb=556c8805fcfd27f485bdd63cd704e4df7eac8a06;hpb=f71defc62c481fe8a3a161d904790f3ca117a8cb diff --git a/src/eval.ml b/src/eval.ml index e8e1d5a..22a3b5f 100644 --- a/src/eval.ml +++ b/src/eval.ml @@ -14,7 +14,7 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) INCLUDE "utils.ml" @@ -36,18 +36,21 @@ END let html tree node i config msg = let config = config.Ata.Config.node in - Html.trace (T.preorder tree node) i - "%s
sat: %a
unsat: %a
todo: %a
" + let oldi = config.Ata.round in + Html.trace (T.preorder tree node) i oldi + "%s
sat: %a
unsat: %a
todo: %around: %i
" msg StateSet.print config.Ata.sat StateSet.print config.Ata.unsat - (Ata.TransList.print ~sep:"
") config.Ata.todo + (Ata.TransList.print ~sep:"
") config.Ata.todo oldi type cache = StateSet.t Cache.N1.t let get c t n = Cache.N1.find c (T.preorder t n) - let set c t n v = Cache.N1.add c (T.preorder t n) v + let set c t n v i = + v.Ata.Config.node.Ata.round <- i; + Cache.N1.add c (T.preorder t n) v let top_down_run auto tree node cache _i = @@ -62,7 +65,8 @@ END let c = get cache tree node in if c == Cache.N1.dummy cache then Ata.Config.make - { c.Ata.Config.node with Ata.todo = Ata.get_trans auto tag auto.Ata.states; + { c.Ata.Config.node with + Ata.todo = Ata.get_trans auto tag auto.Ata.states; summary = Ata.node_summary (node == T.first_child tree parent) (* is_left *) (node == T.next_sibling tree parent) (* is_right *) @@ -82,20 +86,20 @@ END TRACE(html tree node _i config1 "Updating transitions"); - if config0 != config1 then set cache tree node config1; + if config0 != config1 then set cache tree node config1 _i; let () = loop fc in let fcs1 = get cache tree fc in let config2 = Ata.eval_trans auto fcs1 nss ps config1 in TRACE(html tree node _i config2 "Updating transitions (after first-child)"); - if config1 != config2 then set cache tree node config2; + if config1 != config2 then set cache tree node config2 _i; let () = loop ns in let config3 = Ata.eval_trans auto fcs1 (get cache tree ns) ps config2 in TRACE(html tree node _i config3 "Updating transitions (after next-sibling)"); - if config2 != config3 then set cache tree node config3; + if config2 != config3 then set cache tree node config3 _i; (* We do set the redo flat if : *) if not ( config0 == config3 (* did not gain any new information *) @@ -114,10 +118,10 @@ END let acc0 = loop (T.next_sibling tree node) acc in let acc1 = loop (T.first_child tree node) acc0 in - if StateSet.intersect (get cache tree node).Ata.Config.node.Ata.sat auto.Ata.selection_states then - node::acc1 - else - acc1 + if StateSet.intersect + (get cache tree node).Ata.Config.node.Ata.sat + auto.Ata.selection_states then node::acc1 + else acc1 in loop node [] @@ -127,6 +131,7 @@ END Ata.unsat = StateSet.empty; Ata.todo = Ata.TransList.nil; Ata.summary = Ata.dummy_summary; + Ata.round = ~-1; }) in let redo = ref true in @@ -134,11 +139,11 @@ END Ata.reset auto; while !redo do redo := false; - Ata.reset auto; + Ata.reset auto; (* prevents the .cache2 and .cache4 memoization tables from growing too much *) redo := top_down_run auto tree node cache !iter; incr iter; done; - at_exit (fun () -> eprintf "INFO: %i iterations\n" !iter); + at_exit (fun () -> eprintf "@[STATS: %i iterations@]@." !iter); let r = get_results auto tree node cache in TRACE(Html.gen_trace (module T : Tree.S with type t = T.t) (tree)); r