| عناوین بحث ها | ارسال کننده | پاسخها | بازدید | بروز رسانی | اولویت | |
|---|---|---|---|---|---|---|
|
|
0
|
97
|
88/6/15 (19:10)
|
|
||
|
|
0
|
13
|
89/1/7 (17:12)
|
|
||
|
|
0
|
284
|
87/12/20 (17:33)
|
|
||
|
|
0
|
2
|
90/9/10 (17:41)
|
|
||
|
|
2
|
5
|
90/8/21 (16:33)
|
|
||
|
|
0
|
3
|
90/8/19 (16:58)
|
|
||
|
|
0
|
1
|
90/8/19 (13:04)
|
|
||
|
|
6
|
80
|
90/8/14 (23:55)
|
|
||
|
|
4
|
174
|
90/8/12 (20:32)
|
|
||
|
|
1
|
40
|
90/8/12 (20:30)
|
|
||
|
|
0
|
0
|
90/8/12 (18:34)
|
|
||
|
|
0
|
4
|
90/8/9 (11:36)
|
|
||
|
|
0
|
1
|
90/8/3 (22:52)
|
|
||
|
|
0
|
5
|
90/6/8 (20:51)
|
|
||
|
|
2
|
82
|
90/5/11 (02:33)
|
|
||
|
|
0
|
5
|
90/4/18 (02:11)
|
|
||
|
|
0
|
12
|
90/4/16 (10:14)
|
|
||
|
|
0
|
13
|
90/4/14 (01:48)
|
|
||
|
|
0
|
13
|
90/3/5 (21:30)
|
|
||
|
|
3
|
94
|
89/12/14 (20:27)
|
|
Hi,
Firstly I thank you for your time.
Could you please do a favor for me?
I have some programs and I need you to correct them, explain in a few sentences and also answer the questions below related to the programs:
1-which search algorithm is used?
2-which programming language is used?
3-what is the knowledge base of it and how did you make it?
4-what is the role of Inference Engine in the program?
aslo my yahoo id is : r_rajaie2020@yahoo.com
First program:
%Goal:when A=4,B=0
goal([2,0]).
ch state determined with [A,B],A=amount of water in 4 liter container
%B=amount of water in 3 liter container
s([A,B],[0,B]). %Empty the 4 liter container.
s([A,B],[4,B]). %Fill up the 4 liter container.
s([A,B],[A,0]). %Empty the 3 liter container.
s([A,B],[A,3]). %Fill up the 3 liter container.
s([A,B],[4,C]):- %If the total of water in two container is more than 4 liter
A+B > 4, %,fill up 4 liter container with water of 3 liter container.
C is A+B-4.
s([A,B],[C,0]):- %If the total of water in two container is less than 4 liter
A+B < 4, %,empty water of 3 liter container into 4 liter container.
C is A+B.
s([A,B],[C,3]):- %If the total of water in two container is more than 3 liter
A+B > 3, %,fill up 3 liter container with water of 4 liter container.
C is A+B-3.
s([A,B],[0,C]):- %If the total of water in two container is less than 4 liter
A+B < 3, %,empty water of 4 liter container into 3 liter container
C is A+B.
%Member
member(X,[X|Tail]).
member(X,[Y|Tail]):-member(X,Tail).
%Conc
conc([],L,L).
conc([X|Tail1],L2,[X|Tail3])
onc(Tail1,L2,Tail3).
%reverse(A,RevA).
%This function reverse A and put in RevA.
reverse([A],[A]).
reverse([A|B],C):-
reverse(B,D),
conc(D,[A],C).
%Not
not(Goal):-Goal,!,fail;true.
pth-first search
solved(Node,Solution):-
depthfirst([Node],Node,[_|Sol]),
reverse(Sol,Solution).
depthfirst(Path,Node,[Node|Path]):-
goal(Node).
depthfirst(Path,Node,Sol):-
s(Node,Node1),
not(member(Node1,Path)),
depthfirst([Node1|Path],Node1,Sol).
%Bread-first search
solveb(Start,Solution):-
breadfirst([[Start]],Sol),
reverse(Sol,Solution).
breadfirst([[Node|Path]|_],[Node|Path]):-
goal(Node).
breadfirst([Path|Paths],Solution):-
extend(Path,Newpaths),
conc(Paths,Newpaths,Paths1),
breadfirst(Paths1,Solution).
extend([Node|Path],Newpaths):-
bagof([Newnode,Node|Path],
(s(Node,Newnode),
not(member(Newnode,[Node|Path]))),
Newpaths),
!.
extend(Path,[]).
-----------------------------
1)(x,y)->(x,3)
2)(x,y)->(x,0)
3)(x,y)->(4,y)
4)(x,y)->(0,y)
5)(x,y)->(y,0)
6)(x,y)->(x-(3-y),3) ;x+y>3
7)(x,y)->(4,y-(4-x)) ;x+y>=4
8)(x,y)->(x+y,0) x+y <= 4 , y>0
------------------------------
(x,y)->(0,y)->(0,3)->(3,0)->(3,3)->(4,2)->(0,2) ->(2,0) end
------------------------------------------------------------------------------------------------------------------------------
Second program:
**********Majmooe Argham**********
nd(0,0)
nd(n,f):- n1=n div 10,f1=n mod 10,nd(n1,f2),f=f1+f2
-----------------------------------------------------------------------------------------------------------------------------
third program:
**********Maghloob**********
add(X,Y,[X|Y]).
add(X,[Y1|Y2],[Y1|Z]) :- add(X,Y2,Z).
inv(0,0).
inv(n,x):- n1=n div 10 , x1=n mod 10 , inv(n1,x2),add(x1,x2,x).
------------------------------------------------------------------------------------------------------------------------------
fourth program:
boy(alireza)
boy(esmail)
boy(Ramin)
boy(karim)
boy(nima)
boy(mehdi)
boy(Armin)
boy(morteza)
boy(amin)
boy(ahmad)
boy(reza)
boy(shahab)
boy(ehsan)
boy(payam)
boy(habib)
boy(mohamad)
boy(Jafar)
girl(Mitra)
girl(mamak)
girl(melika)
girl(Simin)
girl(marzieh)
girl(Negar)
girl(parvin)
girl(akram)
girl(ghazal)
girl(Bahar)
girl(Samira)
girl(fati)
girl(Khatun)
father(esmail,alireza)
father(esmail,Negar)
father(esmail,ghazal)
father(esmail,Samira)
father(esmail,morteza)
father(alireza,Ramin)
father(alireza,mehdi)
father(alireza,Armin)
father(alireza,Simin)
father(morteza,amin)
father(morteza,marzieh)
father(karim,nima)
father(karim,melika)
father(Jafar,shahab)
father(Jafar,Bahar)
father(habib,ehsan)
father(habib,payam)
father(habib,fati)
father(mohamad,reza)
father(mohamad,parvin)
father(mohamad,ahmad)
father(mohamad,akram)
married(mohamad,Negar)
married(Jafar,ghazal)
married(Samira,habib)
married(esmail,Khatun)
married(alireza,Mitra)
married(Ramin,mamak)
married(karim,Simin)
mother(x,y):- married(z,x),father(z,y)
brother(x,y):- father(z,x),father(z,y),boy(x)
Khahar(x,y):- father(z,x),father(z,y),girl(x)
grandfather(x,y):- father(z,y),father(x,z)
grandfather(x,y):- mother(z,y),father(x,z)
grandmother(x,y) :- mother(x,z),mother(z,y)
grandmother(x,y) :- mother(x,z),father(z,y)
amu(x,y) :- father(z,y),brother(x,z)
ame(x,y) :- father(z,y),Khahar(x,z)
daee(x,y) :- Khahar(z,x),mother(z,y),boy(x)
khaleh(x,y) :- Khahar(z,x),mother(z,y),girl(x)
pesar_amu(x,y):-amu(z,x),boy(x)
dokhtar_amu(x,y):-amu(z,x),girl(x)
pesar_daee(x,y) :-daee(z,x),boy(x)
dokhtar_daee(x,y) :-daee(z,x),girl(x)
------------------------------------------------------------------------------------------------------------------------------