A constraint maintenance system for the distributed resource ...

3 downloads 8044 Views 710KB Size Report
constraint maintenance system. ... maintenance of 2-consistency within G,. Constrainu ...... The authors are with the Department of Computer Science, Universily.
scope: scheduling; contribution: tools & techniques

A constraint maintenance system for the distributed resource allocation problem by Patrick Prosser, Chris Conway and Claude Muller The problem of allocating resources to activities may be decomposed into sub-problems, and these sub-problems may in turn be distributed across a society of problem-solving agents. Distribution may be due to the geographical nature of the problem, or may reflect the structure of the organisation within which the activities take place. However, we might anticipate some degree of coupling between sub-problems. Resources may be shared between agents, and relations may exist between activities. This may lead to agents making decisions that are locally consistent, but globally inconsistent. Therefore, we require a mechanism that will attempt to maintain consistency between agents and detect (and possibly avoid) conflicts that occur between agents. A system that addresses this problem is described, i.e. the distributed constraint maintenance system. 1 Introduction In the resource allocation problem we are given a set of operations, a set of resources and a set of constraints. An operation (for example, lecture 52.492) may be performed at specific time intervals (on Wednesday afternoon 13.00 to 17.00 or Friday morning 9.00 to 11.00) on specific resources (for example, room L103 or room L207). Resource constraints exist (in our example, the number of seats in a lecture room), as do temporal constraints (lecture 52.478a must occur at least two days before lecture 52.478b). The problem is then to bind operations to points in time on resources so that all of the constraints are satisfied (a legal schedule). It may be the case that the scheduling process takes place in a distributed environment. Continuing our example, we might suppose that each department schedules its own lectures. However, departments share lecture theatres, students may have lectures in many departments and (contrary to common belief) students can only be in one place at one time. Therefore, a decision made by one department might affect another. Further, the problem is dynamic. The problem may be relaxed, due to the cancellation of lectures, the deletion of temporal constraints between lectures, or due to more resources (rooms, time or lectures) being put at our disposal. Similarly, the problem may be restricted, by

adding lectures or constraints, or by withdrawing resources (rooms, time or lectures). Therefore, we have a problem that is distributed and dynamic. In order to address this style of problem-solving, we must establish a mechanism that will detect, and possibly avoid, the occurrence of conflicts between problem-solving agents, i.e. we would like to maintain a level of consistency between problem-solving agents. We might view the resource allocation problem as an instance of the constraint satisfaction problem (csp). An operation may be considered as a variable, the intervals of time for that operation as a temporal domain and the required resources as a resource domain. In addition, the temporal relations between operations may be considered as binary constraints between pairs of variables. The problem may then be represented as a constraints graph G, as in the work by Mackworth [l], where V(G)is the set of variables, A ( G )is the set of constraints and D,is the domain of variable v,. Within a constraint graph G, there is a range of consistency: 1-consistency (node consistency), 2consistency (arc consistency), 3-consistency (path consistency), and more generally, k-consistency [2, 31. If a constraint graph is made k-consistent, then we are assured that when we have assigned values to k - 1 variables, which satisfy the constraints involving these k - 1 variables, we will be guaranteed to find an instantiaINTELLIGENT SYSTEMS ENGINEERING AUTUMN 1992

76

I


VI), CI,dq f4, C4,1(v4fvl),C 3 , 4 ( ~ ) 3 # 2 ) 4 ) , and C 4 , , ( v 4 # v 3 ) After . a call to AC-3(Q), where Q = A(G,), Dl ={I, 4, D 2= (2, 31, D3={2}, and D,={l, 3). Assume that we restrict GI, by adding the constraints C,, 3(v2=v3) and C3,,(03=0,), to give G,. We can now return to a 2-consistent state by making a call to AC-3(Q), where Q is the set of constraints that have been added to GI, i.e. {C,, 3 , C3,,}. This will result in Dl = {l}, D,= { 2 } , D,= ( 2 ) and D,= 13). The arc consistent graph of G, is shown in Fig. 2. It can be seen that AC-3 is efficient with respect to restriction. In going from GI to G,, we need only make a call to AC-3(Q), where Q is the set of constraints added to GI. More generally, when we add a constraint Ct, we make a call to AC-3 with Q = {C,,J } ,and when we restrict the domain of variable v,, such that the new domain is a proper subset of the current domain, we make a call to AC-3 with Q={Ck,,1Ck,,EA(G), m=Z}. Assume that G, is relaxed by deleting the constraints C3, and C4,3 , to give G,. If we leave the domains of the variables unaltered, we will then be taking an overconstrained view of G,. Unfortunately, the only available action is to reset the domains of the variables as follows: D l 4 1 , 2, 31, D,+tl, 2, 31, D3+{21, D,+{l, 2, 31, and make a call to AC-3(Q) with Q equal to A:G,). This results in the 2-consistent graph of Fig. 3. We have immediately returned to the situation where D,= { l} and D,= (2). Clearly, D,= { l} and D,= (2) were never dependent on the deleted constraints C,, + and C4,), yet AC-3 had to repeat the same set of actions (i.e. the revision of C,, C2,I , C, and C,, 2 ) resulting in the same set of outcomes (D,+{l} and D,t{2}). In its present form, AC-3 is inefficient with respect to relaxation.

-

< >

#

#

~~

~

Fig. 2 2-consistent G,

,,

3 Maintaining local consistency This efficiency can be overcome by exploiting information made available during the process of domain filtering. At line 6 in AC-3, a call to revzse(Ck,,) has filtered out values from D, that were inconsistent with respect to D,. We can produce an explanation of this. Immediately after line 5 we capture the current value of D,. After the call to revzse(C,, ,), we produce an explanation for the filtered domain D k ;when the domain of v, is an improper subset of D,,and the constraint C,, exists, the consistent domain of vk is 0 ; . This is referred to as a reason r,, I (the xth reason for D,) and is represented as a 3-tuple (D,,C h , mDk). , Associated with each variable vk is a stack of reasons R,. Whenever the domain of a variable vk is restricted via AC-3, a corresponding reason r,, is created and pushed onto R k . The reason at the top of the stack R , gives a justification for believing Dk.When a variable is created, reason rk, = (nil, nil, D b )is pushed onto the empty stack Rk,and that reason may be considered as an assertion (r,, is not dependent on any other variable’s domain or the existence of any constraint), or as a unary constraint (the domain of vk is Dk). On termination of AC-3 on the constraint graph G,, we will have created the reasons shown in Table 1. Examining reason r,, , = ( { 1 , 2, 3}, CI,2,{1, 2)) (Table

Fig. 3 2-consistent G3

l), we see that it is dependent on reasons r l , o (the assertion that D,is initialised to {l, 2, 3)) and rz,o (the assertion that D, is initialised to {I, 2 , 3}), and the existence of the constraint C,, Therefore, reasons may be viewed as nodes within a dependency network, and that dependency network is shown in Fig. 4 for 2-consistent G, . A reason rh, = (D,,,, Ck, m, Dk)is no longer believed when any of the following events take place:

,.

the domain D, is relaxed. the constraint C,, ,is deleted. 0 the variable v, is deleted (which will, of course, cause the deletion of the constraints involving U,). 0

When reason rk,x is no longer believed, we no longer believe the reasons supported by rk,x.For example, if constraints C3, and C4, are deleted in G, (giving G3 of Fig. 3), we no longer believe reason r4, ({2}, C,,,, {l, 3}) in Fig. 4. Consequently, we no longer believe r4, = ({l},C,, ,, {3}) either. When rk,I is no longer believed, it is deleted, and when r,, I is deleted, the following actions are performed:

,

,

variable v, is added to the set relaxations. all reasons that are supported by rk, are deleted. a guess is made for D,,i.e. the value given by the reason at the top of the stack Rk. INTELLIGENT SYSTEMS ENGINEERING AUTUMN 1992

78

I

Table 1 Reasons for G2

Therefore, a relaxation causes the deletion of a reason, and the deletion of a reason initiates the propagation of that relaxation. Propagation takes place due to the second action. When the propagation of relaxations has terminated, we must revise the constraints thai involve the variables in the set relaxations. This prevents us from taking an under-constrained view of G. In particular, we make a call to AC-3(Q), where Q = (C,,,IC,,,EA(G), V , E relaxations). This has a pleasing symmetry. As we have already stated, when domains of variables are restricted, we collect those variables in the set restrictions and make a call to AC-3(Q), where Q = {C,,,1 C I , ,E A(G), V ~ restrictions}. E Returning to our example G 2 , if we delete the constraints C3,and C4, to give us G3, the following set of actions take place: reasons r4,I and r4, are deleted. v, is added to the set relaxations. the domain D, is set to (1, 2, 3). 0 a call is made to AC-3(Q) with Q = { C ,,}, resulting in D4+(2, 3) and the creation of r,, = ({l}, C4, (2, 3)). 0

