diff --git a/examples/contract-net-protocol-er/c.asl b/examples/contract-net-protocol-er/c.asl index 74284ba5..af9b4329 100644 --- a/examples/contract-net-protocol-er/c.asl +++ b/examples/contract-net-protocol-er/c.asl @@ -1,9 +1,3 @@ -/* Initial beliefs and rules */ - -all_proposals_received(CNPId, NP) // NP: number of participants - :- .count(propose(CNPId,_)[source(_)], NO) & // NO: number of proposes received - .count(refuse(CNPId)[source(_)], NR) & // NR: number of refusals received - NP = NO + NR. /* Initial goals */ @@ -45,3 +39,10 @@ all_proposals_received(CNPId, NP) // NP: number of participants } }. } + +/* Initial beliefs and rules */ + +all_proposals_received(CNPId, NP) // NP: number of participants + :- .count(propose(CNPId,_)[source(_)], NO) & // NO: number of proposes received + .count(refuse(CNPId)[source(_)], NR) & // NR: number of refusals received + NP = NO + NR. diff --git a/examples/contract-net-protocol-er/c_alt.asl b/examples/contract-net-protocol-er/c_alt.asl index 4fe687d2..fda327b2 100644 --- a/examples/contract-net-protocol-er/c_alt.asl +++ b/examples/contract-net-protocol-er/c_alt.asl @@ -1,12 +1,5 @@ // alternative implementation without .wait(), see plan for !bid -/* Initial beliefs and rules */ - -all_proposals_received(CNPId, NP) // NP: number of participants - :- .count(propose(CNPId,_)[source(_)], NO) & // NO: number of proposes received - .count(refuse(CNPId)[source(_)], NR) & // NR: number of refusals received - NP = NO + NR. - /* Initial goals */ !run. @@ -54,3 +47,10 @@ all_proposals_received(CNPId, NP) // NP: number of participants .send(Ag,tell,reject_proposal(Id)); }. } + +/* Initial beliefs and rules */ + +all_proposals_received(CNPId, NP) // NP: number of participants + :- .count(propose(CNPId,_)[source(_)], NO) & // NO: number of proposes received + .count(refuse(CNPId)[source(_)], NR) & // NR: number of refusals received + NP = NO + NR.