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

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

关于多Agent系统的研究

  • 62 次阅读
  • 3 次下载
  • 2025/6/7 2:54:31

@Plan(trigger = @Trigger(goals = TranslateGoal.class)) public String translatePlan(String ewordString) { return wordTable.get(ewordString); } }

然后创建一个BDI文件,直接把capability嵌入到Agent的一个成员使用。非常简单方便。

package a2;

import jadex.bdiv3.BDIAgent;

import jadex.bdiv3.annotation.Capability; import jadex.micro.annotation.Agent; import jadex.micro.annotation.AgentBody; import jadex.micro.annotation.Description; @Agent

@Description(\) publicclassTranslateBDI { @Agent

protected BDIAgent translateAgent;

@Capability

protected TranslateCapa capa = new TranslateCapa();

@AgentBody

publicvoidbody(){

String eword = \;

String cnword = (String) translateAgent.dispatchTopLevelGoal(capa.new TranslateGoal(eword)).get();

System.out.println(\翻译完成:\ + eword + \ + cnword); } }

总结一下:capability就是一个模块,大家都可以调用来使用。好处减少了开发的资源浪费。但是需要很好的设计基础,才可以使用capability。

本篇主要是讲解一下,关于两个或者多个Agent之间,是如何进行通信的。

1. 简单介绍

对于Agent之间的交互是很有必要得。当今社会没有任何一件事情可以让单独的个体来完成。生活在一个community环境里,就需要相互之间的信息传递。那么在Jadex中,交互是一种服务,service。而这种service是被定义为接口类型的。具体的交互实现是需要单独来完成。单单理解起来可能还是比较困难的,可以看一下多代理系统的BDI介绍。

2. 实例讲解

这里主要实现的是两个Agent之间的交互。我们定义一个用户Agent,和一个翻译Agent。用户Agent发出一个翻译请求之后,翻译Agent就会自动查找自己的词典库,知道找到相应的翻译结果之后,返回给用户Agent,进而实现两个Agent之间的交互。 首先是接口,长这个样:

package a3;

import jadex.commons.future.IFuture;

publicinterfaceITranslateServ {

public IFuturetranslateEnglishChinese(String ewordString); }

其次是翻译Agent,长成这个样:

package a3;

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

import jadex.bdiv3.BDIAgent;

import jadex.bridge.service.annotation.Service; import jadex.commons.future.Future; import jadex.commons.future.IFuture; import jadex.micro.annotation.Agent;

import jadex.micro.annotation.AgentCreated; import jadex.micro.annotation.Description; import jadex.micro.annotation.ProvidedService; import jadex.micro.annotation.ProvidedServices; @Agent

@Description(\) @Service

@ProvidedServices(@ProvidedService(type = ITranslateServ.class))

publicclassTranslateBDIimplementsITranslateServ { @Agent

protected BDIAgent translateAgent;

protected Map wordTable;

@AgentCreated publicvoidinit() {

this.wordTable = new HashMap(); wordTable.put(\, \牛奶\);

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

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

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

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

publicTranslateBDI() { }

@Override

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

共分享92篇相关文档

文档简介:

@Plan(trigger = @Trigger(goals = TranslateGoal.class)) public String translatePlan(String ewordString) { return wordTable.get(ewordString); } } 然后创建一个BDI文件,直接把capability嵌入到Agent的一个成员使用。非常简单方便。 package a2; import jadex.bdiv3.BDIAgent; import jadex.bdiv3.annotation.Capability; import jadex.micro.annotation.Agent; import jadex.micro.annotation.AgentBody; im

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价: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