云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 关于多Agent系统的研究

关于多Agent系统的研究

  • 62 次阅读
  • 3 次下载
  • 2025/6/4 18:04:20

import jadex.bdiv3.annotation.Plan; import jadex.bdiv3.annotation.Plans; import jadex.micro.annotation.Agent; import jadex.micro.annotation.AgentBody; import jadex.micro.annotation.Description; @Agent

@Description(\) @Plans(@Plan(body=@Body(TranslatePlan.class))) publicclassTranslateEngChBDI { @Agent

protected BDIAgent translateAgent; @AgentBody

publicvoid body(){

TranslatePlan transPlan = new TranslatePlan(); translateAgent.adoptPlan(transPlan); } }

两点需要主要,首先要在Agent类的开始部分加上可能要使用的Plan,就是

@Plans(@Plan(body=@Body(TranslatePlan.class)))这一行。主要了,agent体中得body方法是在启动JCC的时候,自动被调用的。然后adopt这个Plan。 输出:Translated: teacher to Chinese is 老师

3.2 Plan作为一个内部类

package a1;

import java.util.HashMap; import java.util.Map;

import jadex.bdiv3.BDIAgent;

import jadex.bdiv3.annotation.Plan; import jadex.bdiv3.annotation.PlanBody; import jadex.micro.annotation.Agent; import jadex.micro.annotation.AgentBody; import jadex.micro.annotation.Description; @Agent

@Description(\) // @Plans(@Plan(body=@Body(TranslatePlan.class))) publicclassTranslateEngChBDI { @Agent

protected BDIAgent translateAgent; @Plan

publicclassTranslatePlan {

protected Map wordTable;

public TranslatePlan() {

this.wordTable = new HashMap();

// add some examples of word pairs wordTable.put(\, \牛奶\);

wordTable.put(\, \香蕉\);

wordTable.put(\, \学校\);

wordTable.put(\, \老师\);

wordTable.put(\, \科学\); }

@PlanBody

publicvoid translateEnglishChinese() { // Here we only test one example

System.out.println(\se is \

+ wordTable.get(\)); } }

@AgentBody

publicvoid body() {

TranslatePlan transPlan = new TranslatePlan(); translateAgent.adoptPlan(transPlan); }

}

不太建议把Plan作为内部类进行使用,懂编程的人,都知道为什么。对吧?可能我的经验不足,还是比较讨厌这种使用方法。

3.3 Plan作为方法使用

package a1;

import java.util.HashMap; import java.util.Map;

import jadex.bdiv3.BDIAgent;

import jadex.bdiv3.annotation.Plan; import jadex.micro.annotation.Agent; import jadex.micro.annotation.AgentBody; import jadex.micro.annotation.AgentCreated; import jadex.micro.annotation.Description; @Agent

@Description(\) // @Plans(@Plan(body=@Body(TranslatePlan.class))) publicclassTranslateEngChBDI { @Agent

protected BDIAgent translateAgent; protected Map wordTable;

搜索更多关于: 关于多Agent系统的研究 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

import jadex.bdiv3.annotation.Plan; import jadex.bdiv3.annotation.Plans; import jadex.micro.annotation.Agent; import jadex.micro.annotation.AgentBody; import jadex.micro.annotation.Description; @Agent @Description(\) @Plans(@Plan(body=@Body(TranslatePlan.class))) publicclassTranslateEngChBDI { @Agent protected BDIAgent translateAgent; @AgentBody publicvoid body(){

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com