BUGFIX: Weak agreement was not implemented according to Lowe's defintion. Now it is.

This commit is contained in:
Cas Cremers 2011-04-26 11:50:00 +02:00
parent 9f60184ba7
commit 828058c3b2

View File

@ -733,35 +733,38 @@ arachne_claim_weakagree (const System sys, const int claim_run,
const int claim_index) const int claim_index)
{ {
/* /*
* Runs for each role, with matching lists for rho. * Runs for each supposed agent, with matching *sets* for rho.
* (so we can skip the actor)
*/ */
Role role; Termlist tl;
for (role = sys->runs[claim_run].protocol->roles; role != NULL; for (tl = sys->runs[claim_run].rho; tl != NULL; tl = tl->next)
role = role->next)
{ {
if (role != sys->runs[claim_run].role) Term agent;
agent = tl->term;
if (!isTermEqual (agent, agentOfRun (sys, claim_run)))
{ {
int run; int run;
int roleokay; int agentokay;
roleokay = false; agentokay = false;
for (run = 0; run < sys->maxruns; run++) for (run = 0; run < sys->maxruns; run++)
{ {
if (run != claim_run) if (run != claim_run)
{ {
if (role == sys->runs[run].role) if (isTermEqual (agent, agentOfRun (sys, run)))
{ {
if (isTermlistEqual if (isTermlistSetEqual
(sys->runs[run].rho, sys->runs[claim_run].rho)) (sys->runs[run].rho, sys->runs[claim_run].rho))
{ {
roleokay = true; agentokay = true;
break; break;
} }
} }
} }
} }
if (!roleokay) if (!agentokay)
{ {
return false; return false;
} }