0

Therefore, we have preserved information (Dl = { 1) and D,= {2}) and reduced the number of redundant calls to revise. However, in order to do this, we haire had to create and maintain a simple dependency netx ork. Essentially, the mechanism described above may be considered as a simple justification-based truth mainten-

tcl

/ I

/

I ’ \

Fig. 4 Dependency network for 2-consistent G, INTELLIGENT SYSTEMS ENGINEERING AUTUMN 1992

1

~

~

system (JTMS, [5]), engineered specifically for the task in hand. One significant difference between Doyle’s JTMS and ours is that reasons do not have an explicit belief status (typically O U T or I N ) . The belief status of a reason rt,11 is implicit. If we believe r,,11,then r,,I exists; otherwise r,, is deleted. Therefore, a reason cannot move from I N to O U T , and back to I N . For a reason to be IN we must create it anew. We delete reasons because we are (reasonably) confident that we will not recreate an identical reason in the future. For example, we may delete a reason rl, because we delete a constraint C,,,. We do not assume that sometime in the foreseeable future we will recreate that constraint. The deletion of reasons may therefore be considered as having an advantage and a disadvantage. Its advantage is that we do not need to maintain the belief status of reasons that are O U T , the (trivial) reason being that they do not exist. The disadvantage is that we may have to recreate reasons. This is analogous to ‘rediscovery’. Generally, we assume that the advantage far outweighs the disadvantage. ante

4 Comparisons with AC-4 We believe that it should be possible to maintain, and explain, local consistency using the AC-4 algorithm of Mohr and Henderson [4]. The AC-4 algorithm embraces the concept of support and can be considered as a twostage process. In the first stage, the immediate ‘support’ for labels are computed, i.e. the data structures counter[(i,j ) , b ] , S [ j , c],M [ i , b] and List are built up. The array element counter[(i,J ] , b] is a measure of the support in 0, for the labelling of v, with the value b E D , .If label ( j , c) supports ( 2 , b ) , then (2, b ) E S [ j , c ] and counter[(i, j ) , b] is incremented. If no labelling of v, supports (i, b), then b is removed from D,, M [ i , b] is set to 1 and ( i , b ) is added to the List. In the second stage of AC-4, the ‘absence’ of support is propagated. Immediately after stage 1, if (j, c) E List, then there is no support for ( j , c). If some labelling ( i , b ) E S [ j , c ] was supported by ( j , c), we decrement the support counter[(i, j ) , b ] , and if this falls to zero, we add (i, b) to List, set M [ i , b] to 1, and remove b from D,.AC-4 terminates when List is empty. It is tempting to consider the above data structures as reasons. For example, if M[i, b] = 1, then b is not in D,, and we might expect an explanation for this to exist in the data structures. Unfortunately, this is not so. If b was removed from D,in the first stage of AC-4, we will not have an unambiguous explanation of how this happened. For example, assume that there was no support for (i, b ) in D,. counter[(i,j ) , b] will therefore be zero. However, k 79

_-

N2

NI

