From: <jom...@us...> - 2016-04-06 15:11:35
|
Revision: 1881 http://sourceforge.net/p/jason/svn/1881 Author: jomifred Date: 2016-04-06 15:11:33 +0000 (Wed, 06 Apr 2016) Log Message: ----------- update CNET example Modified Paths: -------------- trunk/examples/contract-net-protocol/c.asl trunk/examples/contract-net-protocol/p.asl Modified: trunk/examples/contract-net-protocol/c.asl =================================================================== --- trunk/examples/contract-net-protocol/c.asl 2016-03-21 18:51:04 UTC (rev 1880) +++ trunk/examples/contract-net-protocol/c.asl 2016-04-06 15:11:33 UTC (rev 1881) @@ -21,22 +21,10 @@ .findall(Name,introduction(participant,Name),LP); .print("Sending CFP to ",LP); .send(LP,tell,cfp(Id,Task)); - // the deadline of the CNP is now + 4 seconds, so - // the event +!contract(Id) is generated at that time - .at("now +4 seconds", { +!contract(Id) }). + // the deadline of the CNP is now + 4 seconds (or all proposals were received) + .wait(all_proposals_received(CNPId), 4000, _); + !contract(Id). - -// receive proposal -// if all proposal have been received, don't wait for the deadline -@r1 +propose(CNPId,_Offer) - : cnp_state(CNPId,propose) & all_proposals_received(CNPId) - <- !contract(CNPId). - -// receive refusals -@r2 +refuse(CNPId) - : cnp_state(CNPId,propose) & all_proposals_received(CNPId) - <- !contract(CNPId). - // this plan needs to be atomic so as not to accept // proposals or refusals while contracting @lc1[atomic] @@ -67,4 +55,3 @@ +!announce_result(CNPId,[offer(_,LAg)|T],WAg) <- .send(LAg,tell,reject_proposal(CNPId)); !announce_result(CNPId,T,WAg). - Modified: trunk/examples/contract-net-protocol/p.asl =================================================================== --- trunk/examples/contract-net-protocol/p.asl 2016-03-21 18:51:04 UTC (rev 1880) +++ trunk/examples/contract-net-protocol/p.asl 2016-04-06 15:11:33 UTC (rev 1881) @@ -25,4 +25,3 @@ @r2 +reject_proposal(CNPId) <- .print("I lost CNP ",CNPId, "."); -proposal(CNPId,_,_). // clear memory - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |