

![0_image_0.png](0_image_0.png)

During the second stage (fig.4), algorithm will assign priorities to the agents A1, A2 and A3 according to their index. So the agent A1 will have the highest priority, and the agent A3 will have the lowest priority. Suppose that the agent A1 proposes value 0 for the variable x to the agents C1 and C2. C1 treats this value as the domain {0} and reduces the domain of the variable y to {1}. The spread of this new domain reduces the domain of the variable z to {2}. A2 tries to offer as the value 0 for variable y. His proposal will be of lower priority than the agent A1 and will be refused because they are inconsistent. The same result is obtained for any other value.

According to the results of the first and second stages, we can say that the CACS algorithm solves DCSP: 1) When the DCSP is over-constrained, we are faced with two different situations: Either the initial domains of the variables are inconsistent. This means that at the end of the first stage there is at least one empty domain of a variable. This involves termination of the algorithm and the declaration of a state of non-solution. Either the initial domains of the variables are consistent. 2) Where there is a unique solution of DCSP, we face two situations: The domains are consistent as long as there is a solution to the DCSP. If the first stage ends with single-vale domains, it means that the solution is found and the algorithm stops. Otherwise, in the second stage, the value proposed by a variable if it is not inconsistent with a value proposed by another agent with higher priority. The proposals of the agent with the highest priority are a priori accepted by all CAgents (it is necessary that this value is part of the final solution to be finally accepted). 3) When the DCSP is under-constrained, many solutions exist. The order of each proposed agent determines convergence towards any particular solution. In other words, the agents start the proposals by the most suitable for their purposes. For example, if an agent tries to minimize the value of its variable, it must begin proposing values from the minimum to the highest values.

## 4. Software Implementation Of Cacs

To prove the proposed methods of constraints satisfaction based on two types of the agents we developed an object-oriented CACS software prototype which can be considered as a generic framework for distributed information syste4ms in logistics. As we can see from Figure 5, the developed CACS prototype uses hierarchical multiple-layer architecture. 

![0_image_1.png](0_image_1.png)

This architecture allows developing applications more flexibly by separating it into specialized layers. The very top layer is the application layer which is the implementation of a DCSP problem using the proposed system underneath it. From the application view point, the system is composed directly from the two principal types of agents: the CAgent and the VAgent. Both agents are inherited from CommonAgent class that defines some shared functionalities between both types of agents. The user can create the necessary VAgents according to its problem definition. He also creates the constraints and associates them to CAgents.

The second layer is the intended system (CACS) where our two-stage interaction algorithm is implemented in accordance with previous definition. Figure 7 shows the interaction between agents during the domain reducing stage. The interaction protocol is a loop of repeated domain informing from the VAgents side to CAgents side and new domain proposing as response. This loop is repeated until no further domain reduction 