freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

jade筆記-文庫(kù)吧

2025-07-18 14:01 本頁(yè)面


【正文】 。最后, behaviours可以動(dòng)態(tài)的加入到 agent 以及 posite behaviours。 agent 通訊: ACL( agent munication language) Jade 的 agent 之間進(jìn)行通信使用的 acl語(yǔ)言遵循 fipa acl規(guī)范。一個(gè) acl消息通常包含這些參數(shù): sender:消息的發(fā)送者 ,用 agent 標(biāo)志 AID 表示; receivers,接受 agent 消息的 agent可以是多個(gè); Replyto,應(yīng)受到回應(yīng)的接受者; Performative:標(biāo)志 發(fā)送 消息的目的,即發(fā)送者 想 要 通 過(guò)發(fā) 送 消息 干什么 , 通 常有 這 樣 一些 常 值: REQUEST, INFORM, ACCEPT_PROPOSAL, REJECT_PROPOSAL, PROPOSE; Content,消息的內(nèi)容; 內(nèi)容 語(yǔ)言,比如內(nèi)容的編碼格式; ontology,雙方都能夠理解的消息內(nèi)容的概念說(shuō)明和語(yǔ)義描述。 簡(jiǎn)單實(shí)例 發(fā)送者: import 。 import 。 import .*。 import .*。 import .*。 public class SimpleSender extends Agent { protected void setup() { addBehaviour(new SimpleBehaviour(this) { private boolean finished = false。 public void action() { (getLocalName() +: about to inform bob hello)。 //we sleep here to give bob a chance to start. doWait(5000)。 AID r = new AID()。 (bob)。 ACLMessage msg = new ACLMessage()。 // set performative (getAID())。 (r)。 (Hello_BOB)。 send(msg)。 (getLocalName() +: Send hello to bob)。 finished = true。 doWait(5000)。 doDelete()。 } public boolean done(){ return finished。 } })。 } } 這段代碼的主要執(zhí)行過(guò)程為: 構(gòu)建一個(gè) AID, 以此來(lái) 指出該消息的目的 Agent。這里我們指定目的為一個(gè)本地的 Agent,名字為 bob。建立一個(gè) ACL消息標(biāo)志其 performative為 INFORM。設(shè)定 Sender 為自身, 指定接收者為 bob。然后發(fā)送消息內(nèi)容。 打印相關(guān)信息。 接收者:他的名字必須為 bob import .*。 import .*。 import 。 public class SimpleReceiver extends Agent { class DoSimpleReceiveBehaviour extends SimpleBehaviour { private boolean finished = false。 public DoSimpleReceiveBehaviour(Agent agent){ super(agent)。 } public void action() { ACLMessage msg = receive()。 if (msg!= null){ (getLocalName() + : received the following message : )。 (())。 finished = true。 ()。 }else{ (getLocalName() + :No message received, Blocking the behaviour till one is)。 block()。 } } public boolean done() { return finished。 } } protected void setup() { DoSimpleReceiveBehaviour behaviour = new DoSimpleReceiveBehaviour(this)。 addBehaviour(behaviour)。 } } 接收者的代碼流程為: 添加一個(gè)簡(jiǎn)單行為 , 這一行為 檢查現(xiàn)在是否有受到消息,若沒(méi)有,則執(zhí)行 block()方法組織目前的 behaviour 執(zhí)行,直到有新的消息到達(dá)。 復(fù)雜實(shí)例 FIPA 定義了一組交互協(xié)議,包括 FIPArequest, FIPAquery, FIPArequestwhen, FIPAcontract, FIPAIterater, FIPAAuctionEnglish, : REQUESTINFORM: A請(qǐng)求 B 做一些工作, B 可以同意或拒絕。如果 B同意,則會(huì)去完成并告訴 A該工作已經(jīng)完成。 等等。 Query: A想知道一些事情, B 可以同意或不同意,并將 B 的回應(yīng)告訴 A。 Propose:在給定一些 precondition 的條件下,提出一個(gè) proposal去執(zhí)行某些動(dòng)作。 在 beans 中創(chuàng)建常規(guī)項(xiàng)目:其代碼文件有兩個(gè),分別為 package ips。 import 。 import 。 import .*。 import .*。 import .*。 import 。 import 。 import 。 import 。 public class SimpleRequestInitiator extends Agent{ static class MarriageProposer extends SimpleAchieveREInitiator{ protected MarriageProposer(Agent agent, ACLMessage msg){ super(agent, msg)。 } protected void handleAgree(ACLMessage msg) { (() + : 吼吼 ! + ().getLocalName() + 已經(jīng)同意嫁給我了 , I39。m so excited!)。 } protected void handleRefuse(ACLMessage msg) { (() + : Oh no! + ().getLocalName() + 拒絕了我 , i feel sad.)。 } protected void handleInform(ACLMessage msg) { (() + : + ().getLocalName() + has informed me of the status of my request. + They said : + ())。 } protected void handleNotUnderstood(ACLMessage msg){ (() + : + ().getLocalName() + has indicated that they didn39。t understand.)。 } protected void handleOutOfSequence(ACLMessage msg) { (() + : + ().getLocalName() + has sent me a message which I wasn39。t + expecting in this conversation)。 } } protected void setup() { (getLocalName() +: about to propose marriage to bob )。 doWait(5000)。 //wait for bob to be started. ACLMessage msg = new ACLMessage()。 AID to = new AID()。 (bob)。 (getAID())。 (to)。 (Marry Me!)。 ()。 addBehaviour(new MarriageProposer(this, msg))。 } } 還有: package ips。 import 。 import 。 import .*。 import .*。 import .*。 import 。 import 。 import 。 import 。 public class SimpleRequestResponder extends Agent { static class MarriageResponder extends SimpleAchieveREResponder{ public MarriageResponder(Agent agent){ super(agent,createMessageTemplate())。 } protected ACLMessage prepareResponse(ACLMessage msg) { ACLMessage response = ()。 if(()!=null amp。amp。 ().equals(Marry Me!)){ (() + : + ().getLocalName() + has asked me to marry him!)。 AID sender。 sender = ()。 if(().equals(baz)){ ()。 (() + :I39。m going to agree.)。 }else{ ()。 (() + :I39。m going to turn him down.)。 } }else{ ()。 (() + :I didn39。t understand what + ().getLocalName() + just said to me.)。 } return response。 } protected ACLMessage prepareResultNotification(ACLMessage inmsg, ACLMessage outmsg) { //what they have asked is now plete (or if it failed) ACLMessage msg = ()。 ()。 (I Do!)。 return msg。 } } protected void setup() { (getLocalName() + : I wonder if anybody wants to marry me?)。 addBehaviour(new MarriageResponder(th
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1