Skip to content
Snippets Groups Projects
Commit e92869b6 authored by François Bobot's avatar François Bobot
Browse files

[Choice] Fix successive add_to_group and simplify

parent 9cd12de5
No related branches found
No related tags found
1 merge request!28Fix some heuristics
...@@ -31,7 +31,10 @@ type t = { ...@@ -31,7 +31,10 @@ type t = {
and choosable = and choosable =
| Choosable | Choosable
| Init | Init
| Wait of { choices : Egraph.choice list; groups : t list } | Wait of {
choices : Egraph.choice list;
terms_added_to_group : Nodes.ThTerm.t list;
}
let pp_choosable fmt = function let pp_choosable fmt = function
| Choosable -> Fmt.pf fmt "!" | Choosable -> Fmt.pf fmt "!"
...@@ -45,24 +48,30 @@ let register_decision d thterm choice = ...@@ -45,24 +48,30 @@ let register_decision d thterm choice =
match HThTerm.find state d thterm with match HThTerm.find state d thterm with
| Choosable -> Egraph.register_decision d choice | Choosable -> Egraph.register_decision d choice
| Init -> | Init ->
(* HThTerm.set state d thterm (Wait { choices = [ choice ]; groups = [] }) *) (* Some terms are not correctly attached, so currently with consider this case as choosable *)
HThTerm.set state d thterm Choosable; if false then
Egraph.register_decision d choice HThTerm.set state d thterm
(Wait { choices = [ choice ]; terms_added_to_group = [] })
else (
HThTerm.set state d thterm Choosable;
Egraph.register_decision d choice)
| Wait l -> | Wait l ->
HThTerm.set state d thterm HThTerm.set state d thterm
(Wait { choices = choice :: l.choices; groups = l.groups }) (Wait
{
choices = choice :: l.choices;
terms_added_to_group = l.terms_added_to_group;
})
let empty_wait = Wait { choices = []; terms_added_to_group = [] }
let add_to_group d thterm group = let add_to_group d thterm group =
let add_group () = Context.Queue.enqueue group.terms thterm in
match HThTerm.find state d thterm with match HThTerm.find state d thterm with
| Choosable -> () | Choosable -> ()
| Init -> | Init ->
HThTerm.set state d thterm (Wait { choices = []; groups = [ group ] }); Context.Queue.enqueue group.terms thterm;
add_group () HThTerm.set state d thterm empty_wait
| Wait l -> | Wait _ -> Context.Queue.enqueue group.terms thterm
add_group ();
HThTerm.set state d thterm
(Wait { choices = l.choices; groups = group :: l.groups })
let create d = let create d =
(* Fmt.epr "Create_to_group@."; *) (* Fmt.epr "Create_to_group@."; *)
...@@ -71,7 +80,7 @@ let create d = ...@@ -71,7 +80,7 @@ let create d =
terms = Context.Queue.create (Egraph.context d); terms = Context.Queue.create (Egraph.context d);
} }
let make_choosable d thterm = let rec make_choosable d thterm =
match HThTerm.find state d thterm with match HThTerm.find state d thterm with
| Choosable -> () | Choosable -> ()
| Init -> HThTerm.set state d thterm Choosable | Init -> HThTerm.set state d thterm Choosable
...@@ -79,7 +88,8 @@ let make_choosable d thterm = ...@@ -79,7 +88,8 @@ let make_choosable d thterm =
if not (List.is_empty l.choices) then if not (List.is_empty l.choices) then
Debug.dprintf2 debug "activate choice for %a" Nodes.ThTerm.pp thterm; Debug.dprintf2 debug "activate choice for %a" Nodes.ThTerm.pp thterm;
HThTerm.set state d thterm Choosable; HThTerm.set state d thterm Choosable;
List.iter l.choices ~f:(Egraph.register_decision d) List.iter l.choices ~f:(Egraph.register_decision d);
List.iter l.terms_added_to_group ~f:(make_choosable d)
let activate d t = let activate d t =
(* Fmt.epr "Activate group@."; *) (* Fmt.epr "Activate group@."; *)
...@@ -88,17 +98,22 @@ let activate d t = ...@@ -88,17 +98,22 @@ let activate d t =
Context.Queue.iter (make_choosable d) t.terms) Context.Queue.iter (make_choosable d) t.terms)
let add_to_group_of d thterm thterm' = let add_to_group_of d thterm thterm' =
let add_group groups choices = let add_group () =
match HThTerm.find state d thterm' with match HThTerm.find state d thterm' with
| Choosable -> make_choosable d thterm | Choosable -> make_choosable d thterm
| Init -> () | Init ->
| Wait { groups = groups'; _ } -> HThTerm.set state d thterm'
List.iter groups' ~f:(fun group -> (Wait { terms_added_to_group = [ thterm ]; choices = [] })
Context.Queue.enqueue group.terms thterm); | Wait l ->
HThTerm.set state d thterm (Wait { choices; groups = groups' @ groups }) HThTerm.set state d thterm'
(Wait
{
terms_added_to_group = thterm :: l.terms_added_to_group;
choices = l.choices;
})
in in
match HThTerm.find state d thterm with match HThTerm.find state d thterm with
| Choosable -> () | Choosable -> ()
| Init -> add_group [] [] | Init -> add_group ()
| Wait l -> add_group l.groups l.choices | Wait _ -> add_group ()
...@@ -62,6 +62,9 @@ ...@@ -62,6 +62,9 @@
--dont-print-result %{dep:wp_initialize.psmt2})) (package colibri2)) --dont-print-result %{dep:wp_initialize.psmt2})) (package colibri2))
(rule (alias runtest-learning) (action (run %{bin:colibri2} --size=50M --time=60s --max-steps 3500 --check-status unsat --learning --dont-print-result %{dep:wp_initialize.psmt2})) (package colibri2)) (rule (alias runtest-learning) (action (run %{bin:colibri2} --size=50M --time=60s --max-steps 3500 --check-status unsat --learning --dont-print-result %{dep:wp_initialize.psmt2})) (package colibri2))
(rule (alias runtest) (action (run %{bin:colibri2} --size=50M --time=60s --max-steps 3500 --check-status unsat (rule (alias runtest) (action (run %{bin:colibri2} --size=50M --time=60s --max-steps 3500 --check-status unsat
--dont-print-result %{dep:wp_sharing_f_ensures.psmt2})) (package colibri2))
(rule (alias runtest-learning) (action (run %{bin:colibri2} --size=50M --time=60s --max-steps 3500 --check-status unsat --learning --dont-print-result %{dep:wp_sharing_f_ensures.psmt2})) (package colibri2))
(rule (alias runtest) (action (run %{bin:colibri2} --size=50M --time=60s --max-steps 3500 --check-status unsat
--dont-print-result %{dep:wp_simpl_is_type_f_ensures.psmt2})) (package colibri2)) --dont-print-result %{dep:wp_simpl_is_type_f_ensures.psmt2})) (package colibri2))
(rule (alias runtest-learning) (action (run %{bin:colibri2} --size=50M --time=60s --max-steps 3500 --check-status unsat --learning --dont-print-result %{dep:wp_simpl_is_type_f_ensures.psmt2})) (package colibri2)) (rule (alias runtest-learning) (action (run %{bin:colibri2} --size=50M --time=60s --max-steps 3500 --check-status unsat --learning --dont-print-result %{dep:wp_simpl_is_type_f_ensures.psmt2})) (package colibri2))
(rule (alias runtest) (action (run %{bin:colibri2} --size=50M --time=60s --max-steps 3500 --check-status unsat (rule (alias runtest) (action (run %{bin:colibri2} --size=50M --time=60s --max-steps 3500 --check-status unsat
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment