1 / 7
文档名称:

人工智能技术基础实验报告.docx

格式:docx   大小:368KB   页数:7页
下载后只包含 1 个 DOCX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

人工智能技术基础实验报告.docx

上传人:63229029 2017/1/16 文件大小:368 KB

下载得到文件列表

人工智能技术基础实验报告.docx

文档介绍

文档介绍:人工智能技术基础实验报告姓名: 学号: 班级: 指导教师: 完成时间: 实验一 PROLOG 语言编程练****1目的与要求实验目的: 加强学生对逻辑程序运行机能的理解,使学生掌握 PROLOG 语言的特点、熟悉其编程环境,同时为后面的人工智能程序设计做好准备。实验要求: (1 )程序自选,但必须是描述某种逻辑关系的小程序。(2 )跟踪程序的运行过程,理解逻辑程序的特点。(3 )对原程序可作适当修改,以便熟悉程序的编辑、编译和调试过程。 2实验环境 Turbo PROLOG 3实验内容在 Turbo PROLOG 或 Visual Prolog 集成环境下调试运行简单的 PROLOG 程序,如描述亲属关系的 PROLOG 程序或其他小型演绎数据库程序等。 4实验题目与结果(1) 源程序: domains d=integer predicates not_(D,D) and_(D,D,D) or_(D,D,D) xor(D,D,D) clauses not_(1,0). not_(0,1). and_(0,0,0). and_(0,1,0). and_(1,0,0). and_(1,1,1). or_(0,0,0). or_(0,1,1). or_(1,0,1). or_(1,1,1). xor(Input1,Input2,Output):- not_(Input1,N1), /*(1,0) */ not_(Input2,N2), /*(0,1) */ and_(Input1,N2,N3), and_(Input2,N1,N4), or_(N3,N4,Output). 实验结果: (2) 源程序: predicates student(integer,string,real) grade goal grade. clauses student(1,"zhang",). student(2,"li",). student(3,"wang",). grade:-write("Please input name:"),readln(Name), student(_,Name,Score), nl,write(Name,"grade is",Score). grade:-write("Sorry,the student cannot find!"). 实验结果: (3 )源程序: domains n,f=integer predicates factorial(n,f) goal readint(I), factorial(I,F), write(I,"!=",F). clauses factorial(1,1). factorial(N,Res):- N>0, N1=N-1, factorial(N1,1), Res=N*1. 实验结果: (4 )源程序: domains s=symbol predicates p(s) p1(s) p2(s) p3(s) p4(s) p5(s,s) p11(s) p12(s) p31(s) goal p(X),write("the x is ",X). clauses p(a1):-p1(b),p2(c). p(a2):-p1(b),p3(d),p4(e). p(a3):-p1(b),p5(f,g).