Commit 26e21f07 authored by Thorsten Wißmann's avatar Thorsten Wißmann 🐧
Browse files

Add coalition list printing

parent ca99d0c6
......@@ -68,8 +68,26 @@ let maxDisjoints sort (a: bset) : bset list =
let tmpf : bset -> int -> bset =
(fun bs f -> bsetAdd bs (lfFromInt f) ; bs)
in
List.map (List.fold_left tmpf (bsetMake ()))
List.map (List.fold_left tmpf (bsetMakeRealEmpty ()))
(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
val disjointAgents : sort -> localFormula -> localFormula -> bool
val maxDisjoints : sort -> bset -> bset list
val string_of_coalition : sort -> bset -> string
val string_of_coalition_list : sort -> bset list -> string
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment