CompAPO: A complete version of the APO Algorithm Tal Grinshpoun and Amnon Meisels Department of Computer Science Ben-Gurion University of the Negev
Talk outline Distributed Constraint Satisfaction Problems The APO algorithm A flaw in APO’s correctness proof Running APO on our example Identifying the problems Solving the problems Preliminary experimental evaluation
The Nurses example Three Shifts: S 1 8:00 – 16:00, S 2 16:00 – 24:00, S 3 24:00 – 8:00 Three Nurses: Nurses: Anna, Bella, Clarissa Constraints: Personal: Anna can’t work between 8:00 – 9:00 Bella Can’t work between 17:00 – 20:00 Clarissa Can’t work nights System: One nurse for every shift
NP-complete problem, relevant for real-world problems such as timetabling, scheduling verification... Structure: [V,D,R] (Variables shifts, Domains of Values nurses, Constraints) V 1, V 2, … V n [val 1,val 2,val 3 ][val 1,val 2 ][val 1,val 2,val 3 ] Constraint Satisfaction Problem
Two wards in a Hospital Nurses – ward 1: Diana, Emilia, Flora ward 2: Anna, Bella, Clarissa Anna, Bella, Diana are ‘Senior’ nurses In every shift there should be at least one senior nurse S3S3 S1S1 S2S2 S3S3 S1S1 S2S2 First wardSecond ward Local Constraint Inter Constraint One senior nurse A Distributed CSP example
APO algorithm – overview 1. The problem is partitioned into groups 2. In each group a mediator is selected 3. Each mediator solves its local problem trying to minimize external constraints 4. Violated external constraints lead to growth of the group 5. If consistent – stop 6. Else, update the partitioning and goto 2
Some building blocks… p i – agent’s priority Highest priority among conflicted agents mediator m i – agents’ desire to mediate Switched on by conflicts mediate – participating in mediation session If invited, generates a wait! message good_list, agent_view – dynamic lists of relevant agents Attempts to include all externally conflicting agents!!! A very complicated algorithm…
A1 A5 A9 A8 A7 A3 An example A4 A2 A6
Violated constraint A1 A5 A9 A8 A7 A3 A2, A5, A7 and A8 Send ok? too Initialization A4 A2 A6 ok?
A1 A5 A9 A8 A7 A3 Attempt to mediate A4 A2 A6 Can NOT change itself – has to mediate evaluate?
A1 A5 A9 A8 A7 A3 Mediation by A4 A4 A2 A6 evaluate! Mediation group Mediator
APO correctness proof * Key point - growth of initially partitioned groups * As presented in: Roger Mailler and Victor Lesser, “Asynchronous partial overlay: A new algorithm for solving distributed constraint satisfaction problems”, JAIR, Group size (good_list) is increased Group size (good_list) is not increased Algorithm is complete Infinite looping through values may occur
Our example A DisCSP with 8 agents, to allow at least 2 concurrent mediations We assume finite message delays The problem to be solved – variation of a coloring problem
Solid lines – regular coloring constraints Dashed lines – allow all except (G,G) and (B,B) A2A1 A3 A4 A5A6 A7 A8 The example
Violated constraint A2A1 A3 A4 A5A6 A7 A8 ok? A4, A8 and A7 Send ok? too Initialization – configuration 1
Can NOT change itself – has to mediate A2A1 A3 A4 A5A6 A7 A8 evaluate? Can NOT change itself – has to mediate Attempt to mediate
A2A1 A3 A4 A5A6 A7 A8 evaluate! Mediation group Mediator Mediation by A1
Meanwhile…
A2A1 A3 A4 A5A6 A7 A8 evaluate? Concurrent mediation
A2A1 A3 A4 A5A6 A7 A8 evaluate? evaluate! wait! evaluate! Concurrent mediation
A2A1 A3 A4 A5A6 A7 A8 Sub-problem is consistent, no external constraints violated, so good_list of A1 is NOT expanded Special coloring constraint Mediation result
A2A1 A3 A4 A5A6 A7 A8 accept! Announce mediation result
A2A1 A3 A4 A5A6 A7 A8 ok? A3A8 A3 ok? ok? message delay
A2A1 A3 A4 A5A6 A7 A8 evaluate? A3A3 Remember ME? evaluate! A3A3 Concurrent mediation A8
A2A1 A3 A4 A5A6 A7 A8 A3A3 A3A3 Problem consistent! No external Constraints violations Concurrent mediation A8
A2A1 A3 A4 A5A6 A7 A8 A3A3 A3A3 accept! Assignment notification A8
A2A1 A3 A4 A5A6 A7 A8 Can NOT change itself – has to mediate Can NOT change itself – has to mediate All ok? messages arrive (configuration 3)
A2A1 A3 A4 A5A6 A7 A8 …back at configuration 1
Identifying the problems Partial mediation sessions good_list does not grow Failing to get a lock when the good_list is full Neighboring mediation sessions Concurrent Sequential A2A1 A3 A4 A5A6 A7 A8 evaluate! wait! evaluate! A8 A2A1 A3 A4 A5A6 A7 A8 A3
An aggressive approach Bumping into ongoing mediation sessions A well-coordinated approach Cancel the mediation session upon receiving a wait! message Agents are still aware of the mediator’s willingness to mediate Highest priority agent will eventually obtain a lock on all the agents in its good_list Preventing partial mediation sessions
Sequential mediation sessions Add to accept! messages the complete mediated solution Concurrent mediation sessions Maintain concList – list of agents that are potentially involved in a concurrent mediation session Inform the mediator post factum of conflicts created due to concurrent sessions Mediator adds the conflicting agent to its good_list good_list must grow (no partial mediation sessions) Handling neighboring mediation sessions
Two versions of APO APO-BB. The mediator performs a Branch and Bound search to minimize the number of violated external constraints [Mailler & Lesser 2005] APO-BT. The mediator finds the first satisfying solution [Benisch & Sadeh 2006] Setup: 15 agents, 1 variable each, 10 values. Random DisCSPs: P 1 (Density)= 0.4, P 2 (Tightness)= 0.3 – 0.9 Experimental evaluation
Handling neighboring mediation sessions – messages sent
Non-Concurrent Constraint Checks
Maximal mediation size
Thank you!
APO pseudo code
Preventing partial mediation sessions
Handling neighboring mediation sessions