update package locations to a subdir packages
This commit is contained in:
7
packages/cplint/examples/alarm.cpl
Normal file
7
packages/cplint/examples/alarm.cpl
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
burg(t):0.1; burg(f):0.9.
|
||||
earthq(t):0.2; earthq(f):0.8.
|
||||
alarm(t):-burg(t),earthq(t).
|
||||
alarm(t):0.8 ; alarm(f):0.2:-burg(t),earthq(f).
|
||||
alarm(t):0.8 ; alarm(f):0.2:-burg(f),earthq(t).
|
||||
alarm(t):0.1 ; alarm(f):0.9:-burg(f),earthq(f).
|
17
packages/cplint/examples/coin.cpl
Normal file
17
packages/cplint/examples/coin.cpl
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
s([heads(C)],P).
|
||||
C = coin
|
||||
P = 0.51 ?;
|
||||
no
|
||||
s([tails(C)],P).
|
||||
C = coin
|
||||
P = 0.49 ?;
|
||||
no
|
||||
|
||||
|
||||
*/
|
||||
|
||||
heads(Coin): 1/2; tails(Coin) : 1/2:-toss(Coin),\+biased(Coin).
|
||||
heads(Coin): 0.6 ; tails(Coin) : 0.4:-toss(Coin),biased(Coin).
|
||||
fair(Coin):0.9 ; biased(Coin):0.1.
|
||||
toss(coin).
|
0
packages/cplint/examples/coin.uni
Normal file
0
packages/cplint/examples/coin.uni
Normal file
23
packages/cplint/examples/coin2.cpl
Normal file
23
packages/cplint/examples/coin2.cpl
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
?- s([heads(C)],P).
|
||||
C = coin1
|
||||
P = 0.51 ? ;
|
||||
C = coin2
|
||||
P = 0.51 ? ;
|
||||
no
|
||||
?- s([tails(C)],P).
|
||||
C = coin1
|
||||
P = 0.49 ? ;
|
||||
C = coin2
|
||||
P = 0.49 ? ;
|
||||
no
|
||||
|
||||
s([tails(coin1)],P).
|
||||
P = 0.49 ?
|
||||
*/
|
||||
|
||||
heads(Coin): 0.5; tails(Coin) : 0.5:-toss(Coin),fair(Coin).
|
||||
heads(Coin): 0.6 ; tails(Coin) : 0.4:-toss(Coin),biased(Coin).
|
||||
fair(Coin):0.9 ; biased(Coin):0.1.
|
||||
toss(coin1).
|
||||
toss(coin2).
|
9
packages/cplint/examples/coin2.uni
Normal file
9
packages/cplint/examples/coin2.uni
Normal file
@@ -0,0 +1,9 @@
|
||||
universe(['Coin'],[coin1,coin2]).
|
||||
|
||||
mode(heads(coin)).
|
||||
mode(tails(coin)).
|
||||
mode(toss(coin)).
|
||||
mode(fair(coin)).
|
||||
mode(biased(coin)).
|
||||
|
||||
type(coin,[coin1,coin2]).
|
29
packages/cplint/examples/dice.cpl
Normal file
29
packages/cplint/examples/dice.cpl
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
s([on(0,1)],P).
|
||||
P = 0.166666666666667 ?;
|
||||
s([\+ on(0,6)],P).
|
||||
P = 0.833333333333333 ?;
|
||||
|
||||
|
||||
s([on(1,1)],P).
|
||||
P = 0.138888888888889 ?
|
||||
s([on(1,6)],P).
|
||||
P = 0.138888888888889 ?
|
||||
s([on(2,1)],P).
|
||||
out of memory
|
||||
s([on(0,1),on(1,1)],P).
|
||||
P = 0.0277777777777778 ?
|
||||
s([on(0,1),on(1,1),on(2,1)],P).
|
||||
P = 0.00462962962962963 ?
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
on(0,1):1/6;on(0,2):1/6;on(0,3):1/6;
|
||||
on(0,4):1/6;on(0,5):1/6;on(0,6):1/6.
|
||||
|
||||
on(X,1):1/6;on(X,2):1/6;on(X,3):1/6;
|
||||
on(X,4):1/6;on(X,5):1/6;on(X,6):1/6:-
|
||||
X1 is X-1,X1>=0,on(X1,_),
|
||||
\+ on(X1,6).
|
2
packages/cplint/examples/dice.uni
Normal file
2
packages/cplint/examples/dice.uni
Normal file
@@ -0,0 +1,2 @@
|
||||
universe(['X'],[1,2]).
|
||||
universe(['X1'],[0,1]).
|
13
packages/cplint/examples/ex.cpl
Normal file
13
packages/cplint/examples/ex.cpl
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
s([a],P).
|
||||
Variables: [(1,[]),(2,[]),(3,[])]
|
||||
P = 0.226 ?
|
||||
*/
|
||||
|
||||
a:0.1.
|
||||
|
||||
|
||||
|
||||
b:0.3;c:0.6.
|
||||
|
||||
a:0.2:- \+ b.
|
6
packages/cplint/examples/ex.uni
Normal file
6
packages/cplint/examples/ex.uni
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
mode(a).
|
||||
|
||||
mode(b).
|
||||
|
||||
mode(c).
|
17
packages/cplint/examples/exapprox.cpl
Normal file
17
packages/cplint/examples/exapprox.cpl
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
|
||||
set(ground_body,true).
|
||||
s([a],P).
|
||||
Variables: [(1,[]),(2,[]),(3,[])]
|
||||
P = 0.1719 ? ;
|
||||
|
||||
set(ground_body,false).
|
||||
?- s([a],P).
|
||||
P = 0.099 ?
|
||||
*/
|
||||
|
||||
a:0.1:-p(X).
|
||||
|
||||
p(1):0.9.
|
||||
|
||||
p(2):0.9.
|
9
packages/cplint/examples/exapprox.uni
Normal file
9
packages/cplint/examples/exapprox.uni
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
universe(['X'],[1,2]).
|
||||
|
||||
|
||||
mode(a).
|
||||
|
||||
mode(p(int)).
|
||||
|
||||
type(int,[1,2]).
|
32
packages/cplint/examples/exist.cpl
Normal file
32
packages/cplint/examples/exist.cpl
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
semlpad.pl
|
||||
ground_body(false)
|
||||
?- s([a],P).
|
||||
P = 0.18 ?
|
||||
|
||||
ground_body(true)
|
||||
?- s([a],P).
|
||||
P = 0.19 ?
|
||||
yes
|
||||
|
||||
|
||||
yes
|
||||
lpad.pl
|
||||
ground_body(false)
|
||||
?- s([a],P).
|
||||
P = 0.02 ?
|
||||
yes
|
||||
ground_body(true)
|
||||
?- s([a],P).
|
||||
P = 0.19 ?
|
||||
yes
|
||||
|
||||
*/
|
||||
|
||||
a:0.5 :- p(X).
|
||||
|
||||
p(X):0.2 :- c(X).
|
||||
|
||||
c(1).
|
||||
|
||||
c(2).
|
8
packages/cplint/examples/exist.uni
Normal file
8
packages/cplint/examples/exist.uni
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
mode(a).
|
||||
|
||||
mode(p(int)).
|
||||
|
||||
mode(c(int)).
|
||||
|
||||
type(int,[1,2]).
|
31
packages/cplint/examples/exist1.cpl
Normal file
31
packages/cplint/examples/exist1.cpl
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
semlpad.pl
|
||||
ground_body(false)
|
||||
?- s([a],P).
|
||||
P = 0.276 ?
|
||||
|
||||
ground_body(true)
|
||||
?- s([a],P).
|
||||
P = 0.3115 ?
|
||||
|
||||
|
||||
yes
|
||||
lpad.pl
|
||||
ground_body(false)
|
||||
?- s([a],P).
|
||||
P = 0.276 ?
|
||||
|
||||
ground_body(true)
|
||||
?- s([a],P).
|
||||
P = 0.3115 ?
|
||||
*/
|
||||
|
||||
a:0.5 :- p(X).
|
||||
|
||||
p(3):0.3.
|
||||
|
||||
p(X):0.2 :- c(X).
|
||||
|
||||
c(1).
|
||||
|
||||
c(2).
|
10
packages/cplint/examples/exist1.uni
Normal file
10
packages/cplint/examples/exist1.uni
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
mode(a).
|
||||
|
||||
mode(p(int)).
|
||||
|
||||
mode(c(int)).
|
||||
|
||||
type(int,[1,2,3]).
|
||||
|
||||
|
21
packages/cplint/examples/exrange.cpl
Normal file
21
packages/cplint/examples/exrange.cpl
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
s([a(X)],P).
|
||||
Variables: [(1,[]),(5,[]),(2,[]),(6,[])]
|
||||
P = 0.2775
|
||||
X = 1 ? ;
|
||||
Variables: [(3,[]),(5,[]),(4,[]),(6,[])]
|
||||
P = 0.36
|
||||
X = 2 ? ;
|
||||
*/
|
||||
|
||||
a(1):0.3:-p(1).
|
||||
|
||||
a(1):0.3:-p(2).
|
||||
|
||||
a(2):0.4:-p(1).
|
||||
|
||||
a(2):0.4:-p(2).
|
||||
|
||||
p(1):0.5.
|
||||
|
||||
p(2):0.5.
|
6
packages/cplint/examples/exrange.uni
Normal file
6
packages/cplint/examples/exrange.uni
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
mode(a(int)).
|
||||
|
||||
mode(p(int)).
|
||||
|
||||
type(int,[1,2]).
|
26
packages/cplint/examples/female.cpl
Normal file
26
packages/cplint/examples/female.cpl
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
s([female(f)],P).
|
||||
P = 0.6 ?
|
||||
s([male(f)],P).
|
||||
P = 0.4 ?
|
||||
|
||||
*/
|
||||
|
||||
|
||||
male(C):M/P;female(C):F/P:-
|
||||
person(C),
|
||||
setof(Male,known_male(Male),LM),
|
||||
length(LM,M),
|
||||
setof(Female,known_female(Female),LF),
|
||||
length(LF,F),
|
||||
P is F+M.
|
||||
|
||||
|
||||
person(f).
|
||||
|
||||
known_female(a).
|
||||
known_female(b).
|
||||
known_female(c).
|
||||
|
||||
known_male(d).
|
||||
known_male(e).
|
27
packages/cplint/examples/hiv.cpl
Normal file
27
packages/cplint/examples/hiv.cpl
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
?- s([hiv(a)],P).
|
||||
P = 0.154 ?
|
||||
yes
|
||||
?- s([hiv(b)],P).
|
||||
P = 0.154 ?
|
||||
yes
|
||||
?- s([hiv(b),hiv(a)],P).
|
||||
P = 0.118 ?
|
||||
yes
|
||||
?- s([\+ hiv(b),\+ hiv(a)],P).
|
||||
P = 0.81 ?
|
||||
yes
|
||||
?- s([ hiv(b),\+ hiv(a)],P).
|
||||
P = 0.036 ?
|
||||
yes
|
||||
?- s([\+ hiv(b),hiv(a)],P).
|
||||
P = 0.036 ?
|
||||
yes
|
||||
*/
|
||||
|
||||
(hiv(a) : 0.1).
|
||||
(hiv(b) : 0.1).
|
||||
(hiv(a) : 0.6) :- hiv(b).
|
||||
(hiv(b) : 0.6) :- hiv(a).
|
||||
hiv(a) :- hiv(a).
|
||||
hiv(b) :- hiv(b).
|
4
packages/cplint/examples/hiv.uni
Normal file
4
packages/cplint/examples/hiv.uni
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
mode(hiv(person)).
|
||||
|
||||
type(person,[a,b]).
|
15
packages/cplint/examples/invalid.cpl
Normal file
15
packages/cplint/examples/invalid.cpl
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
?- s([p],P).
|
||||
P = 0.5 ?
|
||||
yes
|
||||
?- s([q],P).
|
||||
P = 0.5 ?
|
||||
yes
|
||||
?- s([p,q],P).
|
||||
P = 0 ?
|
||||
yes
|
||||
*/
|
||||
|
||||
p : 0.5;q : 0.5:- r.
|
||||
r :- \+ p.
|
||||
r :- \+ q.
|
7
packages/cplint/examples/invalid.uni
Normal file
7
packages/cplint/examples/invalid.uni
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
mode(p).
|
||||
|
||||
mode(r).
|
||||
|
||||
mode(q).
|
26
packages/cplint/examples/light.cpl
Normal file
26
packages/cplint/examples/light.cpl
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
?- p(light).
|
||||
yes
|
||||
?- s([push,replace],P).
|
||||
P = 0.5 ?
|
||||
yes
|
||||
?- s([push,light],P).
|
||||
P = 0.5 ?
|
||||
yes
|
||||
?- s([push,light,replace],P).
|
||||
P = 0 ?
|
||||
yes
|
||||
?- s([light,replace],P).
|
||||
P = 0 ?
|
||||
yes
|
||||
?- s([light],P).
|
||||
P = 0.5 ?
|
||||
yes
|
||||
?- s([replace],P).
|
||||
P = 0.5 ?
|
||||
yes
|
||||
*/
|
||||
|
||||
push.
|
||||
light : 0.5 :- push.
|
||||
replace :- \+ light.
|
4
packages/cplint/examples/light.uni
Normal file
4
packages/cplint/examples/light.uni
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
mode(push).
|
||||
mode(light).
|
||||
mode(replace).
|
38
packages/cplint/examples/mendel.cpl
Normal file
38
packages/cplint/examples/mendel.cpl
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
this file can not be used with s.pl: it generates too many programs
|
||||
s([cg(s,1,p)],P).
|
||||
P = 0.75 ?
|
||||
s([cg(s,1,w)],P).
|
||||
P = 0.25 ?
|
||||
s([cg(s,2,p)],P).
|
||||
P = 0.25 ?
|
||||
s([cg(s,2,w)],P).
|
||||
P = 0.75 ?
|
||||
s([cg(f,2,w)],P).
|
||||
P = 0.5
|
||||
s([cg(s,2,w)],P).
|
||||
P = 0.75
|
||||
|
||||
*/
|
||||
|
||||
mother(m,s).
|
||||
mother(mm,m).
|
||||
mother(mf,f).
|
||||
father(f,s).
|
||||
father(fm,m).
|
||||
father(ff,f).
|
||||
|
||||
|
||||
cg(mm,1,p).
|
||||
cg(mm,2,w).
|
||||
cg(fm,1,p).
|
||||
cg(fm,2,p).
|
||||
cg(mf,1,w).
|
||||
cg(mf,2,w).
|
||||
cg(ff,1,w).
|
||||
cg(ff,2,p).
|
||||
|
||||
|
||||
cg(X,1,A):0.5 ; cg(X,1,B):0.5 :- mother(Y,X),cg(Y,1,A) , cg(Y,2,B).
|
||||
|
||||
cg(X,2,A):0.5 ; cg(X,2,B):0.5 :- father(Y,X),cg(Y,1,A) , cg(Y,2,B).
|
13
packages/cplint/examples/mendel.uni
Normal file
13
packages/cplint/examples/mendel.uni
Normal file
@@ -0,0 +1,13 @@
|
||||
mode(mother(person,person)).
|
||||
mode(father(person,person)).
|
||||
mode(cg(person,chr,allele)).
|
||||
|
||||
type(person,[s,m,f,mm,fm,mf,ff]).
|
||||
|
||||
type(chr,[1,2]).
|
||||
|
||||
type(allele,[p,w]).
|
||||
|
||||
universe(['X'],[s,m,f]).
|
||||
|
||||
universe(['A','B'],[p,w]).
|
30
packages/cplint/examples/mendels.cpl
Normal file
30
packages/cplint/examples/mendels.cpl
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
this file can not be used with s.pl: it generates too many programs
|
||||
s([cg(s,1,p)],P).
|
||||
P = 0.75 ?
|
||||
s([cg(s,1,w)],P).
|
||||
P = 0.25 ?
|
||||
s([cg(s,2,p)],P).
|
||||
P = 0.25 ?
|
||||
s([cg(s,2,w)],P).
|
||||
P = 0.75 ?
|
||||
s([cg(f,2,w)],P).
|
||||
P = 0.5
|
||||
s([cg(s,2,w)],P).
|
||||
P = 0.75
|
||||
|
||||
*/
|
||||
|
||||
mother(m,s).
|
||||
father(f,s).
|
||||
|
||||
|
||||
cg(m,1,p).
|
||||
cg(m,2,w).
|
||||
cg(f,1,p).
|
||||
cg(f,2,p).
|
||||
|
||||
|
||||
cg(X,1,A):0.5 ; cg(X,1,B):0.5 :- mother(Y,X),cg(Y,1,A) , cg(Y,2,B).
|
||||
|
||||
cg(X,2,A):0.5 ; cg(X,2,B):0.5 :- father(Y,X),cg(Y,1,A) , cg(Y,2,B).
|
13
packages/cplint/examples/mendels.uni
Normal file
13
packages/cplint/examples/mendels.uni
Normal file
@@ -0,0 +1,13 @@
|
||||
mode(mother(person,person)).
|
||||
mode(father(person,person)).
|
||||
mode(cg(person,chr,allele)).
|
||||
|
||||
type(person,[s,m,f]).
|
||||
|
||||
type(chr,[1,2]).
|
||||
|
||||
type(allele,[p,w]).
|
||||
|
||||
universe(['X'],[s]).
|
||||
|
||||
universe(['A','B'],[p,w]).
|
51
packages/cplint/examples/paper_ref.cpl
Normal file
51
packages/cplint/examples/paper_ref.cpl
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
|
||||
?- s([cites_cited(c1,Pap)],P).
|
||||
P = 0.181333333333333,
|
||||
Pap = p1 ? ;
|
||||
P = 0.181333333333333,
|
||||
Pap = p2 ? ;
|
||||
P = 0.228,
|
||||
Pap = p3 ? ;
|
||||
P = 0.181333333333333,
|
||||
Pap = p4 ? ;
|
||||
P = 0.228,
|
||||
Pap = p5 ? ;
|
||||
no
|
||||
|
||||
*/
|
||||
paper(p1).
|
||||
|
||||
paper(p2).
|
||||
|
||||
paper(p3).
|
||||
|
||||
paper(p4).
|
||||
|
||||
paper(p5).
|
||||
|
||||
paper_topic(p1,theory).
|
||||
|
||||
paper_topic(p2,theory).
|
||||
|
||||
paper_topic(p4,theory).
|
||||
|
||||
paper_topic(p3,ai).
|
||||
|
||||
paper_topic(p5,ai).
|
||||
|
||||
cites(c1).
|
||||
|
||||
|
||||
uniform(cites_citing(C,P),P,L):-
|
||||
setof(Pap,paper(Pap),L).
|
||||
|
||||
cites_cited_group(C,theory):0.9;cites_cited_group(C,ai):0.1:-
|
||||
cites_citing(C,P),paper_topic(P,theory).
|
||||
|
||||
cites_cited_group(C,theory):0.01;cites_cited_group(C,ai):0.99:-
|
||||
cites_citing(C,P),paper_topic(P,ai).
|
||||
|
||||
uniform(cites_cited(C,P),P,L):-
|
||||
cites_cited_group(C,T),bagof(Pap,paper_topic(Pap,T),L).
|
||||
|
41
packages/cplint/examples/paper_ref_not.cpl
Normal file
41
packages/cplint/examples/paper_ref_not.cpl
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
s([\+ cites_cited(c1,p1)],P).
|
||||
P = 0.7 ?
|
||||
|
||||
s([cites_citing(c1,p1)],P).
|
||||
P = 0.14 ?
|
||||
|
||||
*/
|
||||
paper(p1).
|
||||
|
||||
paper(p2).
|
||||
|
||||
paper(p3).
|
||||
|
||||
paper(p4).
|
||||
|
||||
paper(p5).
|
||||
|
||||
paper_topic(p1,theory).
|
||||
|
||||
paper_topic(p2,theory).
|
||||
|
||||
paper_topic(p4,theory).
|
||||
|
||||
paper_topic(p3,ai).
|
||||
|
||||
paper_topic(p5,ai).
|
||||
|
||||
cites(c1).
|
||||
|
||||
|
||||
cites_cited_group(C,theory):0.9;cites_cited_group(C,ai):0.1.
|
||||
|
||||
uniform(cites_cited(C,P),P,L):-
|
||||
cites_cited_group(C,T),bagof(Pap,paper_topic(Pap,T),L).
|
||||
|
||||
|
||||
uniform(cites_citing(C,P),P,L):-
|
||||
setof(Paper,paper(Paper),L),
|
||||
cites_cited(C,Pap),
|
||||
\+ cites_cited(C,p1).
|
45
packages/cplint/examples/paper_ref_simple.cpl
Normal file
45
packages/cplint/examples/paper_ref_simple.cpl
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
?- s([cites_cited(c1,Pap)],P).
|
||||
P = 0.333333333333333,
|
||||
Pap = p1 ? ;
|
||||
P = 0.333333333333333,
|
||||
Pap = p2 ? ;
|
||||
P = 0.333333333333333,
|
||||
Pap = p4 ? ;
|
||||
no
|
||||
?- Action (h for help): c
|
||||
| s([cites_citing(c1,Pap)],P).
|
||||
P = 0.5,
|
||||
Pap = p3 ? ;
|
||||
P = 0.5,
|
||||
Pap = p5 ? ;
|
||||
no
|
||||
|
||||
*/
|
||||
paper(p1).
|
||||
|
||||
paper(p2).
|
||||
|
||||
paper(p3).
|
||||
|
||||
paper(p4).
|
||||
|
||||
paper(p5).
|
||||
|
||||
paper_topic(p1,theory).
|
||||
|
||||
paper_topic(p2,theory).
|
||||
|
||||
paper_topic(p4,theory).
|
||||
|
||||
paper_topic(p3,ai).
|
||||
|
||||
paper_topic(p5,ai).
|
||||
|
||||
cites(c1).
|
||||
|
||||
uniform(cites_cited(C,P),P,L):-
|
||||
bagof(Pap,paper_topic(Pap,theory),L).
|
||||
|
||||
uniform(cites_citing(C,P),P,L):-
|
||||
bagof(Pap,paper_topic(Pap,ai),L).
|
796
packages/cplint/examples/school.cpl
Normal file
796
packages/cplint/examples/school.cpl
Normal file
@@ -0,0 +1,796 @@
|
||||
/*
|
||||
Yap run on school_32.yap
|
||||
?- s([professor_ability(p0,X)],P).
|
||||
P = 0.5,
|
||||
X = h ? ;
|
||||
P = 0.1,
|
||||
X = l ? ;
|
||||
P = 0.4,
|
||||
X = m ? ;
|
||||
no
|
||||
?- s([professor_popularity(p0,X)],P).
|
||||
P = 0.531,
|
||||
X = h ? ;
|
||||
P = 0.175,
|
||||
X = l ? ;
|
||||
P = 0.294,
|
||||
X = m ? ;
|
||||
no
|
||||
ok
|
||||
|
||||
sc([professor_ability(p0,X)],[professor_popularity(p0,h)],P).
|
||||
P = 0.847457627118644,
|
||||
X = h ? ;
|
||||
P = 0.00188323917137476,
|
||||
X = l ? ;
|
||||
P = 0.150659133709981,
|
||||
X = m ?
|
||||
ok
|
||||
|
||||
sc([professor_popularity(p0,X)],[professor_ability(p0,h)],P).
|
||||
P = 0.9,
|
||||
X = h ? ;
|
||||
P = 0.01,
|
||||
X = l ? ;
|
||||
P = 0.09,
|
||||
X = m ? ;
|
||||
no
|
||||
ok
|
||||
?- s([registration_grade(r0,X)],P).
|
||||
P = 0.06675,
|
||||
X = 1 ? ;
|
||||
P = 0.16575,
|
||||
X = 2 ? ;
|
||||
Action (";" for more choices, <return> for exit) ? ;
|
||||
P = 0.356,
|
||||
X = 3 ? ;
|
||||
P = 0.4115,
|
||||
X = 4 ?
|
||||
no
|
||||
ok
|
||||
|
||||
sc([registration_grade(r0,X)],[registration_course(r0,C), course_difficulty(C,h)],P).
|
||||
C = c16,
|
||||
P = 0.15,
|
||||
X = 1 ? ;
|
||||
C = c16,
|
||||
P = 0.285,
|
||||
X = 2 ? ;
|
||||
C = c16,
|
||||
P = 0.424,
|
||||
X = 3 ? ;
|
||||
C = c16,
|
||||
P = 0.141,
|
||||
X = 4 ? ;
|
||||
no
|
||||
ok (a=4, ...,d=1)
|
||||
|
||||
sc([registration_grade(r0,X)], [registration_course(r0,C), course_difficulty(C,h), registration_student(r0,S), student_intelligence(S,h)],P).
|
||||
C = c16,
|
||||
P = 0.05,
|
||||
S = s0,
|
||||
X = 1 ? ;
|
||||
C = c16,
|
||||
P = 0.15,
|
||||
S = s0,
|
||||
X = 2 ? ;
|
||||
C = c16,
|
||||
P = 0.6,
|
||||
S = s0,
|
||||
X = 3 ? ;
|
||||
C = c16,
|
||||
P = 0.2,
|
||||
S = s0,
|
||||
X = 4 ? ;
|
||||
no
|
||||
ok
|
||||
|
||||
sc([registration_grade(r0,X)],[registration_course(r0,C), course_difficulty(C,l), registration_student(r0,S), student_intelligence(S,h)],P).
|
||||
C = c16,
|
||||
P = 0.01,
|
||||
S = s0,
|
||||
X = 1 ? ;
|
||||
C = c16,
|
||||
P = 0.02,
|
||||
S = s0,
|
||||
X = 2 ? ;
|
||||
C = c16,
|
||||
P = 0.12,
|
||||
S = s0,
|
||||
X = 3 ? ;
|
||||
C = c16,
|
||||
P = 0.85,
|
||||
S = s0,
|
||||
X = 4 ? ;
|
||||
no
|
||||
ok
|
||||
|
||||
s([registration_satisfaction(r0,X)],P).
|
||||
P = 0.15197525,
|
||||
X = 1 ? ;
|
||||
P = 0.15331025,
|
||||
X = 2 ? ;
|
||||
P = 0.6947145,
|
||||
X = 3 ? ;
|
||||
no
|
||||
ok
|
||||
sc([registration_satisfaction(r0,X)],[ registration_student(r0,S), student_intelligence(S,h)],P).
|
||||
P = 0.0959225,
|
||||
S = s0,
|
||||
X = 1 ? ;
|
||||
P = 0.124515,
|
||||
S = s0,
|
||||
X = 2 ? ;
|
||||
P = 0.7795625,
|
||||
S = s0,
|
||||
X = 3 ? ;
|
||||
no
|
||||
ok (h=3, l=1)
|
||||
|
||||
sc([registration_satisfaction(r0,X)],[registration_grade(r0,4)],P).
|
||||
P = 0.04,
|
||||
X = 1 ? ;
|
||||
P = 0.06,
|
||||
X = 2 ? ;
|
||||
P = 0.9,
|
||||
X = 3 ? ;
|
||||
in Yap:
|
||||
?- registration_satisfaction(r0,X), registration_grade(r0,a).
|
||||
% YAP: no handler for error error(domain_error(bayesian_domain),bind_clpbns(var(grade(r0),[a,b,c,d],[0.2,0.7,0.85,0.1,0.2,0.5,0.01,0.05,0.1,0.6,0.25,0.12,0.3,0.6,0.35,0.04,0.15,0.4,0.15,0.04,0.02,0.4,0.15,0.12,0.5,0.6,0.4,0.05,0.01,0.01,0.2,0.05,0.03,0.45,0.2,0.1],[_D11,_D12]),var(grade(r0),[a,b,c,d],[0.2,0.7,0.85,0.1,0.2,0.5,0.01,0.05,0.1,0.6,0.25,0.12,0.3,0.6,0.35,0.04,0.15,0.4,0.15,0.04,0.02,0.4,0.15,0.12,0.5,0.6,0.4,0.05,0.01,0.01,0.2,0.05,0.03,0.45,0.2,0.1],[_D13,_D12])))
|
||||
|
||||
sc([registration_satisfaction(r0,X)],[registration_grade(r0,1)],P).
|
||||
P = 0.528,
|
||||
X = 1 ? ;
|
||||
P = 0.167,
|
||||
X = 2 ? ;
|
||||
P = 0.305,
|
||||
X = 3 ? ;
|
||||
no
|
||||
?- sc([ registration_grade(r0,X)],[registration_satisfaction(r0,3)],P).
|
||||
P = 0.0293052037923492,
|
||||
X = 1 ? ;
|
||||
P = 0.114760451955444,
|
||||
X = 2 ? ;
|
||||
P = 0.322837654892765,
|
||||
X = 3 ? ;
|
||||
P = 0.533096689359442,
|
||||
X = 4 ? ;
|
||||
no
|
||||
?- registration_satisfaction(r0,X), registration_grade(r0,d).
|
||||
% YAP: no handler for error error(domain_error(bayesian_domain),bind_clpbns(var(grade(r0),[a,b,c,d],[0.2,0.7,0.85,0.1,0.2,0.5,0.01,0.05,0.1,0.6,0.25,0.12,0.3,0.6,0.35,0.04,0.15,0.4,0.15,0.04,0.02,0.4,0.15,0.12,0.5,0.6,0.4,0.05,0.01,0.01,0.2,0.05,0.03,0.45,0.2,0.1],[_D11,_D12]),var(grade(r0),[a,b,c,d],[0.2,0.7,0.85,0.1,0.2,0.5,0.01,0.05,0.1,0.6,0.25,0.12,0.3,0.6,0.35,0.04,0.15,0.4,0.15,0.04,0.02,0.4,0.15,0.12,0.5,0.6,0.4,0.05,0.01,0.01,0.2,0.05,0.03,0.45,0.2,0.1],[_D13,_D12])))
|
||||
|
||||
sc([ registration_grade(r0,X)],[registration_satisfaction(r0,3)],P).
|
||||
?- registration_satisfaction(r0,h), registration_grade(r0,X).
|
||||
% YAP: no handler for error error(domain_error(bayesian_domain),bind_clpbns(var(grade(r0),[a,b,c,d],[0.2,0.7,0.85,0.1,0.2,0.5,0.01,0.05,0.1,0.6,0.25,0.12,0.3,0.6,0.35,0.04,0.15,0.4,0.15,0.04,0.02,0.4,0.15,0.12,0.5,0.6,0.4,0.05,0.01,0.01,0.2,0.05,0.03,0.45,0.2,0.1],[_D11,_D12]),var(grade(r0),[a,b,c,d],[0.2,0.7,0.85,0.1,0.2,0.5,0.01,0.05,0.1,0.6,0.25,0.12,0.3,0.6,0.35,0.04,0.15,0.4,0.15,0.04,0.02,0.4,0.15,0.12,0.5,0.6,0.4,0.05,0.01,0.01,0.2,0.05,0.03,0.45,0.2,0.1],[_D13,_D12])))
|
||||
|
||||
s([course_rating(c0,X)],P).
|
||||
P = 0.5392099,
|
||||
X = h ? ;
|
||||
P = 0.2,
|
||||
X = l ? ;
|
||||
P = 0.2607901,
|
||||
X = m ? ;
|
||||
no
|
||||
yap does not end, starts thrashing
|
||||
sc([course_difficulty(c0,X)],[course_rating(c0,h)],P).
|
||||
P = 0.235185778302661,
|
||||
X = h ? ;
|
||||
P = 0.259096503977393,
|
||||
X = l ? ;
|
||||
P = 0.505717717719945,
|
||||
X = m ? ;
|
||||
no
|
||||
yap does not end, starts thrashing
|
||||
s([course_difficulty(c0,X)],P).
|
||||
P = 0.25,
|
||||
X = h ? ;
|
||||
P = 0.25,
|
||||
X = l ? ;
|
||||
P = 0.5,
|
||||
X = m ? ;
|
||||
no
|
||||
ok
|
||||
student_ranking(s0,X).
|
||||
| ?- s([student_ranking(s0,X)],P).
|
||||
P = 0.33105221125,
|
||||
X = h ? ;
|
||||
P = 0.204865630625,
|
||||
X = l ? ;
|
||||
P = 0.46408215812500003,
|
||||
X = m ?
|
||||
not checked with s
|
||||
yap:
|
||||
true ?
|
||||
yes
|
||||
|
||||
|
||||
sc([student_ranking(s0,X)],[student_intelligence(s0,h)],P).
|
||||
P = 0.42922046875000003,
|
||||
X = h ? ;
|
||||
P = 0.20003319999999997,
|
||||
X = l ? ;
|
||||
P = 0.3707463312499999,
|
||||
X = m ? ;
|
||||
no
|
||||
not checked with s
|
||||
yap:
|
||||
true
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
professor_ability(Key,h):0.50;professor_ability(Key,m): 0.40;professor_ability(Key,l): 0.10.
|
||||
|
||||
professor_popularity(Key, h):0.9; professor_popularity(Key, m):0.09; professor_popularity(Key, l):0.01 :-
|
||||
professor_ability(Key, h).
|
||||
|
||||
professor_popularity(Key, h):0.2; professor_popularity(Key, m):0.6; professor_popularity(Key, l):0.2:-
|
||||
professor_ability(Key, m).
|
||||
|
||||
professor_popularity(Key, h):0.01; professor_popularity(Key, m):0.09; professor_popularity(Key, l):0.9 :-
|
||||
professor_ability(Key,l).
|
||||
|
||||
|
||||
|
||||
registration_course(Key, CKey) :-
|
||||
registration(Key, CKey, _).
|
||||
|
||||
registration_student(Key, SKey) :-
|
||||
registration(Key, _, SKey).
|
||||
|
||||
registration_grade(Key, 4): 0.2;registration_grade(Key, 3): 0.6;registration_grade(Key, 2): 0.15 ;
|
||||
registration_grade(Key, 1): 0.05 :-
|
||||
registration(Key, CKey, SKey) ,
|
||||
student_intelligence(SKey, h) ,
|
||||
course_difficulty(CKey, h).
|
||||
|
||||
registration_grade(Key, 4): 0.7;registration_grade(Key, 3): 0.25;registration_grade(Key, 2): 0.04 ;
|
||||
registration_grade(Key, 1): 0.01 :-
|
||||
registration(Key, CKey, SKey) ,
|
||||
student_intelligence(SKey, h) ,
|
||||
course_difficulty(CKey, m).
|
||||
|
||||
|
||||
registration_grade(Key, 4): 0.85;registration_grade(Key, 3): 0.12;registration_grade(Key, 2): 0.02 ;
|
||||
registration_grade(Key, 1): 0.01 :-
|
||||
registration(Key, CKey, SKey) ,
|
||||
student_intelligence(SKey, h) ,
|
||||
course_difficulty(CKey, l).
|
||||
|
||||
|
||||
registration_grade(Key, 4): 0.1;registration_grade(Key, 3): 0.3;registration_grade(Key, 2): 0.4 ;
|
||||
registration_grade(Key, 1): 0.2 :-
|
||||
registration(Key, CKey, SKey) ,
|
||||
student_intelligence(SKey, m) ,
|
||||
course_difficulty(CKey, h).
|
||||
|
||||
|
||||
registration_grade(Key, 4): 0.2;registration_grade(Key, 3): 0.6;registration_grade(Key, 2): 0.15 ;
|
||||
registration_grade(Key, 1): 0.05 :-
|
||||
registration(Key, CKey, SKey) ,
|
||||
student_intelligence(SKey, m) ,
|
||||
course_difficulty(CKey, m).
|
||||
|
||||
registration_grade(Key, 4): 0.5;registration_grade(Key, 3): 0.35;registration_grade(Key, 2): 0.12;
|
||||
registration_grade(Key, 1): 0.03 :-
|
||||
registration(Key, CKey, SKey) ,
|
||||
student_intelligence(SKey, m) ,
|
||||
course_difficulty(CKey, l).
|
||||
|
||||
registration_grade(Key, 4): 0.01;registration_grade(Key, 3): 0.04;registration_grade(Key, 2): 0.5 ;
|
||||
registration_grade(Key, 1): 0.45 :-
|
||||
registration(Key, CKey, SKey) ,
|
||||
student_intelligence(SKey, l) ,
|
||||
course_difficulty(CKey, h).
|
||||
|
||||
registration_grade(Key, 4): 0.05;registration_grade(Key, 3): 0.15;registration_grade(Key, 2): 0.6 ;
|
||||
registration_grade(Key, 1): 0.2 :-
|
||||
registration(Key, CKey, SKey) ,
|
||||
student_intelligence(SKey, l) ,
|
||||
course_difficulty(CKey, m).
|
||||
|
||||
registration_grade(Key, 4): 0.1;registration_grade(Key, 3): 0.4;registration_grade(Key, 2): 0.4 ;
|
||||
registration_grade(Key, 1): 0.1 :-
|
||||
registration(Key, CKey, SKey) ,
|
||||
student_intelligence(SKey, l) ,
|
||||
course_difficulty(CKey, l).
|
||||
|
||||
|
||||
registration_satisfaction(Key, 3): 0.98 ; registration_satisfaction(Key, 2): 0.01 ;
|
||||
registration_satisfaction(Key, 1): 0.01 :-
|
||||
registration(Key, CKey,_),
|
||||
course(CKey, PKey),
|
||||
professor_ability(PKey, h),
|
||||
registration_grade(Key, 4).
|
||||
|
||||
registration_satisfaction(Key, 3): 0.9 ; registration_satisfaction(Key, 2): 0.09 ;
|
||||
registration_satisfaction(Key, 1): 0.01 :-
|
||||
registration(Key, CKey,_),
|
||||
course(CKey, PKey),
|
||||
professor_ability(PKey, h),
|
||||
registration_grade(Key, 3).
|
||||
|
||||
registration_satisfaction(Key, 3): 0.8 ; registration_satisfaction(Key, 2): 0.15 ;
|
||||
registration_satisfaction(Key, 1): 0.05 :-
|
||||
registration(Key, CKey,_),
|
||||
course(CKey, PKey),
|
||||
professor_ability(PKey, h),
|
||||
registration_grade(Key, 2).
|
||||
|
||||
|
||||
|
||||
registration_satisfaction(Key, 3): 0.6 ; registration_satisfaction(Key, 2): 0.3 ;
|
||||
registration_satisfaction(Key, 1): 0.1 :-
|
||||
registration(Key, CKey,_),
|
||||
course(CKey, PKey),
|
||||
professor_ability(PKey, h),
|
||||
registration_grade(Key, 1).
|
||||
|
||||
registration_satisfaction(Key, 3): 0.9 ; registration_satisfaction(Key, 2): 0.05 ;
|
||||
registration_satisfaction(Key, 1): 0.05 :-
|
||||
registration(Key, CKey,_),
|
||||
course(CKey, PKey),
|
||||
professor_ability(PKey, m),
|
||||
registration_grade(Key, 4).
|
||||
|
||||
registration_satisfaction(Key, 3): 0.4 ; registration_satisfaction(Key, 2): 0.4 ;
|
||||
registration_satisfaction(Key, 1): 0.2 :-
|
||||
registration(Key, CKey,_),
|
||||
course(CKey, PKey),
|
||||
professor_ability(PKey, m),
|
||||
registration_grade(Key, 3).
|
||||
|
||||
registration_satisfaction(Key, 3): 0.2 ; registration_satisfaction(Key, 2): 0.3 ;
|
||||
registration_satisfaction(Key, 1): 0.5 :-
|
||||
registration(Key, CKey,_),
|
||||
course(CKey, PKey),
|
||||
professor_ability(PKey, m),
|
||||
registration_grade(Key, 2).
|
||||
|
||||
registration_satisfaction(Key, 3): 0.01 ; registration_satisfaction(Key, 2): 0.04 ;
|
||||
registration_satisfaction(Key, 1): 0.95 :-
|
||||
registration(Key, CKey,_),
|
||||
course(CKey, PKey),
|
||||
professor_ability(PKey, m),
|
||||
registration_grade(Key, 1).
|
||||
|
||||
registration_satisfaction(Key, 3): 0.5 ; registration_satisfaction(Key, 2): 0.35 ;
|
||||
registration_satisfaction(Key, 1): 0.15 :-
|
||||
registration(Key, CKey,_),
|
||||
course(CKey, PKey),
|
||||
professor_ability(PKey, l),
|
||||
registration_grade(Key, 4).
|
||||
|
||||
registration_satisfaction(Key, 3): 0.2 ; registration_satisfaction(Key, 2): 0.3 ;
|
||||
registration_satisfaction(Key, 1): 0.5 :-
|
||||
registration(Key, CKey,_),
|
||||
course(CKey, PKey),
|
||||
professor_ability(PKey, l),
|
||||
registration_grade(Key, 3).
|
||||
|
||||
registration_satisfaction(Key, 3): 0.01 ; registration_satisfaction(Key, 2): 0.09 ;
|
||||
registration_satisfaction(Key, 1): 0.9 :-
|
||||
registration(Key, CKey,_),
|
||||
course(CKey, PKey),
|
||||
professor_ability(PKey, l),
|
||||
registration_grade(Key, 2).
|
||||
|
||||
registration_satisfaction(Key, 3): 0.01 ; registration_satisfaction(Key, 2): 0.01 ;
|
||||
registration_satisfaction(Key, 1): 0.98 :-
|
||||
registration(Key, CKey,_),
|
||||
course(CKey, PKey),
|
||||
professor_ability(PKey, l),
|
||||
registration_grade(Key, 1).
|
||||
|
||||
course_rating(CKey, h):0.2; course_rating(CKey, m):0.2;course_rating(CKey, l):0.6:-
|
||||
bagof(Sat, RKey^(registration_course(RKey,CKey), registration_satisfaction(RKey,Sat)), Sats),
|
||||
average(Sats, Av),Av<1.
|
||||
|
||||
course_rating(CKey, h):0.2; course_rating(CKey, m):0.6;course_rating(CKey, l):0.2:-
|
||||
bagof(Sat, RKey^(registration_course(RKey,CKey), registration_satisfaction(RKey,Sat)), Sats),
|
||||
average(Sats, Av),Av<2,Av>=1.
|
||||
|
||||
course_rating(CKey, h):0.6; course_rating(CKey,m):0.2;course_rating(CKey, l):0.2:-
|
||||
bagof(Sat, RKey^(registration_course(RKey,CKey), registration_satisfaction(RKey,Sat)), Sats),
|
||||
average(Sats, Av),Av>=2.
|
||||
|
||||
course_difficulty(Key, h) :0.25 ; course_difficulty(Key, m): 0.5 ; course_difficulty(Key, l) : 0.25.
|
||||
|
||||
student_intelligence(Key, h): 0.5; student_intelligence(Key,m):0.4; student_intelligence(Key,l):0.1.
|
||||
|
||||
student_ranking(Key, h):0.2; student_ranking(Key, m):0.2;student_ranking(Key, l):0.6:-
|
||||
bagof(Grade, CKey^(registration_student(CKey,Key),
|
||||
registration_grade(CKey, Grade)), Grades),
|
||||
average(Grades, Av),Av<1.5.
|
||||
|
||||
student_ranking(Key, h):0.2; student_ranking(Key, m):0.6;student_ranking(Key, l):0.2:-
|
||||
bagof(Grade, CKey^(registration_student(CKey,Key),
|
||||
registration_grade(CKey, Grade)), Grades),
|
||||
average(Grades, Av),Av>=1.5,Av<3.5.
|
||||
|
||||
student_ranking(Key, h):0.6; student_ranking(Key, m):0.2;student_ranking(Key, l):0.2:-
|
||||
bagof(Grade, CKey^(registration_student(CKey,Key),
|
||||
registration_grade(CKey, Grade)), Grades),
|
||||
average(Grades, Av),Av>=3.5.
|
||||
|
||||
|
||||
professor(p0).
|
||||
professor(p1).
|
||||
professor(p2).
|
||||
professor(p3).
|
||||
professor(p4).
|
||||
professor(p5).
|
||||
professor(p6).
|
||||
professor(p7).
|
||||
professor(p8).
|
||||
professor(p9).
|
||||
professor(p10).
|
||||
professor(p11).
|
||||
professor(p12).
|
||||
professor(p13).
|
||||
professor(p14).
|
||||
professor(p15).
|
||||
professor(p16).
|
||||
professor(p17).
|
||||
professor(p18).
|
||||
professor(p19).
|
||||
professor(p20).
|
||||
professor(p21).
|
||||
professor(p22).
|
||||
professor(p23).
|
||||
professor(p24).
|
||||
professor(p25).
|
||||
professor(p26).
|
||||
professor(p27).
|
||||
professor(p28).
|
||||
professor(p29).
|
||||
professor(p30).
|
||||
professor(p31).
|
||||
|
||||
|
||||
course(c0,p24).
|
||||
course(c1,p7).
|
||||
course(c2,p16).
|
||||
course(c3,p27).
|
||||
course(c4,p25).
|
||||
course(c5,p6).
|
||||
course(c6,p28).
|
||||
course(c7,p1).
|
||||
course(c8,p29).
|
||||
course(c9,p23).
|
||||
course(c10,p17).
|
||||
course(c11,p16).
|
||||
course(c12,p11).
|
||||
course(c13,p28).
|
||||
course(c14,p13).
|
||||
course(c15,p7).
|
||||
course(c16,p21).
|
||||
course(c17,p15).
|
||||
course(c18,p8).
|
||||
course(c19,p30).
|
||||
course(c20,p1).
|
||||
course(c21,p23).
|
||||
course(c22,p11).
|
||||
course(c23,p9).
|
||||
course(c24,p0).
|
||||
course(c25,p30).
|
||||
course(c26,p15).
|
||||
course(c27,p4).
|
||||
course(c28,p26).
|
||||
course(c29,p29).
|
||||
course(c30,p31).
|
||||
course(c31,p19).
|
||||
course(c32,p5).
|
||||
course(c33,p14).
|
||||
course(c34,p14).
|
||||
course(c35,p25).
|
||||
course(c36,p21).
|
||||
course(c37,p10).
|
||||
course(c38,p2).
|
||||
course(c39,p20).
|
||||
course(c40,p3).
|
||||
course(c41,p18).
|
||||
course(c42,p9).
|
||||
course(c43,p20).
|
||||
course(c44,p17).
|
||||
course(c45,p19).
|
||||
course(c46,p6).
|
||||
course(c47,p4).
|
||||
course(c48,p12).
|
||||
course(c49,p10).
|
||||
course(c50,p2).
|
||||
course(c51,p22).
|
||||
course(c52,p31).
|
||||
course(c53,p24).
|
||||
course(c54,p0).
|
||||
course(c55,p5).
|
||||
course(c56,p22).
|
||||
course(c57,p13).
|
||||
course(c58,p18).
|
||||
course(c59,p12).
|
||||
course(c60,p27).
|
||||
course(c61,p3).
|
||||
course(c62,p8).
|
||||
course(c63,p26).
|
||||
|
||||
|
||||
student(s0).
|
||||
student(s1).
|
||||
student(s2).
|
||||
student(s3).
|
||||
student(s4).
|
||||
student(s5).
|
||||
student(s6).
|
||||
student(s7).
|
||||
student(s8).
|
||||
student(s9).
|
||||
student(s10).
|
||||
student(s11).
|
||||
student(s12).
|
||||
student(s13).
|
||||
student(s14).
|
||||
student(s15).
|
||||
student(s16).
|
||||
student(s17).
|
||||
student(s18).
|
||||
student(s19).
|
||||
student(s20).
|
||||
student(s21).
|
||||
student(s22).
|
||||
student(s23).
|
||||
student(s24).
|
||||
student(s25).
|
||||
student(s26).
|
||||
student(s27).
|
||||
student(s28).
|
||||
student(s29).
|
||||
student(s30).
|
||||
student(s31).
|
||||
student(s32).
|
||||
student(s33).
|
||||
student(s34).
|
||||
student(s35).
|
||||
student(s36).
|
||||
student(s37).
|
||||
student(s38).
|
||||
student(s39).
|
||||
student(s40).
|
||||
student(s41).
|
||||
student(s42).
|
||||
student(s43).
|
||||
student(s44).
|
||||
student(s45).
|
||||
student(s46).
|
||||
student(s47).
|
||||
student(s48).
|
||||
student(s49).
|
||||
student(s50).
|
||||
student(s51).
|
||||
student(s52).
|
||||
student(s53).
|
||||
student(s54).
|
||||
student(s55).
|
||||
student(s56).
|
||||
student(s57).
|
||||
student(s58).
|
||||
student(s59).
|
||||
student(s60).
|
||||
student(s61).
|
||||
student(s62).
|
||||
student(s63).
|
||||
student(s64).
|
||||
student(s65).
|
||||
student(s66).
|
||||
student(s67).
|
||||
student(s68).
|
||||
student(s69).
|
||||
student(s70).
|
||||
student(s71).
|
||||
student(s72).
|
||||
student(s73).
|
||||
student(s74).
|
||||
student(s75).
|
||||
student(s76).
|
||||
student(s77).
|
||||
student(s78).
|
||||
student(s79).
|
||||
student(s80).
|
||||
student(s81).
|
||||
student(s82).
|
||||
student(s83).
|
||||
student(s84).
|
||||
student(s85).
|
||||
student(s86).
|
||||
student(s87).
|
||||
student(s88).
|
||||
student(s89).
|
||||
student(s90).
|
||||
student(s91).
|
||||
student(s92).
|
||||
student(s93).
|
||||
student(s94).
|
||||
student(s95).
|
||||
student(s96).
|
||||
student(s97).
|
||||
student(s98).
|
||||
student(s99).
|
||||
student(s100).
|
||||
student(s101).
|
||||
student(s102).
|
||||
student(s103).
|
||||
student(s104).
|
||||
student(s105).
|
||||
student(s106).
|
||||
student(s107).
|
||||
student(s108).
|
||||
student(s109).
|
||||
student(s110).
|
||||
student(s111).
|
||||
student(s112).
|
||||
student(s113).
|
||||
student(s114).
|
||||
student(s115).
|
||||
student(s116).
|
||||
student(s117).
|
||||
student(s118).
|
||||
student(s119).
|
||||
student(s120).
|
||||
student(s121).
|
||||
student(s122).
|
||||
student(s123).
|
||||
student(s124).
|
||||
student(s125).
|
||||
student(s126).
|
||||
student(s127).
|
||||
student(s128).
|
||||
student(s129).
|
||||
student(s130).
|
||||
student(s131).
|
||||
student(s132).
|
||||
student(s133).
|
||||
student(s134).
|
||||
student(s135).
|
||||
student(s136).
|
||||
student(s137).
|
||||
student(s138).
|
||||
student(s139).
|
||||
student(s140).
|
||||
student(s141).
|
||||
student(s142).
|
||||
student(s143).
|
||||
student(s144).
|
||||
student(s145).
|
||||
student(s146).
|
||||
student(s147).
|
||||
student(s148).
|
||||
student(s149).
|
||||
student(s150).
|
||||
student(s151).
|
||||
student(s152).
|
||||
student(s153).
|
||||
student(s154).
|
||||
student(s155).
|
||||
student(s156).
|
||||
student(s157).
|
||||
student(s158).
|
||||
student(s159).
|
||||
student(s160).
|
||||
student(s161).
|
||||
student(s162).
|
||||
student(s163).
|
||||
student(s164).
|
||||
student(s165).
|
||||
student(s166).
|
||||
student(s167).
|
||||
student(s168).
|
||||
student(s169).
|
||||
student(s170).
|
||||
student(s171).
|
||||
student(s172).
|
||||
student(s173).
|
||||
student(s174).
|
||||
student(s175).
|
||||
student(s176).
|
||||
student(s177).
|
||||
student(s178).
|
||||
student(s179).
|
||||
student(s180).
|
||||
student(s181).
|
||||
student(s182).
|
||||
student(s183).
|
||||
student(s184).
|
||||
student(s185).
|
||||
student(s186).
|
||||
student(s187).
|
||||
student(s188).
|
||||
student(s189).
|
||||
student(s190).
|
||||
student(s191).
|
||||
student(s192).
|
||||
student(s193).
|
||||
student(s194).
|
||||
student(s195).
|
||||
student(s196).
|
||||
student(s197).
|
||||
student(s198).
|
||||
student(s199).
|
||||
student(s200).
|
||||
student(s201).
|
||||
student(s202).
|
||||
student(s203).
|
||||
student(s204).
|
||||
student(s205).
|
||||
student(s206).
|
||||
student(s207).
|
||||
student(s208).
|
||||
student(s209).
|
||||
student(s210).
|
||||
student(s211).
|
||||
student(s212).
|
||||
student(s213).
|
||||
student(s214).
|
||||
student(s215).
|
||||
student(s216).
|
||||
student(s217).
|
||||
student(s218).
|
||||
student(s219).
|
||||
student(s220).
|
||||
student(s221).
|
||||
student(s222).
|
||||
student(s223).
|
||||
student(s224).
|
||||
student(s225).
|
||||
student(s226).
|
||||
student(s227).
|
||||
student(s228).
|
||||
student(s229).
|
||||
student(s230).
|
||||
student(s231).
|
||||
student(s232).
|
||||
student(s233).
|
||||
student(s234).
|
||||
student(s235).
|
||||
student(s236).
|
||||
student(s237).
|
||||
student(s238).
|
||||
student(s239).
|
||||
student(s240).
|
||||
student(s241).
|
||||
student(s242).
|
||||
student(s243).
|
||||
student(s244).
|
||||
student(s245).
|
||||
student(s246).
|
||||
student(s247).
|
||||
student(s248).
|
||||
student(s249).
|
||||
student(s250).
|
||||
student(s251).
|
||||
student(s252).
|
||||
student(s253).
|
||||
student(s254).
|
||||
student(s255).
|
||||
|
||||
|
||||
registration(r0,c16,s0).
|
||||
registration(r1,c10,s0).
|
||||
registration(r2,c57,s0).
|
||||
registration(r3,c22,s1).
|
||||
registration(r4,c55,s1).
|
||||
registration(r5,c27,s1).
|
||||
registration(r6,c14,s2).
|
||||
registration(r7,c52,s2).
|
||||
registration(r8,c10,s2).
|
||||
registration(r9,c47,s3).
|
||||
registration(r10,c16,s3).
|
||||
registration(r11,c62,s3).
|
||||
registration(r12,c12,s4).
|
||||
registration(r13,c11,s4).
|
||||
registration(r14,c17,s4).
|
||||
registration(r15,c52,s5).
|
||||
registration(r16,c1,s5).
|
||||
registration(r17,c35,s5).
|
||||
registration(r18,c0,s6).
|
||||
registration(r19,c7,s6).
|
||||
registration(r20,c40,s6).
|
52
packages/cplint/examples/school_simple.cpl
Normal file
52
packages/cplint/examples/school_simple.cpl
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
?- s([registration_grade(r0,X)],P).
|
||||
|
||||
|
||||
|
||||
|
||||
student_ranking(s0,X).
|
||||
s([student_ranking(s0,h)],P).
|
||||
P = 0,6646250000000005 ?
|
||||
s([student_ranking(s0,l)],P).
|
||||
P = 0,33537499999999987
|
||||
ok, checked with s.pl
|
||||
*/
|
||||
|
||||
|
||||
|
||||
registration_course(Key, CKey) :-
|
||||
registration(Key, CKey, _).
|
||||
|
||||
registration_student(Key, SKey) :-
|
||||
registration(Key, _, SKey).
|
||||
|
||||
registration_grade(Key, 4): 0.2;
|
||||
registration_grade(Key, 1): 0.8 :-
|
||||
registration(Key, CKey, SKey) ,
|
||||
course_difficulty(CKey, h).
|
||||
|
||||
|
||||
registration_grade(Key, 4): 0.85;
|
||||
registration_grade(Key, 1): 0.15 :-
|
||||
registration(Key, CKey, SKey) ,
|
||||
course_difficulty(CKey, l).
|
||||
|
||||
|
||||
course_difficulty(Cou, h) :0.5 ; course_difficulty(Cou, l) : 0.5.
|
||||
|
||||
|
||||
student_ranking(Stu, h):0.2; student_ranking(Stu, l):0.8:-
|
||||
bagof(Grade, CKey^(registration_student(CKey,Stu),
|
||||
registration_grade(CKey, Grade)), Grades),
|
||||
average(Grades, Av),Av<2.
|
||||
|
||||
student_ranking(Stu, h):0.8; student_ranking(Stu, l):0.2:-
|
||||
bagof(Grade, CKey^(registration_student(CKey,Stu),
|
||||
registration_grade(CKey, Grade)), Grades),
|
||||
average(Grades, Av),Av>=2.
|
||||
|
||||
|
||||
|
||||
|
||||
registration(r0,c16,s0).
|
||||
registration(r1,c10,s0).
|
18
packages/cplint/examples/school_simple.uni
Normal file
18
packages/cplint/examples/school_simple.uni
Normal file
@@ -0,0 +1,18 @@
|
||||
universe(['Stu'],[s0]).
|
||||
universe(['Key'],[r0,r1]).
|
||||
universe(['Cou'],[c16,c10]).
|
||||
|
||||
type(stu,[s0]).
|
||||
type(reg,[r0,r1]).
|
||||
type(cou,[c16,c10]).
|
||||
type(gr,[1,4]).
|
||||
type(dif,[h,l]).
|
||||
type(ran,[h,l]).
|
||||
|
||||
mode(registration(reg,cou,stu)).
|
||||
mode(registration_grade(reg,gr)).
|
||||
mode(registration_course(reg,cou)).
|
||||
mode(registration_student(reg,stu)).
|
||||
mode(course_difficulty(cou,dif)).
|
||||
mode(student_ranking(stu,ran)).
|
||||
|
95
packages/cplint/examples/student.cpl
Normal file
95
packages/cplint/examples/student.cpl
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
s([student_rank(jane_doe,h)],P).
|
||||
P = 0.465
|
||||
|
||||
s([student_rank(jane_doe,l)],P).
|
||||
P = 0.535
|
||||
|
||||
s([course_rat(C,h)],P).
|
||||
C = phil101,
|
||||
P = 0.330656
|
||||
|
||||
s([course_rat(C,l)],P).
|
||||
C = phil101,
|
||||
P = 0.669344
|
||||
|
||||
*/
|
||||
professor(gump).
|
||||
%1
|
||||
professor_teach_ab(P,h):0.2;professor_teach_ab(P,l):0.8:-
|
||||
professor(P).
|
||||
%2
|
||||
professor_pop(P,h):0.7;professor_pop(P,l):0.3:-
|
||||
professor_teach_ab(P,h).
|
||||
%3
|
||||
professor_pop(P,h):0.2;professor_pop(P,l):0.8:-
|
||||
professor_teach_ab(P,l).
|
||||
|
||||
student(jane_doe).
|
||||
%4
|
||||
student_int(S,h):0.6;student_int(S,l):0.4:-
|
||||
student(S).
|
||||
%5
|
||||
student_rank(S,h):0.6;student_rank(S,l):0.4:-
|
||||
bagof(G,R^(registr_stu(R,S),registr_gr(R,G)),L),
|
||||
average(L,Av),Av>1.5.
|
||||
%6
|
||||
student_rank(S,h):0.4;student_rank(S,l):0.6:-
|
||||
bagof(G,R^(registr_stu(R,S),registr_gr(R,G)),L),
|
||||
average(L,Av),Av =< 1.5.
|
||||
|
||||
registr(5639).
|
||||
|
||||
registr_cou(5639,phil101).
|
||||
|
||||
registr_stu(5639,jane_doe).
|
||||
|
||||
registr(5640).
|
||||
|
||||
registr_cou(5640,phil101).
|
||||
|
||||
registr_stu(5640,jane_doe).
|
||||
|
||||
%7
|
||||
registr_gr(Reg,1):0.5;registr_gr(Reg,2):0.5:-
|
||||
registr_stu(Reg,S),student_int(S,h),registr_cou(Reg,C),course_dif(C,h).
|
||||
%8
|
||||
registr_gr(Reg,1):0.2;registr_gr(Reg,2):0.8:-
|
||||
registr_stu(Reg,S),student_int(S,h),registr_cou(Reg,C),course_dif(C,l).
|
||||
%9
|
||||
registr_gr(Reg,1):0.8;registr_gr(Reg,2):0.2:-
|
||||
registr_stu(Reg,S),student_int(S,l),registr_cou(Reg,C),course_dif(C,h).
|
||||
%10
|
||||
registr_gr(Reg,1):0.5;registr_gr(Reg,2):0.5:-
|
||||
registr_stu(Reg,S),student_int(S,l),registr_cou(Reg,C),course_dif(C,l).
|
||||
%11
|
||||
registr_sat(Reg,1):0.2;registr_sat(Reg,2):0.8:-
|
||||
registr_gr(Reg,2),registr_cou(Reg,C),course_prof(C,P),
|
||||
professor_teach_ab(P,h).
|
||||
%12
|
||||
registr_sat(Reg,1):0.4;registr_sat(Reg,2):0.6:-
|
||||
registr_gr(Reg,2),registr_cou(Reg,C),course_prof(C,P),
|
||||
professor_teach_ab(P,l).
|
||||
%13
|
||||
registr_sat(Reg,1):0.6;registr_sat(Reg,2):0.4:-
|
||||
registr_gr(Reg,1),registr_cou(Reg,C),course_prof(C,P),
|
||||
professor_teach_ab(P,h).
|
||||
%14
|
||||
registr_sat(Reg,1):0.8;registr_sat(Reg,2):0.2:-
|
||||
registr_gr(Reg,1),registr_cou(Reg,C),course_prof(C,P),
|
||||
professor_teach_ab(P,l).
|
||||
|
||||
course(phil101).
|
||||
|
||||
course_prof(phil101,gump).
|
||||
%15
|
||||
course_dif(C,h):0.5;course_dif(C,l):0.5:-
|
||||
course(C).
|
||||
%16
|
||||
course_rat(C,h):0.8;course_rat(C,l):0.2:-
|
||||
bagof(Stu,R^(registr_cou(R,C),registr_sat(R,Stu)),L),
|
||||
average(L,Av),Av>1.5.
|
||||
%17
|
||||
course_rat(C,h):0.2;course_rat(C,l):0.8:-
|
||||
bagof(Stu,R^(registr_cou(R,C),registr_sat(R,Stu)),L),
|
||||
average(L,Av),Av=< 1.5.
|
29
packages/cplint/examples/student.uni
Normal file
29
packages/cplint/examples/student.uni
Normal file
@@ -0,0 +1,29 @@
|
||||
universe(['S'],[jane_doe]).
|
||||
universe(['P'],[gump]).
|
||||
universe(['Reg'],[5639,5640]).
|
||||
universe(['C'],[phil101]).
|
||||
|
||||
type(prof,[gump]).
|
||||
type(stu,[jane_doe]).
|
||||
type(abi,[l,h]).
|
||||
type(int,[h,l]).
|
||||
type(reg,[5639,5640]).
|
||||
type(cou,[phil101]).
|
||||
type(gr,[1,2]).
|
||||
type(sat,[1,2]).
|
||||
type(dif,[h,l]).
|
||||
type(rat,[h,l]).
|
||||
|
||||
mode(professor(prof)).
|
||||
mode(professor_teach_ab(prof,abi)
|
||||
mode(student(stu)).
|
||||
mode(student_int(stu,int)).
|
||||
mode(registr(reg)).
|
||||
mode(registr_cou(reg,cou)).
|
||||
mode(registr_stu(reg,stu)).
|
||||
mode(registr_gr(reg,gr)).
|
||||
mode(registr_sat(reg,sat)).
|
||||
mode(course(cou)).
|
||||
mode(course_prof(cou,prof)).
|
||||
mode(course_dif(cou,dif)).
|
||||
mode(course_rat(cou,rat)).
|
39
packages/cplint/examples/threesideddice.cpl
Normal file
39
packages/cplint/examples/threesideddice.cpl
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
s([on(0,1)],P).
|
||||
P = 0.333333333333333 ?
|
||||
|
||||
s([on(1,1)],P).
|
||||
P = 0.222222222222222
|
||||
s([on(2,1)],P).
|
||||
P = 0.148148147703704
|
||||
s([on(3,1)],P).
|
||||
% OUT OF DATABASE SPACE ERROR- Database crashed against Stacks
|
||||
s([on(4,1)],P).
|
||||
% OUT OF DATABASE SPACE ERROR- Database crashed against Stacks
|
||||
s([on(5,1)],P).
|
||||
% OUT OF DATABASE SPACE ERROR- Database crashed against Stacks
|
||||
|
||||
s([on(0,1),on(1,1)],P).
|
||||
P = 0.111111111111111
|
||||
s([on(0,1),on(1,1),on(2,1)],P).
|
||||
P = 0.037037037037037
|
||||
sc([on(1,1)],[on(0,1)],P).
|
||||
P = 0.333333333333333
|
||||
|
||||
sc([on(2,1)],[on(0,1)],P).
|
||||
P = 0.222222222222222
|
||||
|
||||
sc([on(3,1)],[on(0,1)],P).
|
||||
P = 0.148148148148148
|
||||
|
||||
sc([on(2,1)],[on(1,1)],P).
|
||||
P = 0.333333333333333 ?
|
||||
|
||||
|
||||
*/
|
||||
on(0,1):1/3;on(0,2):1/3;on(0,3):1/3.
|
||||
|
||||
on(X,1):1/3;on(X,2):1/3;on(X,3):1/3:-
|
||||
X1 is X-1,X1>=0,
|
||||
on(X1,Y),
|
||||
\+ on(X1,3).
|
9
packages/cplint/examples/threesideddice.uni
Normal file
9
packages/cplint/examples/threesideddice.uni
Normal file
@@ -0,0 +1,9 @@
|
||||
mode(on(time,face)).
|
||||
|
||||
type(time,[0,1,2]).
|
||||
|
||||
type(face,[1,2,3]).
|
||||
|
||||
universe(['X'],[0,1,2]).
|
||||
universe(['X1'],[0,1,2]).
|
||||
universe(['Y'],[1,2,3]).
|
21
packages/cplint/examples/throws.cpl
Normal file
21
packages/cplint/examples/throws.cpl
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
no
|
||||
?- s([throws(mary),throws(john),break],P).
|
||||
P = 0.46 ?
|
||||
yes
|
||||
?- s([throws(mary),throws(john),\+break],P).
|
||||
P = 0.04 ?
|
||||
yes
|
||||
?- s([\+ throws(mary),throws(john),break],P).
|
||||
P = 0.3 ?
|
||||
yes
|
||||
?- s([\+ throws(mary),throws(john),\+ break],P).
|
||||
P = 0.2 ?
|
||||
yes
|
||||
?-
|
||||
*/
|
||||
|
||||
break : 0.8 :- throws(mary).
|
||||
break : 0.6 :- throws(john).
|
||||
throws(mary) : 0.5.
|
||||
throws(john).
|
6
packages/cplint/examples/throws.uni
Normal file
6
packages/cplint/examples/throws.uni
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
type(person,[mary,john]).
|
||||
|
||||
mode(break).
|
||||
|
||||
mode(throws(person)).
|
13
packages/cplint/examples/trigger.cpl
Normal file
13
packages/cplint/examples/trigger.cpl
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
|
||||
?- s([death],P).
|
||||
P = 0.305555555555556 ?
|
||||
yes
|
||||
?-
|
||||
*/
|
||||
|
||||
death : 1/6 :- pull_trigger(left_gun).
|
||||
death : 1/6 :- pull_trigger(right_gun).
|
||||
|
||||
pull_trigger(left_gun).
|
||||
pull_trigger(right_gun).
|
4
packages/cplint/examples/trigger.uni
Normal file
4
packages/cplint/examples/trigger.uni
Normal file
@@ -0,0 +1,4 @@
|
||||
mode(death).
|
||||
mode(pull_trigger(gun)).
|
||||
|
||||
type(gun,[left_gun,right_gun]).
|
21
packages/cplint/examples/twosideddice.cpl
Normal file
21
packages/cplint/examples/twosideddice.cpl
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
|
||||
s([on(3,1)],P).
|
||||
P = 0.0625
|
||||
sc([on(3,1)],[on(2,1)],P).
|
||||
P = 0.5 ?
|
||||
|
||||
sc([on(4,1)],[on(2,1)],P).
|
||||
P = 0.25
|
||||
|
||||
sc([on(10,1)],[on(2,1)],P).
|
||||
P = 0.00390625
|
||||
|
||||
|
||||
*/
|
||||
on(0,1):0.5;on(0,2):0.5.
|
||||
|
||||
on(X,1):0.5;on(X,2):0.5:-
|
||||
X1 is X-1,X1>=0,
|
||||
on(X1,Y),
|
||||
\+ on(X1,2).
|
14
packages/cplint/examples/win.cpl
Normal file
14
packages/cplint/examples/win.cpl
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
?- s([win(white)],P).
|
||||
P = 0.5 ?
|
||||
yes
|
||||
?- s([win(black)],P).
|
||||
P = 0.5 ?
|
||||
yes
|
||||
?- s([win(black),win(white)],P).
|
||||
P = 0 ?
|
||||
*/
|
||||
|
||||
win(white) :- \+ win(black).
|
||||
win(black):- \+ win(white).
|
||||
win(white) : 0.5 ; win(black) : 0.5.
|
6
packages/cplint/examples/win.uni
Normal file
6
packages/cplint/examples/win.uni
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
mode(win(player)).
|
||||
|
||||
|
||||
type(player,[white,black]).
|
||||
|
Reference in New Issue
Block a user