80 likes | 229 Views
Fernando Miranda 5986/M (miras1@mail.telepac.pt). DIRECTIONAL ARC-CONSISTENCY ANIMATION. DIRECTIONAL ARC-CONSISTENCY (DAC) ALGORITHM.
E N D
Fernando Miranda 5986/M (miras1@mail.telepac.pt) DIRECTIONAL ARC-CONSISTENCYANIMATION
DIRECTIONAL ARC-CONSISTENCY (DAC) ALGORITHM This presentation animates the directional arc-consistency algorithm using the coloring graph problem as an example. For a better comprehension it is also presented here the arc-consistency algorithm between two variables also called here as revise.
DIRECTIONAL ARC-CONSISTENCY (DAC) ALGORITHM procedure REVISE((x1), x2) input: a subnetwork defined by two variables X = {xi, xj}, a distinguished variable xi, domains Di and Dj, and constraint Rij output: Di, such that xi is arc-consistency relative to xj. for each ai Di if there is no aj Dj such that (ai, aj) Rij then delete ai from Di endif endfor end procedure procedureDAC() input: a network =(X,D,C), its constraint graph G, and an ordering d = (x1, …, xn). output: a directional arc-consistent network for i = n to 1 by -1 do for each j < i such that Rij Dj ← Dj ∩ j(Rij Di), this is revise((xj), xi)) endfor endfor end procedure
x1 x2 Final domain: D1 = { , } D2 = { , , } First, it's explained how REVISE algorithm works. There are two variables x1 and x2 with their domain D1 and D2. D1 = { , , , } D2 = { , , } There is a constraint between x1 and x2. R12 = {equal} = x1 is arc-consistency relative to x2 One or more equal: stays No equal: removes
COLORING GRAPH PROBLEM x1 x3 x2 x4 x5 x6 x7
x1 x4 x5 x3 x6 x2 x7 Now, the variables of the network are put in the order d with all it’s relations. In this case it was chosen the order d = {x4, x5, x6, x7, x2, x3, x1} From x1 to x3 and x2 From x3 to x6 and x7 From x2 to x4 and x5
x1 x3 x2 x1 x4 x5 x4 x5 x6 x7 x3 x6 x2 x7 Finally, the DAC algorithm is applied to the variables in the reverse order: x1 to x3 and revise((x3), x1) X1 to x2 and revise((x2), x1) X3 to x7 and revise((x7), x3) X3 to x6 and revise((x6), x3) X2 to x5 and revise((x5), x2) X2 to x4 and revise((x4), x2) A directional arc-consistency network and luckily a solution!