• No results found

Penalty-based Distributed Hybrid algorithm (PenDHyb)

5.3 DisHyb Implementations

5.3.1 Penalty-based Distributed Hybrid algorithm (PenDHyb)

In this section, we present the Penalty-based Distributed Hybrid algorithm (PenDHyb), an instance of DisHyb which uses penalties on values as the local search strategy. PenDHyb combines Stoch-DisPeL as the local search algorithm and SynCBJ as the systematic search algorithm.

5.3. DisHyb Implementations 52 • Difficult variables: Penalties on values are used to learn which variables are difficult to assign during problem solving. A variable which has many heavily pe- nalised values is seen as more troublesome than a variable whose values have few or no penalties. Variables are ordered in decreasing number of penalties and this order is used to drive SynCBJ.

• Best variable values: the best solution found (the one with the least constraint violations) in DisPeL, is used for selecting the first value for each variable in SynCBJ.

Algorithm Description

The reader is referred to section 4.2.3 for a description of the Stoch-DisPeL algorithm. In the remainder of this chapter, Stoch-DisPeL is referred to as DisPeL. In order to learn penalty information for use in SynCBJ, DisPeL was modified by adding:

• A penalty counter pci for each variable vi. pci is incremented by the value of the penalty whenever a penalty is imposed on any of vi’s values. Unlike penalties on val- ues, penalty counters are never reset and, therefore, highlight repeated penalisation of variables, i.e. troublesome variables.

• A best value store bvi for each variable vi which keeps the value participating in the best solution found by DisPeL so far. In order to determine whether the current value is the best so far, each agent adds its current score (constraint violations + penalties) to the score passed to it by its predecessor and sends this score to the next agent. The last agent determines if the current solution is the best so far and if so it informs the first agent who will inform others in the next cycle. During this cycle, the message that gives control to the next agent of processing also includes a parameter to save current value as best value so far before choosing a new value. Therefore, the best solution found can be determined without incurring any additional messages. The PenDHyb algorithm is shown in Algorithm 2. After agent initialisation, DisPeL runs (as described for Stoch-DisPeL in [8]) but only for a very small number of cycles (see section 5.3.1). If the problem is solved, the solution is returned. Otherwise, variables are

Algorithm 2 PenDHyb

1: initialise

2: for each variable vi do

3: set its penalty count pci to 0

4: set its best value bvi to its initial instantiation

5: end for

6: repeat

7: for each agent ai responsible for variable vi do

8: if message received stating current value participates in best solution found then

9: set bvi to current value

10: end if

11: DisPeL agent main loop(termination cond)

12: if penalty imposed then

13: increment pci.

14: end if

15: end for

16: until termination cond

17: if solution found by DisPeL then

18: return solution

19: else

20: ao ← list of agents sorted by max-degree and their variables’ penalty count (pci).

21: for variable vi do

22: Prioritise best values (bvi)

23: end for

24: SynCBJ(ao)

25: if solution found by SynCBJ then

26: return solution

27: else

28: return ”unsolvable problem”

29: end if

30: end if

arranged, in descending order, according to their maximum degree (number of constraints) with ties broken by penalty count before SynCBJ is run. In addition to the variable ordering information, SynCBJ makes use of value ordering information as follows: for each variable vi, the first value to be tried is the best value bvi found by DisPeL, i.e. the one participating in the best instantiation found.

Properties

PenDHyb is complete since either DisPeL reports a solution within the small number of cycles (typically DisPeL solves 5% of problems) or SynCBJ runs. Since SynCBJ is complete, completeness of PenDHyb is guaranteed. PenDHyb is sound since both DisPeL and SynCBJ are sound [8, 102].

5.3. DisHyb Implementations 54 Variable and Value Ordering in PenDHyb

A number of methods for exploiting the knowledge gained from running DisPeL were evaluated in order to provide variable and value ordering for SynCBJ. Solvable random binary distributed constraint satisfaction problems were used in the experiments with n = 50, d = 10, p1 = 0.15 and p2 = 0.4. These problems correspond to the phase transition region where, the number of messages and non-concurrent constraint checks incurred by systematic search become much higher and consequently local search becomes more desirable (see section 4.4). Therefore, hybrid algorithms are likely to be important on these problems in guaranteeing completeness where systematic search is not as effective. Combinations of the following options were investigated:

• Variable ordering:

– Penalties: this heuristic orders variables according to max-degree with ties broken by penalty counts. Seeks to measure whether penalties are a positive addition to the basic max-degree heuristic.

– Last penalties: in the original DisPeL search, incremental penalties are dis- carded periodically (reset) when the search space becomes distorted (see section 4.2.3). This heuristic uses the penalty counts between the last reset and the end of DisPeL execution as opposed to the cumulative penalty counts proposed above. It seeks to measure whether it is beneficial to allow time for the penalties to stabilise before learning from them.

• Value ordering:

– Sticking values: the first variable value to be tried by SynCBJ is DisPeL’s best value for that variable, i.e. the one participating in the best solution found. All other values are considered in their original order. This is inspired by [32] who used the last value assigned to a variable. The idea is that DisPeL often gets close to a solution and therefore the work already done by DisPeL can be reused in SynCBJ. It must be noted that SynCBJ does ultimately consider all values and so use of this heuristic does not impact on completeness.

