Skip to content

Commit 42e801b

Browse files
author
Jérôme FERET
committed
make parallel bond / site across bond domains preprocessig incremental
1 parent 7c0807f commit 42e801b

18 files changed

Lines changed: 1066 additions & 1761 deletions

core/KaSa_rep/more_datastructures/map_wrapper.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ module type Set_with_logs = sig
7878
val equal : t -> t -> bool
7979
val subset : t -> t -> bool
8080
val iter : (elt -> unit) -> t -> unit
81-
val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a
81+
val fold : ?start:elt -> (elt -> 'a -> 'a) -> t -> 'a -> 'a
8282
val fold_inv : (elt -> 'a -> 'a) -> t -> 'a -> 'a
8383
val elements : t -> elt list
8484
val choose : t -> elt option
@@ -354,7 +354,7 @@ module type Map_with_logs = sig
354354
'b t ->
355355
Exception.exceptions_caught_and_uncaught
356356

357-
val fold : (elt -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
357+
val fold : ?start:elt -> (elt -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
358358
val mapi : (elt -> 'a -> 'b) -> 'a t -> 'b t
359359
val map : ('a -> 'b) -> 'a t -> 'b t
360360

core/KaSa_rep/more_datastructures/map_wrapper.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ module type Set_with_logs = sig
7878
val equal : t -> t -> bool
7979
val subset : t -> t -> bool
8080
val iter : (elt -> unit) -> t -> unit
81-
val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a
81+
val fold : ?start:elt -> (elt -> 'a -> 'a) -> t -> 'a -> 'a
8282
val fold_inv : (elt -> 'a -> 'a) -> t -> 'a -> 'a
8383
val elements : t -> elt list
8484
val choose : t -> elt option
@@ -354,7 +354,7 @@ module type Map_with_logs = sig
354354
'b t ->
355355
Exception.exceptions_caught_and_uncaught
356356

357-
val fold : (elt -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
357+
val fold : ?start:elt -> (elt -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
358358
val mapi : (elt -> 'a -> 'b) -> 'a t -> 'b t
359359
val map : ('a -> 'b) -> 'a t -> 'b t
360360

core/KaSa_rep/reachability_analysis/agents_domain.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,9 @@ module Domain = struct
415415
in
416416
error, static, dynamic, modified_agents, []
417417

418-
let complete_wake_up_relation ?patch _static error wake_up =
419-
let _ = patch in
420-
error, wake_up
418+
let complete_wake_up_relation ?patch _static error wake_up =
419+
let _ = patch in
420+
error, wake_up
421421

422422
(***************************************************************************)
423423
(*JF: Here, you should add in the event list, each rule that test for an

core/KaSa_rep/reachability_analysis/bdu_static_views.ml

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,15 @@ type bdu_analysis_static = {
5353
(Ckappa_sig.Views_bdu.mvbdu * Ckappa_sig.Views_bdu.hconsed_association_list)
5454
Covering_classes_type.AgentSiteCV_setmap.Map.t
5555
Ckappa_sig.Rule_setmap.Map.t;
56-
store_patch_proj_bdu_potential_restriction_map:
57-
(Ckappa_sig.Views_bdu.mvbdu * Ckappa_sig.Views_bdu.hconsed_association_list)
56+
store_patch_proj_bdu_potential_restriction_map:
57+
(Ckappa_sig.Views_bdu.mvbdu * Ckappa_sig.Views_bdu.hconsed_association_list)
5858
Covering_classes_type.AgentSiteCV_setmap.Map.t
5959
Ckappa_sig.Rule_setmap.Map.t;
6060
store_proj_bdu_test_restriction:
6161
Ckappa_sig.Views_bdu.mvbdu Covering_classes_type.AgentsCV_setmap.Map.t
6262
Ckappa_sig.Rule_setmap.Map.t;
63-
store_patch_proj_bdu_test_restriction: Ckappa_sig.Views_bdu.mvbdu Covering_classes_type.AgentsCV_setmap.Map.t
63+
store_patch_proj_bdu_test_restriction:
64+
Ckappa_sig.Views_bdu.mvbdu Covering_classes_type.AgentsCV_setmap.Map.t
6465
Ckappa_sig.Rule_setmap.Map.t;
6566
site_to_renamed_site_list:
6667
(Covering_classes_type.cv_id * Ckappa_sig.c_mvbdu_var) list
@@ -92,7 +93,7 @@ let init_bdu_analysis_static parameters error =
9293
store_patch_proj_bdu_test_restriction = Ckappa_sig.Rule_setmap.Map.empty;
9394
store_patch_proj_bdu_potential_restriction_map =
9495
Ckappa_sig.Rule_setmap.Map.empty;
95-
site_to_renamed_site_list = init_site_to_renamed_site_list;
96+
site_to_renamed_site_list = init_site_to_renamed_site_list;
9697
}
9798
in
9899
error, init_bdu_analysis_static
@@ -670,9 +671,8 @@ let collect_site_to_renamed_site_list parameters error store_remanent_triple
670671
(**************************************************************************)
671672
(*projection with rule_id*)
672673

673-
let collect_proj_bdu_potential_restriction_map
674-
~patch_store_remanent_triple parameters bdu_handler error
675-
store_potential_side_effects guard_mvbdus =
674+
let collect_proj_bdu_potential_restriction_map ~patch_store_remanent_triple
675+
parameters bdu_handler error store_potential_side_effects guard_mvbdus =
676676
let store_init_bdu_potential_restriction_map =
677677
Covering_classes_type.AgentSiteRuleCV_setmap.Map.empty
678678
in
@@ -871,8 +871,8 @@ let collect_bdu_test_restriction_map ?start_cv ~new_rule ~modified_agents
871871

872872
let collect_proj_bdu_test_restriction ?start_cv ~new_rule ~modified_agents
873873
parameters handler_kappa error rule_id rule
874-
(*store_new_index_pair_map*) store_remanent_triple (store_result, patch_store_result)
875-
store_guard_bdu =
874+
(*store_new_index_pair_map*) store_remanent_triple
875+
(store_result, patch_store_result) store_guard_bdu =
876876
let store_init_bdu_test_restriction_map =
877877
Covering_classes_type.AgentsRuleCV_setmap.Map.empty
878878
in
@@ -903,7 +903,7 @@ let collect_proj_bdu_test_restriction ?start_cv ~new_rule ~modified_agents
903903
Ckappa_sig.Rule_setmap.Map.fold Ckappa_sig.Rule_setmap.Map.add store_result'
904904
store_result
905905
in
906-
let patch_store_result =
906+
let patch_store_result =
907907
Ckappa_sig.Rule_setmap.Map.fold Ckappa_sig.Rule_setmap.Map.add store_result'
908908
patch_store_result
909909
in
@@ -939,12 +939,14 @@ let scan_rule_static ?start_cv ~new_rule ~modified_agents parameters log_info
939939
store_result.store_patch_modif_list_restriction_map )
940940
in
941941
(*------------------------------------------------------------------------*)
942-
let (error, handler_bdu), (store_proj_bdu_test_restriction, store_patch_proj_bdu_test_restriction) =
942+
let ( (error, handler_bdu),
943+
(store_proj_bdu_test_restriction, store_patch_proj_bdu_test_restriction)
944+
) =
943945
collect_proj_bdu_test_restriction ?start_cv ~new_rule ~modified_agents
944946
parameters handler_bdu error rule_id rule store_remanent_triple
945-
(store_result.store_proj_bdu_test_restriction,
946-
store_result.store_patch_proj_bdu_test_restriction)
947-
guard_mvbdus
947+
( store_result.store_proj_bdu_test_restriction,
948+
store_result.store_patch_proj_bdu_test_restriction )
949+
guard_mvbdus
948950
in
949951
(*------------------------------------------------------------------------*)
950952
let error, log_info =
@@ -960,7 +962,7 @@ let scan_rule_static ?start_cv ~new_rule ~modified_agents parameters log_info
960962
store_proj_bdu_creation_restriction_map;
961963
store_modif_list_restriction_map;
962964
store_patch_modif_list_restriction_map;
963-
store_patch_proj_bdu_test_restriction;
965+
store_patch_proj_bdu_test_restriction;
964966
store_proj_bdu_test_restriction;
965967
} )
966968

@@ -978,14 +980,11 @@ let scan_rule_set ?start ?start_cv ~patch_store_remanent_triple ~modified_agents
978980
parameters log_info handler_bdu error handler_kappa compiled
979981
store_potential_side_effects store_remanent_triple guard_mvbdus init =
980982
let nsites = Handler.get_nsites handler_kappa in
981-
let (error, handler_bdu), store_patch_proj_bdu_potential_restriction_map =
982-
collect_proj_bdu_potential_restriction_map
983-
~patch_store_remanent_triple parameters handler_bdu error
984-
store_potential_side_effects
985-
guard_mvbdus
983+
let (error, handler_bdu), store_patch_proj_bdu_potential_restriction_map =
984+
collect_proj_bdu_potential_restriction_map ~patch_store_remanent_triple
985+
parameters handler_bdu error store_potential_side_effects guard_mvbdus
986986
in
987-
let init = { init with
988-
store_patch_proj_bdu_potential_restriction_map} in
987+
let init = { init with store_patch_proj_bdu_potential_restriction_map } in
989988

990989
let error, (handler_bdu, log_info, store_results) =
991990
Ckappa_sig.Rule_nearly_Inf_Int_storage_Imperatif.fold_two_steps ?start

core/KaSa_rep/reachability_analysis/counters_domain.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,16 @@ functor
195195
these tuples, and apply the function Common_static.add_dependency_site_rule
196196
to update the wake_up relation *)
197197
let complete_wake_up_relation ?patch static error wake_up =
198-
let start =
199-
match patch with
200-
| None -> Ckappa_sig.rule_id_of_int 0
201-
| Some a -> a.Diff.next_rule
202-
in
198+
let start =
199+
match patch with
200+
| None -> Ckappa_sig.rule_id_of_int 0
201+
| Some a -> a.Diff.next_rule
202+
in
203203
let parameters = get_parameter static in
204204
let rule_restriction = get_rule_restriction static in
205205
let packs = get_packs static in
206-
Ckappa_sig.Rule_id_quick_nearly_Inf_Int_storage_Imperatif.fold ~start parameters
207-
error
206+
Ckappa_sig.Rule_id_quick_nearly_Inf_Int_storage_Imperatif.fold ~start
207+
parameters error
208208
(fun parameters error rule_id agent_map wake_up ->
209209
let error, rule = get_rule parameters error static rule_id in
210210
match rule with

core/KaSa_rep/reachability_analysis/dynamic_contact_map_domain.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ module Domain = struct
147147
modified_agents,
148148
[] )
149149

150-
let complete_wake_up_relation ?patch _static error wake_up = let _ = patch in
151-
error, wake_up
150+
let complete_wake_up_relation ?patch _static error wake_up =
151+
let _ = patch in
152+
error, wake_up
152153

153154
(**************************************************************************)
154155

core/KaSa_rep/reachability_analysis/parallel_bonds.ml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,9 @@ module Domain = struct
521521
in
522522
error, static, dynamic, modified_agents, []
523523

524-
let add_rules_tuples_into_wake_up_relation parameters error rule_tuples
524+
let add_rules_tuples_into_wake_up_relation ?start parameters error rule_tuples
525525
wake_up =
526-
Ckappa_sig.Rule_map_and_set.Map.fold
526+
Ckappa_sig.Rule_map_and_set.Map.fold ?start
527527
(fun rule_id map (error, wake_up) ->
528528
Parallel_bonds_type.PairAgentsSiteState_map_and_set.Map.fold
529529
(fun _ list (error, wake_up) ->
@@ -552,9 +552,9 @@ module Domain = struct
552552
map (error, wake_up))
553553
rule_tuples (error, wake_up)
554554

555-
let add_rules_tuples_into_wake_up_relation' parameters error store_map wake_up
556-
=
557-
Ckappa_sig.Rule_map_and_set.Map.fold
555+
let add_rules_tuples_into_wake_up_relation' ?start parameters error store_map
556+
wake_up =
557+
Ckappa_sig.Rule_map_and_set.Map.fold ?start
558558
(fun rule_id map (error, wake_up) ->
559559
Parallel_bonds_type.PairAgentsSitesStates_map_and_set.Map.fold
560560
(fun ( _,
@@ -585,7 +585,11 @@ module Domain = struct
585585
these tuples, and apply the function Common_static.add_dependency_site_rule
586586
to update the wake_up relation *)
587587
let complete_wake_up_relation ?patch static error wake_up =
588-
let _ = patch in
588+
let start =
589+
match patch with
590+
| None -> None
591+
| Some a -> Some a.Diff.next_rule
592+
in
589593
let parameters = get_parameter static in
590594
(*fst site created a parallel bonds*)
591595
(* TO DO make this incremental *)
@@ -600,21 +604,21 @@ module Domain = struct
600604
in
601605
(*----------------------------------------------------*)
602606
let error, wake_up =
603-
add_rules_tuples_into_wake_up_relation' parameters error
607+
add_rules_tuples_into_wake_up_relation' ?start parameters error
604608
store_rule_double_bonds_rhs wake_up
605609
in
606610
let error, wake_up =
607-
add_rules_tuples_into_wake_up_relation' parameters error
611+
add_rules_tuples_into_wake_up_relation' ?start parameters error
608612
store_rule_double_bonds_lhs wake_up
609613
in
610614
(*----------------------------------------------------*)
611615
let error, wake_up =
612-
add_rules_tuples_into_wake_up_relation parameters error
616+
add_rules_tuples_into_wake_up_relation ?start parameters error
613617
store_fst_site_create_parallel_bonds_rhs wake_up
614618
in
615619
(*----------------------------------------------------*)
616620
let error, wake_up =
617-
add_rules_tuples_into_wake_up_relation parameters error
621+
add_rules_tuples_into_wake_up_relation ?start parameters error
618622
store_snd_site_create_parallel_bonds_rhs wake_up
619623
in
620624
error, wake_up

core/KaSa_rep/reachability_analysis/product.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ module Product
102102

103103
let complete_wake_up_relation ?patch static error wake_up =
104104
let error, wake_up =
105-
Underlying_domain.complete_wake_up_relation ?patch static.underlying_domain error
106-
wake_up
105+
Underlying_domain.complete_wake_up_relation ?patch
106+
static.underlying_domain error wake_up
107107
in
108108
New_domain.complete_wake_up_relation ?patch static.new_domain error wake_up
109109

core/KaSa_rep/reachability_analysis/rules_domain.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ module Domain = struct
248248
modified_agents,
249249
[] )
250250

251-
let complete_wake_up_relation ?patch _static error wake_up =
252-
let _ = patch in
253-
error, wake_up
251+
let complete_wake_up_relation ?patch _static error wake_up =
252+
let _ = patch in
253+
error, wake_up
254254

255255
let add_initial_state ~new_init ?patch ?modified_agents _static dynamic error
256256
_species =

core/KaSa_rep/reachability_analysis/side_effects_domain.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ module Domain = struct
143143
modified_agents,
144144
[] )
145145

146-
let complete_wake_up_relation ?patch _static error wake_up =
147-
let _ = patch in error, wake_up
146+
let complete_wake_up_relation ?patch _static error wake_up =
147+
let _ = patch in
148+
error, wake_up
148149

149150
let add_initial_state ~new_init ?patch ?modified_agents _static dynamic error
150151
_species =

0 commit comments

Comments
 (0)