博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JACK——BOM Exercise5
阅读量:7211 次
发布时间:2019-06-29

本文共 1994 字,大约阅读时间需要 6 分钟。

来源:

 

Use a JACOB initialisation file to initialise the BOM beliefset.

 

In this exercise, you will modify the Planner agent's constructor so that it no longer reads the data from the text file used in the earlier exercises. Instead, you will create a file in JACOB ASCII format that is read in either when the beliefset is constructed, or by using the beliefset read method in the agent's constructor.

 

1. Edit the Planner.agent and remove the code to read the BOM data from the filename passed into the constructor.

2. Modify the #private data BOM bom() declaration so that the filename is now passed to the BOM constructor (#private data BOM bom("bom.dat")).

3. Edit the file bom.dat so that it contains the data in JACOB ASCII format. An example data file is shown below.

<TupleTable

:tuples(

<BOM__Tuple

:component "table"

:subcomponent "leg"

>

<BOM__Tuple

:component "table"

:subcomponent "table_top"

>

)

>

4. Compile and run the program.

5. It is also possible to explicitly invoke the beliefset's read method to read data in JACOB ASCII format. This means that the filename can then be passed as a parameter to the agent's constructor.

  • If necessary, modify the Planner.agent so that the filename is passed in to its constructor.
  • Add the line

bom.read(filename);

in the Planner agent's constructor.

  • Remove the filename from the #private data BOM bom("bom.dat") declaration.
  • Compile and run the program.

 

 

运行结果

(1) a1 added to orders db:

(2) chair 10 30/01/05

(3) a2 added to orders db:

(4) table 50 20/02/05

(5) a3 added to orders db:

(6) cupboard 60 20/03/05

(7) seat is a subcomponent of chair

(8) chair_back is a subcomponent of chair

(9) arm is a subcomponent of chair

(10) leg is a subcomponent of chair

(11) leg is a subcomponent of table

(12) table_top is a subcomponent of table

 

运行结果分析

运行结果与例4相同,本例着重阐述信念集如何来源于JACOB ASCII 格式的文件。两种方式:(1)可以在Planner Agent声明信念集的时候,将JACOB文件的文件名传入;(2)也可以在PlannerAgent构造时,通过显式调用read()方法读取。

转载于:https://www.cnblogs.com/6DAN_HUST/archive/2011/06/16/2082535.html

你可能感兴趣的文章
中国光伏新增装机容量猛增
查看>>
数据库建立索引的原则
查看>>
林洋能源:布局能源互联网 分布式光伏龙头再扬帆
查看>>
理解 Linux/Unix 登录脚本
查看>>
C++程序设计:原理与实践(进阶篇)15.4 链表
查看>>
《C++面向对象高效编程(第2版)》——3.16 从函数中返回引用
查看>>
《JavaScript精粹(修订版)》——1.6 使用括号和分号结束符(一致的编码方式)...
查看>>
2.4 表单数据的验证
查看>>
《Android游戏开发详解》——第2章,第2.10节使用对象
查看>>
《OpenGL ES 2.0游戏开发(上卷):基础技术和典型案例》一第6章 让场景更逼真——光照效果...
查看>>
MongoDB介绍与安装
查看>>
《C语言接口与实现:创建可重用软件的技术》一1.5 习题
查看>>
《网页设计与前端开发 Dreamweaver+Flash+Photoshop+HTML+CSS+JavaScript 从入门到精通》—— 第1章 网页设计基础知识...
查看>>
Maven实战. 3.7NetBeans Maven插件简单使用
查看>>
Android开发技术周报 Issue#17
查看>>
《iOS 9 开发指南》——第6章,第6.7节iOS 9控件的属性
查看>>
this is incompatible with sql_mode=only_full_group_by
查看>>
TableView编辑状态下跳转页面的崩溃处理
查看>>
java操作阿里云的对象存储OSS
查看>>
linux 如何判断当前用户
查看>>