Skip to content
Snippets Groups Projects
Commit 26e21f07 authored by Thorsten Wißmann's avatar Thorsten Wißmann :guitar:
Browse files

Add coalition list printing

parent ca99d0c6
No related branches found
No related tags found
No related merge requests found
...@@ -68,8 +68,26 @@ let maxDisjoints sort (a: bset) : bset list = ...@@ -68,8 +68,26 @@ let maxDisjoints sort (a: bset) : bset list =
let tmpf : bset -> int -> bset = let tmpf : bset -> int -> bset =
(fun bs f -> bsetAdd bs (lfFromInt f) ; bs) (fun bs f -> bsetAdd bs (lfFromInt f) ; bs)
in in
List.map (List.fold_left tmpf (bsetMake ())) List.map (List.fold_left tmpf (bsetMakeRealEmpty ()))
(List.map S.elements intlist) (List.map S.elements intlist)
let string_of_coalition sort bs =
let modlist = bsetFold (fun x l -> x::l) bs [] in
let show modality =
let (o,c) = (* open/close brackets *)
match lfGetType sort modality with
| EnforcesF -> ("[","]")
| AllowsF -> ("{","}")
| _ -> ("¿","?")
in
let agents = (Array.to_list (lfGetDestAg sort modality)) in
let agents = List.map string_of_int agents in
o^(String.concat ", " agents)^c
in
let modlist = List.map show modlist in
"{ " ^ (String.concat ", " modlist) ^ " }"
let string_of_coalition_list sort bs_list =
String.concat "\n" (List.map (string_of_coalition sort) bs_list)
...@@ -10,6 +10,8 @@ open CoolUtils ...@@ -10,6 +10,8 @@ open CoolUtils
val disjointAgents : sort -> localFormula -> localFormula -> bool val disjointAgents : sort -> localFormula -> localFormula -> bool
val maxDisjoints : sort -> bset -> bset list val maxDisjoints : sort -> bset -> bset list
val string_of_coalition : sort -> bset -> string
val string_of_coalition_list : sort -> bset list -> string
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment