Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Count steps for constraint propagation #1012

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/reasoners/bitv_rel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ end = struct
acc

let propagate { repr; ex } dom =
Steps.incr CP;
match repr.repr with
| Band (x, y, z) ->
let dx = Domains.get x dom
Expand Down
20 changes: 15 additions & 5 deletions src/lib/util/steps.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type incr_kind =
| Omega (* Arith : number of omega procedure on Real and Int *)
| Uf (* UF step increment *)
| Ac (* AC step reasoning *)
| CP (* Constraint propagation *)
| Th_assumed of int (* Increment the counter for each term assumed in the
theories environment *)

Expand All @@ -49,18 +50,20 @@ let mult_s = ref 0
let mult_uf = ref 0
let mult_b = ref 0
let mult_a = ref 0
let mult_cp = ref 0

let all_steps = Stack.create ()

let push_steps () =
Stack.push
(!naive_steps,!steps,!mult_f,!mult_m,
!mult_s,!mult_uf,!mult_b,!mult_a)
!mult_s,!mult_uf,!mult_b,!mult_a,!mult_cp)
all_steps

let pop_steps () =
let p_naive_steps,p_steps, p_mult_f, p_mult_m,
p_mult_s, p_mult_uf, p_mult_b, p_mult_a =
p_mult_s, p_mult_uf, p_mult_b, p_mult_a,
p_mult_cp =
Stack.pop all_steps in
naive_steps := p_naive_steps;
steps := p_steps;
Expand All @@ -69,7 +72,8 @@ let pop_steps () =
mult_s := p_mult_s;
mult_uf := p_mult_uf;
mult_b := p_mult_b;
mult_a := p_mult_a
mult_a := p_mult_a;
mult_cp := p_mult_cp

(* Multipliers are here to homogeneize the global step counter *)
let incr k =
Expand Down Expand Up @@ -99,6 +103,10 @@ let incr k =
if !mult_f = 40 then
(steps := !steps + 1;
mult_f := 0);
| CP -> mult_cp := !mult_cp + 1;
if !mult_cp = 100 then
(steps := !steps + 1;
mult_cp := 0);
| Th_assumed n ->
(* Since n refers to the number of terms sent to the theories no
* multiplier is needed here *)
Expand Down Expand Up @@ -127,7 +135,8 @@ let reset_steps () =
mult_s := 0;
mult_uf := 0;
mult_b := 0;
mult_a := 0
mult_a := 0;
mult_cp := 0

let save_steps, reinit_steps =
let saved_mult_uf = ref 0 in
Expand All @@ -144,7 +153,8 @@ let save_steps, reinit_steps =
mult_s := 0;
mult_uf := !saved_mult_uf;
mult_b := 0;
mult_a := 0
mult_a := 0;
mult_cp := 0
in
save_steps, reinit_steps

Expand Down
1 change: 1 addition & 0 deletions src/lib/util/steps.mli
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type incr_kind =
| Omega (** Arith : number of omega procedure on Real and Int *)
| Uf (** UF step increment *)
| Ac (** AC step reasoning *)
| CP (** Constraint propagation *)
| Th_assumed of int (** Increment the counter for each term assumed in the
theories environment *)
(** Define the type of increment *)
Expand Down
Loading