Commit 113699a6 authored by Simon Prucker's avatar Simon Prucker
Browse files

GML multimodal with bugs

parent 2748d4df
Pipeline #14897 waiting for manual action with stages
...@@ -589,38 +589,53 @@ let rec oneStepGMLRec counters sort v currentU = ...@@ -589,38 +589,53 @@ let rec oneStepGMLRec counters sort v currentU =
then false then false
else else
let filterUnsatDiamond lf = let filterUnsatDiamond lf =
((lfGetType sort lf = MoreThanF) && ((lfGetDestNum sort lf) >= (Hashtbl.find counters lf))) in ((lfGetType sort lf = MoreThanF) && ((lfGetDestNum sort lf) >= (Hashtbl.find counters lf))) in
let filteredV = bsetFilter v filterUnsatDiamond in let filteredV = bsetFilter v filterUnsatDiamond in
if (bsetIsSubOrEqual filteredV (bsetMake())) then true if (bsetIsSubOrEqual filteredV (bsetMake())) then true
else else
let filterCoreLabels bset = let neededRels =
let neededRelsDuplicates = bsetMap (lfGetDest3 sort) filteredV in
let elimDups result elem =
if List.mem elem result
then result
else elem :: result
in
Array.fold_left elimDups [] neededRelsDuplicates in
let filteredVsForRels =
List.map (fun rel -> (rel, (bsetFilter filteredV (fun lf -> (lfGetDest3 sort lf) = rel)))) neededRels in
let filterCoreLabels filteredV bset =
bsetExists filteredV (fun lf -> bsetMem bset (lfGetDest1 sort lf)) in bsetExists filteredV (fun lf -> bsetMem bset (lfGetDest1 sort lf)) in
let filteredU = List.filter filterCoreLabels currentU in let filteredUsForRels = List.map (fun (rel, filteredV) -> (rel, List.filter (filterCoreLabels filteredV) currentU)) filteredVsForRels in
if filteredU = [] then false if List.exists (fun (rel, l) -> l = []) filteredUsForRels then false
else else
let u = List.hd filteredU in let handleRel satisfiable (rel, filteredU) =
let updateCountersAdd lf = if satisfiable = false then false else
let modalArg = lfGetDest1 sort lf in let u = List.hd filteredU in
let newVal = (Hashtbl.find counters lf) + 1 in let updateCountersAdd lf =
match lfGetType sort lf with let modalArg = lfGetDest1 sort lf in
| MoreThanF -> if bsetMem u modalArg then Hashtbl.add counters lf newVal let newVal = (Hashtbl.find counters lf) + 1 in
| MaxExceptF -> if not (bsetMem u modalArg) then Hashtbl.add counters lf newVal match lfGetType sort lf with
| _ -> () | MoreThanF -> bsetMem u modalArg then Hashtbl.add counters lf newVal
in | MaxExceptF -> not (bsetMem u modalArg) then Hashtbl.add counters lf newVal
let updateCountersRem lf = | _ -> ()
let modalArg = lfGetDest1 sort lf in in
match lfGetType sort lf with let updateCountersRem lf =
| MoreThanF -> if bsetMem u modalArg then Hashtbl.remove counters lf let modalArg = lfGetDest1 sort lf in
| MaxExceptF -> if not (bsetMem u modalArg) then Hashtbl.remove counters lf match lfGetType sort lf with
| _ -> () | MoreThanF -> bsetMem u modalArg then Hashtbl.remove counters lf
| MaxExceptF -> not (bsetMem u modalArg) then Hashtbl.remove counters lf
| _ -> ()
in
let fitleredV = (List.assoc rel filteredVsForRels) in
bsetIter updateCountersAdd filteredV;
if ((oneStepGMLRec counters sort filteredV filteredU)) then true
else begin
bsetIter updateCountersRem filteredV;
if (oneStepGMLRec counters sort filteredV (List.tl filteredU)) then true
else false
end
in in
bsetIter updateCountersAdd v; List.fold_left handleRel true filteredUsForRels
if ((oneStepGMLRec counters sort v filteredU)) then true
else begin
bsetIter updateCountersRem v;
if (oneStepGMLRec counters sort v (List.tl filteredU)) then true
else false
end
let rec oneStepGMLRec2 currentA sort v u = let rec oneStepGMLRec2 currentA sort v u =
let boxLimitReached lf = let boxLimitReached lf =
...@@ -660,6 +675,8 @@ let oneStepSat_GML u sv = ...@@ -660,6 +675,8 @@ let oneStepSat_GML u sv =
let counters = Hashtbl.create (bsetLen v) in let counters = Hashtbl.create (bsetLen v) in
bsetIter (fun lf -> Hashtbl.add counters lf 0) v; bsetIter (fun lf -> Hashtbl.add counters lf 0) v;
oneStepGMLRec counters sort v u oneStepGMLRec counters sort v u
let implementationLookup = [ (MultiModalK, These (mkRule_MultiModalK, oneStepSat_MultiModalK)) let implementationLookup = [ (MultiModalK, These (mkRule_MultiModalK, oneStepSat_MultiModalK))
......
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