当前位置:文档之家› 北邮人工智能PROLOG实验报告

北邮人工智能PROLOG实验报告

实验报告
学院:计算机学院
课程名称:人工智能原理
实验名称:Prolog
班级:
姓名:
学号:
用PROLOG完成以下系统的编写。

給出代码和一个运行实例。

根据主要的燃烧材料,可把火灾归类。

把以下信息转换成规则,以决定火灾的类型。

A类火灾包括如纸、木和布等普通易燃物。

B类火灾包括易燃液体(如石油和石油气)、油脂和类似的物质。

C类火灾包括使用电力的电器。

D类火灾包括易燃的金属,如镁、钠、钾。

用来灭火的灭火器类型取决于火的类型。

把下面的信息转换成规则:A类火灾应该使用吸热或阻燃型灭火器灭火,如水或水类液体和无水化学品。

B类火灾应该通过隔绝空气、抑制易燃蒸汽的释放或终止易燃物的连锁反应来灭火。

灭火器包括无水化学品、二氧化碳、泡沫和含溴三氟甲烷。

C类火灾应该使用防短路的非导电媒质灭火。

如果可能的话,应切断电源。

灭火器包括无水化学品、二氧化碳和含溴三氟甲烷。

D类火灾应该使用焖熄法和不与燃烧金属发生反应的吸热化学品灭火。

这些化学品包括:三甲氧硼化物和涂有石墨的焦炭。

描述规则中所用的事实。

输出结果应显示可以使用何种灭火器以及应该采取的其他措施,如切断电源。

软件版本:Visual Prolog 5.2:
源代码FireExtinguisher如下:
predicates
FireA(symbol)
FireB(symbol)
FireC(symbol)
Fired(symbol)
Nondeterm treatment(symbol,symbol,symbol)
clauses
FireA(paper). /*纸*/
FireA(wood). /*木*/
FireA(cloth). /*布*/
FireB(oil). /*石油*/
FireB(oil_gas). /*石油气*/
FireB(fat). /*油脂*/
FireC(machine). /*电器*/
FireD(magnesium). /*镁*/
FireD(kalium). /*钾*/
FireD(natrium). /*钠*/
treatment(Material, " Heat absorbing or flame retardant type fire extinguisher \n" ," \n"):-FireA(Material).
treatment(Material, "Water chemical, carbon dioxide, foam and bromine containing three fluorine methane fire extinguisher\n" ,"
\n"):-FireB(Material).
treatment(Material, " Anhydrous chemicals, carbon dioxide, foam and bromine containing three fluorine methane fire extinguisher \n" ," Cut off the power supply \n"):-FireC(Material).
treatment(Material, " Trimethoxy boride and coated with graphite coke fire extinguisher \n" ," \n"):-FireD(Material).
goal
treatment(machine,Whatkind,How).
运行结果:。

相关主题