我目前正在学习面向代理的编程, 而且我很难找到用任何语言编写的示例代码,这些代码是为了在实际编程模型中演示该想法而编写的。
任何人都可以提供一个链接,其中编写了一段简单的代码来演示 AOP 的思想吗?
最佳答案
首先,让我们试着对什么是AOP有个共同的认识。从 Yoav Shoham (1993) 撰写的“面向代理的编程”论文中,我们有:
Agent-oriented programming (AOP), can be viewed as a specialization of object-oriented programming. The state of an agent consists of components such as beliefs, decisions, capabilities, and obligations; for this reason the state of an agent is called its mental state. The mental state of agents is described formally in an extension of standard epistemic logics: beside temporalizing the knowledge and belief operators, AOP introduces operators for obligation, decision, and capability. Agents are controlled by agent programs, which include primitives for communicating with other agents. In the spirit of speech act theory, each communication primitive is of a certain type: informing, requesting, offering, and so on.
这个概念的一个很好的实现是 Jason,在 Rafael H. Bordini、Jomi Fred Hübner 和 Michael Wooldridge(2007 年)撰写的“使用 Jason 在 AgentSpeak 中编程多代理系统”一书中对此进行了详细的解释。
查看 AOP 的应用程序可能是这个小应用程序: https://github.com/cleberjamaral/beersponsor
在这个简单的应用程序中有 3 个代理,一个机器人,一个(机器人的)所有者和一个赞助商。这个想法是,主人想喝啤酒,而机器人会带来他想要的所有啤酒。但是在一些交付之后冰箱里的啤酒用完了,所以,一个 Java IDE 被启动,用户可以点击向这个懒惰的家伙赞助啤酒。
要运行它,您可以下载 Jason 并运行 JEdit (Java -jar JEdit.jar),它是 Jason 的编程 IDE。 https://sourceforge.net/projects/jason/
您可以在此处获得有关此简单实现的更多详细信息:http://jasonagents.blogspot.com.br/2015/09/exemplo-de-integracao-com-interface.html
关于面向代理的编程代码示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48354916/