Home      Affiliated Colleges      Course content      First Sem     Second Sem     Third Sem     Fourth Sem     Fifth Sem     Sixth Sem     Seventh Sem     Eighth Sem     Lab report 4th sem     Contact    

Thursday, January 27, 2011

Artificial Intelligence: Prolog Program for Solving Medical Diagnosis problem:

startmd:- medDiagnosis.
medDiagnosis:-
retractall(known(_,_,_)),
write('MEDICAL DIAGNOSTICS SYSTEM'),
write('\n------------------------------------------------------\n\n'),
write('Enter the patients name:'),
read(Patient),
hypothesis(Patient,Disease),
write('\n\n'),write(Patient),write('has'),write(Disease),nl.
medDiagnosis:-
write('\n\nCould not diagnose the disease\n\n').
hypothesis(Patient, disease_one):-
 symptom(Patient,cough),
 symptom(Patient,headache).
hypothesis(Patient,disease_two):-
 symptom(Patient,fever),
 symptom(Patient,headache).
hypothesis(Patient,disease_three):-
 symptom(Patient,fever),
 symptom(Patient,cough).
symptom(Patient,Symptom):-
known(y,Patient,Symptom),
!.
symptom(Patient,Symptom):-
known(_,Patient,Symptom),
!, fail.
symptom(Patient,Symptom):-
write('\n\tDoes '),write(Patient),write('has'),
write(Symptom),write(' ?(y/n) :' ),
read(Reply),
asserta(known(Reply,Patient,Symptom)),
Reply=y.

No comments:

Post a Comment

^ Scroll to Top Related Posts with Thumbnails ^ Go to Top