当前位置:文档之家› 植物识别系统

植物识别系统

人工智能技术导论
——小型专家系统
班级:计算机科学与技术12092311
学号:12905333
学生姓名:陈铮
植物识别系统
1. 题目: 这是一个简单的植物识别系统,有:海带、睡莲、水仙、荷花、仙人球、柳树、牡丹、香樟 8 种植物。

使用这个系统,只需根据窗口提供的内容回答“yes”或“no”,系统将会帮你选择你可能想要了解的植物。

2.该专家系统设计植物的特性是:
(1)水生(5)可食用
(2)陆生(6)不可食用
(3)有香气(7)有叶
(4)无香气(8)无叶
2、谓词定义
do_expert_job
do_consulting
ask (symbol, symbol)
plant_is (symbol)
positive(symbol,symbol)
negative (symbol,symbol)
remember (symbol,symbol,symbol)
clear_facts
3、程序
/* zhuanjia. pro */
/*程序:植物专家*/
/*目的:显示一个专家的工作*/
/*这是一个生产rule_based系统*/ /*注:这是一个植物分类专家系统*/ /*它使用一组用于生产规则*/
/* 目的推断*/
% 域说明
% 指定类型,为符号(symbol) domains /*说明谓词*/
database
xpositive(symbol,symbol)
xnegative(symbol,symbol) predicates
do_expert_job
do_consulting
ask(symbol, symbol)
plant_is(symbol)
positive(symbol,symbol)
negative(symbol,symbol)
remember(symbol,symbol,symbol) clear_facts
goal /*目标段*/
do_expert_job.
clauses /*字句段*/
/*用户接口系统*/
do_expert_job:-
makewindow(1,7,7,"AN EXPERT SYSTEMS", 1, 16,15,58),
/*用户接口界面设置*/
nl,write(" ******************************************"), nl,write(" WELCOME TO AGOG EXPERT SYSTEM "),
nl,write(" This is a plant identification system "),
nl,write(" Please respond by typing in "),
nl, write(" 'yes' or 'no'. Thank you "),
nl, write(" "),
nl, write ("***************************************"),
nl, nl,
do_consulting,
write("Press space bar."),nl,
readchar(_),
clearwindow,
exit.
do_consulting:-
plant_is(X),!,
nl,write("Your want to find the plant may be a(n) ",X,"."),nl,
clear_facts.
do_consulting:-
nl,write("Sorry, unabie to determine the plant."),nl,
clear_facts.
ask(X,Y):-
write("Question:-",X," it ",Y,"?"),
readln(Reply),
remember(X,Y,Reply).
/*推理BIGING */
positive(X,Y):- xpositive(X,Y), !.
positive(X,Y):- not(negative(X,Y)),!,ask(X,Y).
negative(X,Y):- xnegative(X,Y), !.
remember(X,Y,yes):- asserta(xpositive(X,Y)).
remember(X,Y,no):- asserta(xnegative(X,Y)),fail.
clear_facts:- retract(xpositive(_,_)),fail.
clear_facts:- retract(xnegative(_,_)),fail.
/* 生产规则*/
plant_is("haidai"):-
positive(is,"shuisheng"),
positive(is,"youxiangqi"),
positive(is,"keshiyong"),
positive(is,"wuye"),!.
plant_is("shuilian"):-
positive(is,"shuisheng"),
positive(is,"youxiangqi"),
positive(is,"keshiyong"),
positive(is,"youye"),!. plant_is("shuixian"):-
positive(is,"shuisheng"),
positive(is,"youxiangqi"),
positive(is,"bukeshiyong"),
positive(is,"youye"),!. plant_is("hehua"):-
positive(is,"shuisheng"),
positive(is,"youxiangqi"),
positive(is," keshiyong"),
positive(is,"youye"),!. plant_is("xianrenqiu"):-
positive(is,"lusheng"),
positive(is,"wuxiangqi"),
positive(is,"bukeshiyong"),
positive(is,"wuye"),!. plant_is("liushu"):-
positive(is,"lusheng"),
positive(is,"wuxiangqi"),
positive(is,"bukeshiyong"),
positive(is,"youye"),!. plant_is("mudan"):-
positive(is,"lusheng"),
positive(is,"youxiangqi"),
positive(is,"bukeshiyong"),
positive(is,"youye"),!. plant_is("xiangzhang"):-
positive(is,"lusheng"),
positive(is,"youxiangqi"),
positive(is,"bukeshiyong"),
positive(is,"wuye"),!.
/* 结束*/
4、程序截图
界面一:程序运行。

界面二:找不到合适的结果。

界面三:找到符合要求的结果。

相关主题