- In the header, replace
int __LABS_t with an array unsigned int clock[MAXCOMPONENTS]. Change the now() function so that it takes the agent's id as an argument.
- Inside
init(), increase clock[0] when initializing stigmergic variables. At the end, set all elements of clock to the value of clock[0].
- Change
confirm and propagate with a tie-breaking rule.
Feasible tie-breaking rules
Agent with lowest id "wins"
✅ original solution from Lamport,
✅ also the one used in Buzz
❌ requires to keep track of the id with another array Lid[MAXCOMPONENTS][MAXKEYL]
Smaller or equal Lvalue wins
✅ No changes to the data structures
❌ Requires some theoretical justification (eg. will the stigmergy be stable?)
int __LABS_twith an arrayunsigned int clock[MAXCOMPONENTS]. Change thenow()function so that it takes the agent's id as an argument.init(), increaseclock[0]when initializing stigmergic variables. At the end, set all elements ofclockto the value ofclock[0].confirmandpropagatewith a tie-breaking rule.Feasible tie-breaking rules
Agent with lowest id "wins"
✅ original solution from Lamport,
✅ also the one used in Buzz
❌ requires to keep track of the id with another array
Lid[MAXCOMPONENTS][MAXKEYL]Smaller or equal
Lvaluewins✅ No changes to the data structures
❌ Requires some theoretical justification (eg. will the stigmergy be stable?)