might also exist such that j < k and counter[(i, k ) , b] = 0, i.e. since there was no support for (i, b ) in D,, we did not need to measure the support for (2, 6 ) in D,.Therefore, on termination of AC-4, we will not know why (i, b) is disallowed. We might get around this by introducing another data structure called NS[i, b] (‘No Support for (i, b)’). If in stage 1 there is no support for (i, b ) in D,,we may set NS[i, b] to j . Now consider the case where (i, b ) is disallowed due to stage 2 of AC-4. In this case, j will exist such that (i, b) E S [ j , c]. Therefore, if NS[z, b] =nil, we know that ( i , b ) was removed in stage 2 and we can ‘trace back’ an explanation via S [ j , c], eventually terminating when NS[i, b] is not nil. Therefore, we can get a reasoning capability from AC-4 with a little additional effort. AC-4 can also be modified so that it addresses incremental restriction (the removal of values from domains or the addition of constraints). If a constraint C,,, is added to G, we call AC-4 with E = {(i, j ] } (and delete line 1 , and modify line 14 of AC-4 so that we add (2, b ) to List only in M[i, b] was set to 1 in this call to AC-4 [4]). When we remove a value c from D,,we set M [ j , c] to 1, set List to ((2, j ) } , set counter[(j, 11, c] to zero for all i, and perform step 2 of AC-4. As yet, we are unclear as to how AC-4 can be modified to address relaxation, although we believe that it should be possible. We expect that it will be a two-stage process, similar to that employed within a node within the DCMS. The first stage will propagate a relaxation and collect the set of supports in which we no longer have confidence. The second stage will then update those supports. We expect that this will result in a mechanism that is similar (in principle) to the belief maintenance technique described by Dechter and Dechter [6].

I

Fig. 5 2-consistent G

5 Distributed consistency In achieving distributed 2-consistency, we assume that we are given a constraint graph G and a set of nodes {NI,N,, . . . , N m } .A node N , contains a subgraph of G, i.e. G,, and N , is responsible for maintaining a locally 2-consistent view of that subgraph. In addition, a node N , must maintain a globally 2-consistent view of G, and must do this by communicating with other nodes. For example, assume we have the 2-consistent constraint graph G of Fig. 5 , initially with D ,= D 2 = D , = {I, 2, 3, 4}, and constraints Cl,2(vl ~ I ) , C,, 3(v2= a,- 11, and C,, ,(v3 = v 2+ I). Constraint graph G (Fig. 5) might be distributed across nodes N I and N,, so that node N I is responsible for variables v, and ZJ~, and node N, is responsible for variable ZJ,.We adopt the following convention. Assume that we have the symmetric constraints C,, and C,, b, and vk exists on N , and v, exists on NI (where ifj].We create a ‘remote copy’ of a, (i.e. vk,with domain D b ) on N , , and a ‘remote copy’ of v, (i.e. a ; , with domain D;)on N,. The constraint Ck,,exists on N,, and the constraint Cm, will exist on N,. When DI is changed (possibly due to AC-3 on node N , ) , we transmit that change to v ; on N I , and D, is then made consistent with respect to 0 ; . Conversely, when D, is changed, we transmit that change to vk on N , , and D,is then made consistent with respect to 0 ; . In Fig. 6 , we have distributed the constraint graph G (Fig. 5 ) such that V ( G , ) = { v ,a,, , v i } , A(G,)= {Cl,,,C 2 , , ,C2,J, V ( G 2 ) = { v ;4 , and A ( G 2 ) = G , J . We represent the ‘remote’ variable v: with concentric circles and assume that communication between nodes takes place across the ‘dotted lines’. The ‘locally complete’ communications policy of Durfee er al. [7] is adopted, along with the ‘focussed addressing’ of Parunak’s YAMS [8]. Associated with each node is a message buffer, through which the node receives notification of changes to its remote variables. In addition, if on node N, we have a variable v,, which has remote copies on other nodes, then N , is made aware of the ‘audience’ (the set of nodes) that takes an interest in changes to D,.When a node has processed all messages in its buffer, and has achieved 2-consistency, it then INTELLIGENT SYSTEMS ENGINEERING AUTUMN 1992

80

I

~

~-

I

.

/ _____1_____1

/

ig. 7 Dependency networks for G , and G, sends messages to nodes in its audience, if (and only if) the domains of variables have been changed. In Fig. 6 , node N I makes a call to AC-3(Q), where Q=A(G,), resulting in D l + ( l , 2}, D2+(2, 3) and D ; unchanged. Simultaneously, N2 makes a call to AC-3(Q), where Q=A(Gz), resulting in D3+{2, 3, 41 and D ; unchanged. Node NI then sends a message to N2informing it that D ; is now ( 2 , 3}, and N , sends a message to N I informing it that D ; is now ( 2 , 3, 4). On node N I , a call to AC-3(Q), where Q={C,,,}, has no effect. On node N,, the call to AC-3(Q), where Q={C,,}, results in D,+{3, 4). The process terminates with N , sending the new domain D , = {3, 4) to N I , followed by a final call to AC-3 on node N , , which has no effect.

6 Maintaining distributed consistency In the previous example (Fig. S ) , the reasons shown in Table 2 will have been produced on nodes Iv, and N,. The corresponding dependency networks, on nodes N I and N,, respectively, are shown in Fig. 7. The reasons drawn as concentric circles are ‘remote’ reasons. A ‘remote’ reason r6, I is created as a result of a change in the domain of a remote variable v i , i.e. when node N , receives a message stating that the domain of vk has been restricted on node N,, and the remote variable v ; exists on N , , N , creates a corresponding remote reason. An asterisk within a circle signifies that a message has been sent from that node. Therefore, node NI passes one message to N , (i.e. r,,,, which corresponds to the remote reason r;, , on node N , ) , and node N , passes two messages to node N I (i.e. r3, and z,, ,,which correspond to the remote reasons r;, I and r;, respectivelv, on node NI). We now consider relaxation. Assume that we delete the symmetric constraints C,, and C,, I . This will result

,

,,

,

,,

in the deletion of reasons (r,, ,, rl, r,, ,, r2,,} on N,, and D, and D , will be reset to (1, 2, 3, 4}.The set relaxations will then be ( v , , U,}, and a call is made to AC-3(Q), where Q=(C,,,}. This results in D , = { l , 2 , 3, 4}, D 2 = { 2 , 3) and D;={3, 4). Clearly, we are taking an overconstrained view of GI. D , should be (1, 2, 3) and D3 (and D ; ) should be ( 2 , 3, 4). We revised C 2 , 3with an obsolete view of 0;. The above scenario can be avoided by ‘time-stamping’ reasons. Whenever reason is created, the time of creation t,,, is recorded against that reason, i.e. a counter is maintained within each node. Whenever a reason is created, the counter is incremented and the reason is stamped with the value of that counter. The following rules are adopted. 0 1 Whenever reason r,, is deleted, delete all ‘remote’ reasons with a time-stamp greater than zL,x . 0 2 When a remote reason r;, is deleted, add v i to the set queries, i.e. no longer have confidence in the domains of the variables in quenes. 0 3 When the node is in a ‘locally complete’ state, request from that node’s audience the domains of the variables in the set qum’es.

,

For example, in Fig. 7 , the remote reasons r;, and r;, are deleted on node N I , and it is assumed that D ; is ( 1 , 2 , 3, 4)(using rule 1). Constraint C,, is then revised, resulting in D,+{l, 2, 3}. Domain D , is transmitted to node N,, along with a request for D ; (rule 3). Node N z then deletes reasons r;, and r3,,, creates a new remote reason r;, =(nil, nil, (1, 2 , 3)) and assumes that D , has changed due to the deletion of reason r,,, and N , automatically sends D , to node N I (and therefore can ignore the query from N,). Rule 1 may be interpreted as follows: ‘We delete a reason rt,I, which was created at time le, x , therefore we do

,

INTELLIGENT SYSTEMS ENGINEERING AUTUMN 1992

1

~~

~~

81

1

Table 2 Reasons for G, node N, and N,

not believe any information that has come from distant nodes after that time’. This is inefficient. It map be the case that there are remote reasons within the node that are in no way dependent on r,, This inefficiency can be overcome by a further enhancement to reasons. Generally, the reason r k , x = (D,,C, D k ) is created due to a successful call to revise(Ck,,). We associate the new attribute ITk, with a reason rk,x , where V k ,.c V(G) (a subset of the variables in the distributed constraint graph G). For all reasons rt3 (the assertions), V,- = {v,}. Whenever reason rk, is created due to revzse(Ck,,), we set Vk,r+Vk,x-l U V,,,, where r,, is the reason at the top of the stack R,. Rule 1 is then modified as follows: X.

0 1 whenever a reason r,,x is deleted, delete the set of ‘remote’ reasons

i.e. when we delete reason r , , x , we delete all remote reasons (reasons belonging to variable v ; ) created after rr, (time-stamp f k , y is greater than time-stamp Zt, r ) that are dependent on r,, (U, is in Vh,,). The attribute V , , xmay be interpreted as follows. Assume that we have a reason r,,I. If we trace back the derivation of that reason, we will visit the tariables in V t , x .If we consider the domains of variablrs at given points in time as assumptions, then V,,I is a conjunction of assumptions or an ‘environment’, as in de Kleer’s ATMS [9]. In fact, with the incorporation of’ attributes r,, and Vt,I, we might view the dependency network of reasons as a simple ATMS, engineered specificallyfor the task at hand. Therefore, we can modify rule 1 again, so that it becomes more general. 0 1 Whenever a reason r t , xis deleted, deletc the set of reasons {rk,ylfk,y