– Selected sticking values: uses the sticking value only if that value led to no constraint violations in DisPeL. Otherwise, it uses the first value in the domain. The idea is that this will maximise the benefit of sticking values by giving SynCBJ the correct values whilst not forcing it to use incorrect values (i.e. those with constraint violations).

Table 5.2 presents the median results for messages and constraint checks over 100 runs. Number of Messages Number of Constraint Checks

SynCBJ 262,178 1,344,941

Penalties 111,638 559,004

Sticking values 75,694 345,654

Penalties + selected sticking 77,482 332,050

Last penalties 131,602 624,803

PenDHyb 50,929 321,237

Table 5.2: Comparison of variable and value ordering heuristics (n = 50, d = 10, p1 = 0.15, p2 = 0.4).

The best performing method, is the one used in PenDHyb, where variables are sorted using max-degree and penalties (penalties heuristic) and values are prioritised using stick- ing values. Ordering variables according to penalties which are periodically reset produces the worst results since the algorithm cannot effectively determine the variable difficulty. It is worth noting that sticking values (selectively or not) leads to increased performance. This may be because DisPeL provides values which are normally part of a solution.

Determining Optimal Number of Cycles for DisPeL

Randomly Generated Problems Graph Colouring Problems (degree = 5) Problem spec. Optimal values Problem spec. Optimal values

num dom num msgs ccs both num num num msgs ccs both

vars size con nodes cols con

30 10 90 3 3 3 125 3 313 11 4 4

40 10 120 12 4 14 150 3 375 9 5 9

50 10 150 65 45 65 175 3 438 53 5 53

60 10 180 99 66 96 200 3 500 108 108 108

Table 5.3: Sample of data used to determine optimal cycle cutoffs.

The only parameter which needed to be determined in PenDHyb was the number of cycles DisPeL should run for optimal performance. Its value was obtained as follows: (i) Experiments were run on three problem classes - solvable random binary DisCSPs, solvable graph colouring problems and solvable meeting scheduling problems - with varying

5.3. DisHyb Implementations 56 characteristics (see below for details) and cutoff points for randomly generated problems and meeting scheduling problems between 0.1n and 2n cycles in increments of 0.1n or between 0.03n and 0.60n in increments of 0.03n for graph colouring problems (where n is the number of variables in the problem 1). The cutoff recommended was always substantially lower than 2n for randomly generated problems and meeting scheduling problems and 0.60n for graph colouring problems and so 2n and 0.60n were chosen as upper limits; (ii) For each type of problem, the three most optimal cycle cutoffs were selected, i.e. the ones where the number of messages, the number of constraint checks or a combination of both is minimal (see Table 5.3 for sample data). For the combination of messages and constraint checks, the data was normalised and the optimal normalised value was chosen to remove scale bias; (iii) Multiple linear regression was used for predicting the linear relationship between the problem features (e.g. number of variables, domain size, number of constraints) and the optimal cycle cutoff obtaining the following:

cutof f = α + (β ∗ domainSize) + (γ ∗ constraints) (5.1) Values for α, β and γ are given in Table 5.4 where the column heading indicates which metric (messages, non-concurrent constraint checks or both) is to be minimised. Note that we did not consider unsolvable problems when determining the optimal number of cycles since DisPeL will never be able to detect unsolvability. Consequently, the optimal number of cycles for an unsolvable problem is very low since we need to move quickly to the backtracking phase in order to detect unsolvability.

Randomly Generated Problems Graph Colouring Problems optimisemessages constr. checks both messages constr. checks both

α -134.810 -77.948 -146.334 -27.684 -31.305 -22.880

β 5.580 0.000 6.560 0.000 0.000 0.000

γ 0.888 0.798 0.872 0.113 0.127 0.101

Meeting Scheduling Problems optimisemessages constr. checks both

α -10.615 -10.229 -10.718

β 2.391 2.297 2.406

γ 0.026 0.025 0.026

Table 5.4: Parameter values for α, β and γ in Equation (5.1).

1

Since the number of variables affects the size of the problem, it is intuitive to increase the number of cycles permitted as the problem size increases. Consequently, the number of cycles was always proportional to the number of variables.

The experiments for tuning the number of cycles allocated to DisPeL, detailed above were run on the following problems: (i) Randomly generated problems with number of variables n ∈ {30, 40, 50, 60, 70}, domain size d ∈ {8, 9, 10, 11, 12}, constraint den- sity p1 ∈ {0.1, 0.15, 0.2} and constraint tightness p2 ∈ {0.6(30), 0.5(40), 0.45(50), 0.4(60)}; (ii) Graph colouring problems with number of nodes n ∈ {100, 125, 150, 175, 200}, d = 3 and degree ∈ {4.6, 4.7, 4.8, 4.9, 5.0, 5.1, 5.2, 5.3}; (iii) Meeting scheduling problems with number of variables n ∈ {30, 40, 50, 60}, domain size d ∈ {5, 6}, constraint density cd ∈ {0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.22, 0.24} and maximum distance d ∈ {2, 3}. These are problems in the difficult regions where SynCBJ is particularly expensive to run.