Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Evidence
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eric Wurbel
Evidence
Commits
5ed1b07f
Commit
5ed1b07f
authored
2 years ago
by
Eric Würbel
Browse files
Options
Downloads
Patches
Plain Diff
work in progress. Does not run (and probably not compile either).
parent
670f2ce1
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
asp.pl
+1
-1
1 addition, 1 deletion
asp.pl
evidence.pl
+16
-4
16 additions, 4 deletions
evidence.pl
formula_io.pl
+9
-5
9 additions, 5 deletions
formula_io.pl
wbel.pl
+22
-7
22 additions, 7 deletions
wbel.pl
with
48 additions
and
17 deletions
asp.pl
+
1
−
1
View file @
5ed1b07f
This diff is collapsed.
Click to expand it.
evidence.pl
+
16
−
4
View file @
5ed1b07f
...
...
@@ -21,6 +21,10 @@
% Compute the basic belief assignments of subsets of B in collection
% Bis.
%
% The resulting BBAs is a list of triplets (BaseLabel, Set, Mass)
% where BaseLabel is a label denoting the Set (subbases are labeled
% with an integer starting from 1, the full base is labeled with 0).
%
% Uses rational arithmetic.
%
% We use the is/2 predicate instead of the more practical #=/2 from
...
...
@@ -32,14 +36,14 @@ basic_bbas(B, Bis, BBAs, Opts) :-
%! basic_bba2(+B, +CardB, +Bis, -BBAs) is det
%
% Utility predica
d
e for basic_bbas/3.
% Utility predica
t
e for basic_bbas/3.
basic_bba2
(
_
,
_
,
[],
[],
_
).
basic_bba2
(
B
,
CardB
,
[
Bi
|
Bis
],
[[(
Bi
,
BBABi
),
(
B
,
BBAB
)]|
BBAs
],
Opts
)
:-
basic_bba2
(
B
,
CardB
,
[
N
/
Bi
|
Bis
],
[[(
[
N
],
Bi
,
BBABi
),
(
[
0
],
B
,
BBAB
)]|
BBAs
],
Opts
)
:-
length
(
Bi
,
CardBi
),
BBABi
is
CardBi
/
CardB
,
BBAB
is
1
-
BBABi
,
trace_bba
(
Bi
,
Bi
,
BBABi
,
Opts
,
1
),
trace_bba
(
Bi
,
B
,
BBAB
,
Opts
,
1
),
trace_bba
(
N
/
Bi
,
N
/
Bi
,
BBABi
,
Opts
,
1
),
trace_bba
(
N
/
Bi
,
0
/
B
,
BBAB
,
Opts
,
1
),
basic_bba2
(
B
,
CardB
,
Bis
,
BBAs
,
Opts
).
%! trace_bba(+RefSet, +Set, +Value, +Options, +TraceLevel) is det
...
...
@@ -144,6 +148,14 @@ global_bba(B, Bis, GBBA, Opts) :-
basic_bbas
(
B
,
Bis
,
[
B1
|
BasicBBAs
],
Opts
),
global_bba2
(
B1
,
BasicBBAs
,
GBBA
,
Opts
).
%! global_bba2(+BBa, +BBas, GBBA, Opts)
%
% Each BBa is a triplet (BaseLabel, Set, Mass)
% where Base Label is a label denoting the Set (subbases are labeled
% with an integer starting from 1, the full base is labeled with 0).
%
% TODO: continue : modify combine/4, merge_unique/2 and normalize/2
% to account for the new representation of BBas (couples -> triples)
global_bba2
(
B
,
[],
B
,
_
).
global_bba2
(
B
,
[
BBa
|
BBas
],
GBBA
,
Opts
)
:-
trace
(
'---- combining ~w & ~w -----------------------------~n'
,
[
B
,
BBa
],
Opts
,
2
),
...
...
This diff is collapsed.
Click to expand it.
formula_io.pl
+
9
−
5
View file @
5ed1b07f
...
...
@@ -89,13 +89,17 @@ ldraw(Stream, B, Bis) :-
member
(
collec
(
Bisr
),
Terms
),
is_list
(
Bisr
),
maplist
(
is_list
,
Bisr
),
check_bis
(
B
,
Bisr
,
Bis
).
check_bis
(
B
,
Bisr
,
Bis
,
1
).
check_bis
(
_
,
[],
[]).
check_bis
(
B
,
[
Bir
|
Bisr
],
[
Bi
|
Bis
])
:-
check_bis
(
_
,
[],
[]
,
_
).
check_bis
(
B
,
[
Bir
|
Bisr
],
[
N
/
Bi
|
Bis
]
,
N
)
:-
list_to_ord_set
(
Bir
,
Bi
),
% strict inclusion
ord_subset
(
Bi
,
B
),
\
+
ord_seteq
(
Bi
,
B
),
check_bis
(
B
,
Bisr
,
Bis
).
N1
#=
N
+
1
,
check_bis
(
B
,
Bisr
,
Bis
,
N1
).
This diff is collapsed.
Click to expand it.
wbel.pl
+
22
−
7
View file @
5ed1b07f
...
...
@@ -71,6 +71,11 @@ go :-
;
full_evidence_computation
(
Opts
,
PosArgs
)
).
%! full_evidence_computation(+Opts, +PosArgs)
%
% Computes and prints the credibility of each subset of B which is
% maximal-consistent with mu.
full_evidence_computation
(
Opts
,
PosArgs
)
:-
[
BFile
,
MuFile
]
=
PosArgs
,
nb_setval
(
clasppath
,
'/home/wurbel/local/anaconda3/envs/potassco/bin/clingo'
),
...
...
@@ -83,7 +88,7 @@ full_evidence_computation(Opts, PosArgs) :-
load_sof
(
MuFile
,
Mu
),
generate
(
B
,
Mu
,
TmpFile
,
Assoc
),
run
([
TmpFile
],
[
'--heuristic=Domain'
,
'--enum-mode=domRec'
],
ASPResults
),
collect_results
(
ASPResults
,
WinclResults
),
collect_results
(
ASPResults
,
WinclResults
,
1
),
(
memberchk
(
inclusion
(
true
),
Opts
)
->
print_wincl
(
WinclResults
,
Assoc
)
;
true
...
...
@@ -97,6 +102,10 @@ full_evidence_computation(_, PosArgs) :-
[
_
,
_
]
\
=
PosArgs
,
error
(
"Bad number of positional args"
).
%! raw_evidence_computation(+Opts, +Args)
%
% Computes and prints the credibility of a collection of subsets.
raw_evidence_computation
(
Opts
,
PosArgs
)
:-
% hack
set_prolog_flag
(
prefer_rationals
,
true
),
...
...
@@ -127,6 +136,8 @@ test_wbel(Args) :-
catch
(
opt_parse
(
Spec
,
Args
,
Opts
,
PosArgs
),
Err
,
error_syn
(
'~w~n'
,
[
Err
],
Spec
)),
memberchk
(
asp
(
V
),
Opts
),
nb_setval
(
aspdump
,
V
),
memberchk
(
prog
(
Prog
),
Opts
),
nb_setval
(
prog
,
Prog
),
(
memberchk
(
raw
(
true
),
Opts
)
->
(
memberchk
(
inclusion
(
true
),
Opts
)
->
error
(
"incompatible options -r and -i"
)
...
...
@@ -189,13 +200,17 @@ generate_b1(N, CountDown, [T|L], Func) :-
%! collect_results(+ASPRes, -WinclRes)
%
% collect ASP answer sets
collect_results
([],
[])
:-
!.
collect_results
([
as
(
L
)|
L1
],
[
SL
|
L2
])
:-
% Each answer set represent subbase of B which is maximaly consistent
% with mu. Number each base, that is, the results is a list of
% i/List terms.
collect_results
([],
[],
_
)
:-
!.
collect_results
([
as
(
L
)|
L1
],
[
N
/
SL
|
L2
],
N
)
:-
!,
list_to_ord_set
(
L
,
SL
),
collect_results
(
L1
,
L2
).
collect_results
([
_
|
L1
],
L2
)
:-
collect_results
(
L1
,
L2
).
N1
#=
N
+
1
,
collect_results
(
L1
,
L2
,
N1
).
collect_results
([
_
|
L1
],
L2
,
N
)
:-
collect_results
(
L1
,
L2
,
N
).
%! generate(+B, +Mu, +TmpFile, -Assoc) is det
%
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment