Global Propagation of Practicability Constraints - Semantic Scholar

1 downloads 0 Views 292KB Size Report
In the last decade, Constraint Programming (CP) was used for solving indus- ... days: the last hour of the first day and the first hour of the second day cannot.
Global Propagation of Practicability Constraints Thierry Petit and Emmanuel Poder ´ Ecole des Mines de Nantes, LINA FRE CNRS 2729. Rapport de recherche TR0702INFO, d´ecembre 2007. [email protected], [email protected]

Abstract. When a problem is over-constrained, the issue is to search for solutions that remain feasible in practice despite some violations of constraints. This article compares the solving efficiency within a framework where variables of the model express violations with paradigms that extend Constraint Programming to handle violations separately. The two approaches are experimented with a concrete cumulative problem where some violations of capacity are tolerated. The objective is to minimize the total amount of over-loads. We augment the Cumulative global constraint of Choco with sweep and interval violation-based algorithms. To obtain realistic solutions, it is mandatory to express additional practicability constraints, e.g., some precise rules w.r.t. distribution of over-loads in the schedule. Experiments show the superiority of a model where such rules are encoded by global constraints on violation variables.

1

Introduction

This article investigates the impact of propagating globally reductions on domains of violation variables, to solve efficiently over-constrained problems that involve real-life practicability constraints. In the last decade, Constraint Programming (CP) was used for solving industrial applications as well as hard combinatorial problems. However, to develop its industrial exploitation, CP still have to demonstrate that a wide range of NPHard problems can be encoded and solved, notably by people who are experts in computer science, but not experts in CP. An important issue is over-constrained problems. Many industrial problems are defined by a set of constraints which are more or less important and cannot be all satisfied at the same time. CP systems should be able to provide as easily as possible an exploitable compromise when a problem has no solution satisfying all constraints. One usual way to deal with over-constrained problems is to turn a satisfaction problem into an optimization problem, where the impact of violations is reduced as much as possible. In this context, the foremost approach was partial constraint satisfaction [7, 8]. In this paper we experiment this subject through a cumulative scheduling problem with human resource. The time unit is one hour and the schedule is carved in days. We deal with the case where the makespan is fixed and not all activities can be scheduled with the available employees. To obtain solutions that have a practical interest, a frequent requirement is to distribute fairly over-loads

(violations of capacity) during a week. Note that different values are possible for a given violation, expressing a more or less important over-load. Another constraint is to forbid cumulating two neighbouring over-loads in two consecutive days: the last hour of the first day and the first hour of the second day cannot be both over-loaded. Our experiments compare the two usual generic frameworks for solving overconstrained problems as optimization problems. The first one extends CP to handle violations as valuations [4]. Requirements are encoded by functions on violations. In the second framework [17], requirements are expressed by several global constraints, which communicate information on domains of possible values of each violation. This framework requires that violations are explicitly expressed by variables. Additionally, the total sum of overloads is minimized, to limit as much as possible unsatisfiability in solutions. In the two cases we used the same filtering technique for the relaxed version of the Cumulative constraint [1], which encodes the core of the problem. Concretely, this paper provides three contributions: 1. A model for a realistic cumulative over-constrained problem, where overloads are tolerated according to various practicability constraints. 2. An extension of the Cumulative constraint of Choco [6] to over-constrained problems, thanks to violation-based sweep and interval filtering algorithms. 3. Theoretical and experimental comparisons of the two usual frameworks for over-constrained optimization problems, in terms of solving : extending CP [4], or using a variable-based model [17]. The comparison especially focuses on constraints used to get optimal solutions which have a practical interest. This work is motivated by the third investigation. Section 2 defines the cumulative over-constrained problem we consider. Section 3 presents the related work and the motivations of this paper. Section 4 presents our soft version of the Cumulative constraint and a comparison of the proposed filtering algorithms. Section 5 presents the experimental comparison of the two frameworks.

2

Human Resource Cumulative Problem

Scheduling problems consist of ordering some activities. In cumulative scheduling, each activity consumes a certain amount of resource, has a release date (minimum starting time) and a due date (maximum ending time). Definition 1. Consider one resource and a set of activities, each one consuming a given amount of resource. The Cumulative global constraint [1] enforces that: – C1: For each activity the constraint origin+duration=end is satisfied. – C2: At each point in time i, the cumulated height hi of the set of activities overlapping i does not exceed a limit max capa on the resource (the capacity). In this article, we deal with cumulative over-constrained problems that may require to be relaxed w.r.t. the resource capacity at some points in time, to obtain

solutions. The makespan (maximum due date) is strictly fixed to a given number of days, making some instances not satisfiable. Time unit is one hour. Each day contains 7 hours. n activities have to be planed. Duration of each activity is fixed, between 1 hour and 4 hours. All due dates are initially the makespan, and all release dates are 0. An activity consumes a fixed amount of resource: the number of persons required to perform it. This resource is upper-bounded by the total number ideal capa of employees. Given that either some extra-employees can be hired, or some activities can eventually be performed with smaller teams than the ones initially planed, if the problem has no solution then at certain points in time the resource can be greater than ideal capa. However, to remain feasible in practice, solutions should satisfy some requirements w.r.t. such over-loads. 1. At each point in time, over-loads should be less than a given margin. 2. The total sum of over-loads should be reasonable (ideally, minimum). 3. Over-loads should be distributed fairly within a week. The rule is to tolerate at most three over-loaded hours within a day, and among them at most one hour over-loaded by more than one extra-employee. 4. In two consecutive days, if the last hour of work is over-loaded then the first hour of the next day should not be over-loaded. If no solution exist with these requirements, this means that no solution acceptable in practice can be found. That makes sense.

3 3.1

Related Work Related Work in Over-Constrained Scheduling

CP researchers have proposed dedicated techniques to provide compromises when no schedule satisfies all constraints. These techniques are highly useful in practice because many industrial scheduling problems include constraints which are more or less important and cannot be all satisfied at the same time. Baptiste et al. [2] extended the concept of global constraint to over-constrained problems by dealing with unsatisfiable One Machine Problems.They defined a soft global constraint. In this problem, each activity consumes one resource and the resource at each point in time is limited by one. Therefore, no activity overlap in time. This global constraint deals with the case where some due dates have to be relaxed to have a solution. Rudov´a and Vlk [21] have studied multi-objective relaxed student time-tabling. In these problems one has to handle both time and classroom placements. They augment partial satisfaction with multi-objective criteria. For instance, the goal is to minimize both weights of violated preferences on dates and a balancing of courses, e.g., an objective function that tend to alternate biology, physics and English within a given day. 3.2

Related Work in Over-constrained Problems

In the general case, when a constraint network is such that no solution satisfies all constraints, the goal is to find a compromise solution, which satisfies as much

as possible the set of constraints. This is an optimization constrained problem where the objective consists of optimizing a criterion on constraint violations. To find a relaxed solution, hard constraints that must be satisfied in any solution are distinguished from soft constraints, which may be violated. As it is illustrated by our case-study (see section 2), some additional rules distinguish solutions that have a practical interest from solutions that should be rejected. Extending the CP Framework The first way to express an over-constrained problem is to extend CP with an external structure, which handles relaxation of constraints [4]. The principle is to associate a valuation with each constraint or each tuple of a constraint. Valuations are integrated into optimization criteria defined by simple or more complex operators, which determine quality of relaxed solutions. Soft constraints are defined as violation cost functions. To each assignment of values to the variables of the constraint corresponds a cost value. Hard constraints have an “infinite” cost for each violating tuple. Additional rules which determine acceptable solutions are expressed through objective criteria. Handling Relaxation within the CP Framework This approach consists of associating a new variable of the problem with each possible violation [17]. Usually integer domain variables are used. Value 0 indicates a satisfied state whereas values greater than 0 indicates certain cost of violation. For instance, violating an AllDifferent constraint because a pair of variables are equal is less serious than violating the AllDifferent by assigning the same value to all variables. Optimization criteria are related to the whole set of those violation variables. Domains of possible values for costs are maintained by soft global constraints [2, 18, 9]. Additional rules which determine acceptable solutions can be also expressed by (global) constraints, integrating several violation variables. Comparison The use of new extra-variables to express violations does not entail any additional solving penalty when domains of possible values for violations are reduced monotonically during search. Indeed, all search heuristics used with valued paradigms [4] can be used in variable-based paradigms [17]. All violation variables will have then a value by propagation (branching is performed only on problem variables). In this way, solving techniques used with valued frameworks can be encoded with variables, leading exactly to the same search tree. Moreover, a variable-based framework allows a direct collaboration between several global soft constraints, and the constraints on violation variables used to express additional rules. A valuation based framework imposes to express these rules by the objective function. For sake of modelling, two existing solving techniques specific to valued frameworks would require some research effort to be suited to our case-study. In the first one, solving is performed by successive variable elimination [11]. This solving algorithm is currently not suited to global constraints not defined extensively, like Cumulative or its extensions. In the second technique, valuation

costs stem from violations are transmitted from tuples to values and vice versa [13]. Algorithms compute a global lower bound of violations by aggregating valuations. Note that, independently from the way each local violation is encoded, a global constraint can be used to compute this lower bound, following a schema similar than the one presented for Max-CSP in [20]. However, aggregating local violations to compute a lower bound is not necessarily pertinent in our context (see section 4). Furthermore, even into an objective function, we don’t know how to define a set of additional rules on local violations if valuations can increase and decrease during search, and do not express over-loads. This issue is not obvious. We finally discarded the use of these two solving techniques. 3.3

Motivations

Additionally to a global soft constraint expressing the core of an over-constrained problem, the goal is to investigate whether propagating external constraints on violation variables is of interest or not for improving the solving process.1 These constraints express practicability rules which strongly depend on each specific context of problem, e.g, rules 3. and 4. in section 2. Core of the problem

Core of the problem

(e.g., global soft constraint)

(e.g., global soft constraint)

Valuations (cost functions)

Violation variables

Optimization Criteria expressing also praticabillity rules

Optimization Criteria

Valued Model

Global constraints that express practicability rules

Variable!based Model

Fig. 1. Valuation-based and Variable-based models.

Within a valuation-based encoding, practicability rules can be expressed only by the optimization criteria. In the second case, it is possible to use global constraints on violation variables. This is the central point of our comparison. In the experiments (section 5), in the two cases the same filtering algorithm is used for the SoftCumulativeSum constraint, which expresses the core of the problem.

4

Cumulative Constraint with Over-Loads

This section presents the SoftCumulativeSum constraint, useful to express our case-study and deal with significant instances. D(x) = {min(D(x)), . . . , max(D(x))} denotes the domain of variable x. 1

The comparison of the variable-based and valued approaches in terms of modelling was performed in [17].

Definition 2. Let A denote a set of n activities. For each a ∈ A, – – – –

4.1

da is the (minimum) value of its duration. resa ∈ res is the (minimum) amount of resource consumed by a. start[a] ∈ start is the variable representing its starting point in time. end[a] ∈ end is the variable representing its ending point in time (it is not mandatory to create it explicitly if durations are fixed). State of the Art : Pruning Independent from Relaxation

The SoftCumulativeSum constraint presented in Section 4.2 implicitly defines a Cumulative constraint with a capacity equal to max capa. To prune variables in start, several existing algorithms for the Cumulative can be used. We recall the two filtering techniques currently implemented in the Cumulative of Choco solver [6], which we extend to handle violations in section 4.2. Sweep Algorithm [3] The goal is to reduce domains of start variables according to the cumulated profile, which is built from compulsory parts of activities, in order not to exceed max capa. This is done in Choco using a sweep algorithm [3]. The Compulsory Part [10] of an activity is the minimum resource that will be consumed by this activity, whatever the final value of its start. It is equal to the intersection of the two particular schedules that are the activity scheduled at its latest start and the activity scheduled at its earliest start. As domains of variables get more and more restricted, the compulsory part increases, until it becomes the fixed activity. Activity A non empty compulsory part Activity B empty compulsory part 0

m

Fig. 2. Compulsory parts.

Definition 3. The Compulsory Part CP (a) of an activity a is not empty if and only if max(D(start[a])) < min(D(end[a])). If so, it’s height is equal to resa on [max(D(start[j])), min(D(end[j]))[ and null elsewhere. Definition 4. The Cumulated Profile CumP is the minimum cumulated resource consumption, over time, of all the activities. For a given t, the height of CumP at time t is equal to X resa a∈A/t∈[max(D(start[j])),min(D(end[j]))[

That is, the sum of the contributions of all compulsory parts that overlap t.

max_capa

0

m

Fig. 3. Cumulated profile.

Algorithm The sweep algorithm moves a vertical line ∆ on the time axis from one event to the next event. In one sweep, it builds the cumulated profile incrementally and prunes activities according to this profile, in order not to exceed max capa. An event corresponds either to the start or the end of a compulsory part, or to the release date of an activity. All events are initially computed and sorted in increasing order according to their date. Position of ∆ is δ. At each step of the algorithm, a list ActT oP rune contains the activities to prune. – Compulsory part events are used for building CumP . All events at date δ are used to update the height sumh of the current rectangle in CumP , by adding the height if it is the start of a compulsory part or removing the height otherwise. The first event with a date strictly greater than δ gives the end δ 0 of the current rectangle in CumP , finally denoted by h[δ, δ 0 [, sumh i. – Events corresponding to release dates d such that δ ≤ d < δ 0 add some new activities to prune, according to h[δ, δ 0 [, sumh i and max capa (those activities which overlap h[δ, δ 0 [, sumh i). They are added to the list ActT oP rune. For each a ∈ ActT oP rune that has no compulsory part registered in the rectangle h[δ, δ 0 [, sumh i, if its height is greater than max capa − sumh then the algorithm prunes its starts so as to this activity never overlap the current rectangle of CumP . Then, if the due date of a is less than or equal to δ 0 then a is removed from ActT oP rune. After pruning activities, δ is updated to δ 0 . Theorem 1. Let a ∈ ActT oP rune, which has no compulsory part recorded within the rectangle h[δ, δ 0 [, sumh i. If sumh + resa > max capa then remove ]δ − da , δ 0 [ from D(start[a]). Time complexity of the sweep technique is O(n ∗ log(n)). Please refer to the paper for more details w.r.t. this algorithm [3]. Energy reasoning on Task Intervals [14, 5] Definition 5. Let ai and aj be two activities (possibly the same) s.t. min(D(start[ai ])) < max(D(end[aj ])). S(ai ,aj ) = {a ∈ A s.t. min(D(start[ai ])) ≤ min(D(start[a]))}. A lower bound W(ai ,aj ) (a) of the number of resource units consumed by a ∈ S(ai ,aj ) on I(ai ,aj ) = [min(D(start[ai ])), max(D(end[aj ]))[ is W(ai ,aj ) (a) = resa ∗ min(da , max(0, max(D(end[aj ])) − max(D(start[a])))

Definition 6. Area(ai ,aj ) denotes the number of free resource units in I(ai ,aj ) . Theorem 2. Area(ai ,aj ) = (max(D(end[aj ]))−min(D(start[ai ])))∗max capa. P If a∈S(a ,a ) W(ai ,aj ) (a) > Area(ai ,aj ) then fail. i

j

Algorithm The principle is to browse activities aj ∈ A, and for a given aj to browse activities ai ∈ A such that min(D(start[ai ])) < max(D(end[aj ])). Then the algorithm applies theorem 2. Activities aj may be browsed by increasing due date, to consider at each new choice more activities. If activities ai are considered in decreasing release date, i.e., min(D(start[a 1 ])) ≥ · · · ≥ min(D(start[a n ])),  P P W (a) + W then W (a) = (ai ,aj ) (ai+1 ,aj ) (a). (ai+1 ,aj ) a∈S(a a∈S(a ,a ) ,a ) i+1

j

i

j

Therefore, the complexity for handling all intervals I(ai ,aj ) is O(n2 ). 4.2

Pruning Related to Relaxation

Specific constraints on over-loads exist in real-world applications, e.g., rules 3. and 4 in Section 2. To express them, it is mandatory to discretize time, while keeping a reasonable time complexity for pruning. These specific constraints are externalized because they are ad-hoc to each application. On the other hand, next constraints capture the generic core of this class of problems. – The SoftCumulative extends the Cumulative of Choco by maintaining overloads variables at each point in time, and by pruning activities according to maximal available capacities given by upper bounds of these variables instead of simply considering max capa. This constraint can be used with various objective criteria. – The SoftCumulativeSum extends the SoftCumulative. It is defined to deal more efficiently with a particular criterion: minimize the sum of over-loads. SoftCumulative Constraint Definition 7. Let A be a set of activities scheduled between time 0 and m, each consuming a positive amount of the resource. The SoftCumulative augments the Cumulative constraint with a second limit of resource ideal capa ≤ max capa, and for each point in time i < m an integer variable costV ar[i]. It enforces: – C1 and C2 (see Definition 1). – C3: For each time point i, costV ar[i] = max(0, hi − ideal capa) Revisited Sweep pruning procedure. The limit of resource is not max capa like in the Cumulative constraint. It is mandatory to take into account upper-bounds of variables in costV ar. One may integrate reductions on upper bounds within the profile, like new fixed tasks. However, our discretization of time can be very costly with this method : the number of events may grow significantly. The profile is not computed only from activities but also from each point in time. We propose a relaxed version where for each rectangle we consider the maximum costV ar upper bound. This entails less pruning but the complexity is amortized: the number of time points checked to obtain maximum costV ar upper bounds for the whole profile is m, by exploiting the sort on events into the sweep procedure.

costVar[i] upper bounds

max_capa

ideal_capa 0

costVar[i] lower bounds:

m

2 2 2 0 0 0 0 0

Fig. 4. Example of a SoftCumulative constraint.

Theorem 3. Let a ∈ ActT oP rune, which has no compulsory part recorded within the current rectangle. If sumh + resa > ideal capa + max(max(D(costV ar[i]), i ∈ [δ, δ 0 [)) then ]δ − da , δ 0 [ can be removed from D(start[a]). Proof: For any activity which overlaps the rectangle, the maximum capacity is upper-bounded by ideal capa + max(D(costV ar[i]), i ∈ [δ, δ 0 [).

Time complexity is O(n ∗ log(n) + m), where m is the maximum due date. Revisited Task Intervals energy reasoning. The available number of units of resource Area(ai ,aj ) to consider is shrink. Theorem 4. Area(ai ,aj ) = X

(ideal capa + max(D(costV ar[i]))

i∈[min(D(start[ai ])),(max(D(end[aj ]))[

If

P

a∈S(ai ,aj )

W(ai ,aj ) (a) > Area(ai ,aj ) then fail.

Proof: At each time point i there is ideal capa + max(D(costV ar[i])) available units.

Pruning efficiency of theorem 2 can be improved by this new computation of Area(ai ,aj ) (the previous value was an over-estimation). Since activities ai are considered in decreasing release date, it is possible to compute incrementally Area(ai ,aj ) . Each upper bound of a variable in costV ar are considered once for each aj . Time complexity is O(n2 + n ∗ m), where m is the maximum due date. Update costVar lower-bounds. Update of costV ar lower bounds can be directly performed within the sweep algorithm, while the profile is computed. Theorem 5. Consider the current rectangle in the profile, [δ, δ 0 [. For each i ∈ [δ, δ 0 [, if sumh − ideal capa > min(D(costV ar[i])) then [min(D(costV ar[i]), sumh − ideal capa[ can be removed from D(costV ar[i]). Proof: From Definitions 3 and 4.

Consistence of violation variables. Generally, the constraint should not be used with a search heuristic that forces to assign to a costV ar variable a value which is greater than the current lower bound of its domain. However, it should ensure that, into ground solutions, costV ar variables do not have a greater value than the profile obtained from all fixed activities. Until more than a very few number of unfixed activities exist, it is almost not possible to deduce anything. We simply implemented a procedure that fails when all start variables are fixed and one variable in costV ar is higher than the current profile at this point in time. SoftCumulativeSum Constraint Definition 8. The SoftCumulativeSum augments the SoftCumulative constraint with an integer variable cost. It enforces: – C1 and C2 (see Definition 1), andP C3 (see Definition 7). – The following constraint: cost = i∈{0,...,m−1} costV ar[i] Pruning procedures and consistence checks of the SoftCumulative remain valid for the SoftCumulativeSum. Additionally, we aim at dealing with the sum constraint efficiently by exploiting the semantics. We compute lower bounds of the sum expressed by cost variable. Classical back-propagation of this variable can be additionally performed like if the sum constraint was defined separately. Sweep based global lower bound. Within our global constraint, a lower bound is directly given by summing the lower bounds of all variables in costV ar, which are obtained by Theorem 5. Yet their values take into account compulsory parts, not only fixed activities. X LB1 = min(D(costV ar[i])) i∈{0,...,m−1}

LB1 can be computed with no increase in complexity within the sweep algorithm. P Interval based global lower bound. The quantity a∈S(a ,a ) W(ai ,aj ) (a) used in i j Theorem 2 provides the required energy for activities in the interval I(ai ,aj ) . This quantity may exceed the number of time points in I(ai ,aj ) multiplied by ideal capa. We can improve LB1 , provided we remove from the computation over-loads yet taken into account in the cost variable. In our implementation, we first update variables in costV ar (by Theorem 5), and compute LB1 to update cost. In this way, no additional backtrackable data is required. To obtain the new lower bound we need to compute lower-bounds of cost which are local to each interval I(ai ,aj ) . P Definition 9. lb1(ai ,aj ) = i∈I(a ,a ) min(D(costV ar[i])) i

j

Theorem 6. The number FreeArea(ai ,aj ) of free resource units in I(ai ,aj ) s. t. no violation is entailed is (max(D(end[aj ])) − min(D(start[ai ]))) ∗ ideal capa.

Proof: From Definition 8.

Definition 10. Inc(ai ,aj ) =

P

a∈S(ai ,aj )

W(ai ,aj ) (a)−FreeArea(ai ,aj ) −lb1(ai ,aj )

From Definition 9 and Theorem 6, FreeArea(ai ,aj ) + lb1(ai ,aj ) is the number of time units that can be used without creating any new over-load into the interval I(ai ,aj ) compared with over-loads yet taken into account in lb1(ai ,aj ) . Inc(ai ,aj ) is the difference between the required energy and this quantity. Even if one variable in costV ar has a current lower bound higher that the value stem from the profile, the increase Inc(ai ,aj ) is valid (smaller, see Definition 9). We are now able to improve LB1 . LB2 = LB1 + max(ai ,aj )∈A2 (Inc(ai ,aj ) ) Another lower bound can be computed from a partition P of [0, m[ in disjoint intervals stem from pairs of activities (ai , aj ): P LB(P ) = LB1 + I( ai ,aj )∈P Inc(ai ,aj ) Obviousy LB2 ≤ LB(P ) . However, time complexity of the algorithm stem from Theorem 4 in the SoftCumulative constraint is yet O(n2 + n ∗ m). This complexity should reasonably not be increased. Computing LB2 can be directly performed into this algorithm without any increase in complexity. On the contrary, determining a pertinent partition P from the activities would force to use an independent algorithm, which can be costly depending on the partition we search for. Finally, we decided to use only LB2 . Theorem 7. If LB2 > min(D(cost)) then [min(D(cost)), LB2 [ can be removed from D(cost). Proof: From Definition 8, LB1 is a lower bound of cost. Since intervals are disjoint, by Definition 10 the quantity LB(P ) is a lower bound of cost. LB2 ≤ LB(P ) . Therefore LB2 is a lower bound of cost. The theorem holds.

Aggregating local violations. Once the profile is computed, if some activities having a null compulsory part cannot be scheduled without creating new overloads, then LB1 can be augmented with the sum of minimum increase of each activity. This idea is inspired from generic solving methods for over-constrained CSPs, e.g., Max-CSP [12]. Our experiments shown that there is quite often a way to place any activity without creating a new violation. This entails a null lower bound. We removed that computation from our implementation2 . Implementation Constraints were implemented to work with non fixed durations and resource consumptions.3 Principles with such unfixed data are similar except that we consider the minimum value of the domains of the corresponding variables. Therefore, we did not surcharged the description. Table 1 compares the two constraints on small problems when the objective is to minimize cost. Results show the main importance of LB2 when minimizing cost. 2 3

It is described in a preliminary technical report [16]. The Choco implementation of this constraint is available: [email protected]

Instance cost value SoftCumulative + external sum 1 0 92 (0.07 s) 2 2 417 (0.29 s) 3 10 > 30 s 2 1301 (0.59 s) 4 5 6 19506 (13.448 s) 6 0 53 (0.00 s) 7 10 > 30 s 8 6 > 30 s

SoftCumulativeSum 92 (0.01 s) 94 (0.01 s) 63 (0.01 s) 194 (0.06 s) 97 (0.01 s) 53 (0.00 s) 90 (0.01 s) 152 (0.07 s)

Table 1. Number of nodes of optimum schedules with n = 9, m = 9, durations between 1 and 4, resource consumption between 1 and 3, ideal capa = 3, max capa = 7.

5

Variable-Based vs Valuation-Based Model

5.1

Definition of the Constraint Network

Within the context of a practical application, the goal of this article is to compare frameworks for solving over-constrained problems : extending CP [4], or using a variable-based model [17]. Here is the variable based model in a pseudocode syntax. Comments show how rules on violations of Section 2 are expressed. int[] ds, hs; // fixed random durations and heights int ideal capa, max capa; IntDomainVar[] start, costVar; IntDomainVar cost; // core of the problem SoftCumulativeSum(start, costVar, cost, ds, hs, ideal capa, max capa); // practicability constraints for each array "day", element of a partition of costVar[]: Gcc4 ("day",...)); // rule 3 (max 3 over-loads) AtMostKNotZeroOrOne("day",1)); // rule 3 (max 1 big over-load) for(i:7..costVar.length-1): // rule 4 (consecutive days) if(i%7==0): [costVar[i-1]==0 || costVar[i]==0]; // objective criteria minimize(cost)

A disjunction is sufficient for expressing rule 4. because the constraint just consists of, within a pair of variables, forcing to assign value 0 to one of the two variable when value 0 is removed from the other one. For more complex dependencies, a Regular constraint may be used to improve the solving efficiency [15]. The ad-hoc constraint AtMostKNotZeroOrOne imposes to have at most k times values different from 0 or 1 into a set of variables which is given as argument. With a valued model, rules 3. and 4. are expressed by the objective criteria instead of constraints, since no violation variables are available. This entails an important modelling effort. Fortunately, we can simulate this encoding in a particular variable-based model. A valued model express violations by functions that, given a tuple, return a valuation. Valuations are aggregated into the objective criterion. Rules 3. and 4., or more generally practicability constraints, 4

Global Cardinality Constraint, also called Distribute [19].

eliminate solutions that do not respect those rules. Given a set of valuations {v1 , . . . , vl }, the rule answers ’yes’ or ’no’ in order to valid or not the current (possibly partial) assignment. This can be done by implementing constraints that do not propagate globally on violation variables but just answer ’yes’ or ’no’ given a set of values. Here, such values are lower bounds of costV ar. This is equivalent to aggregate valuations and valid or not solutions through the objective criterion. We call the modified constraints NFGcc and NFAtMostKNotZeroOrOne. Except them, the model remains the same, notably w.r.t. the SoftCumulativeSum constraint. We made that choice because this constraint is quite generic:5 We assume our algorithms can be implemented into a valued solver dedicated to cumulative over-constrained problems. This is not obvious, notably w.r.t. costV ar upper-bounds back-propagation, but we do not claim that it is not possible. 5.2

Experiments

Benchmarks were generated randomly with seeds to be reproducible. They were run with the same search heuristic: assign minimum values of domains first to start variables and after to costV ar and cost variables. This search heuristic is consistent with a valued model. There is no branching on over-load variables. The machine was a 2.2 Ghz Intel Core 2 processor with 4 Go of 667 Mhz RAM. Instance cost value Valuation-based Model Variable-based Model 1 0 67 (0.08 s) 67 (0.01 s) 2 0 3151 (6.07 s) 74 (0.02 s) 5 372 (0.6 s) 117 (0.1 s) 3 4 0 2682 (4.4 s) 120 (0.03 s) 5 4 116 (0.1 s) 134 (0.1 s) 6 0 62 (0.01 s) 132 (0.04 s) 10 1796 (2.3 s) 694 (0.9 s) 7 8 4 391 (0.48 s) 352 (0.45 s) Table 2. Number of nodes of optimum schedules with n = 10, m = 14, durations between 1 and 4, resource consumption between 1 and 3, ideal capa = 3, max capa = 7.

Table 2 shows that even for small instances of our case-study, expressing practicability rules as functions is not well suited to avoid a high number of nodes. Conversely, using the variable-based model leads to a robust solving. Table 3 confirms the superiority of a variable-based model. However, some instances (e.g., 6 in this table) can involve more than one thousand nodes with the variable-based model. This fact shows that some hard instances remain despite the efficient handling of over-load distribution. We aim to determine whether the variable model may solve a schedule of one week. Table 4 shows that some instances cannot be solved within a time less than 60 s. This is partially due to the time spent into the SoftCumulativeSum constraint at each node, which grows proportionally to the number of variables although we did not integrate time points as events into the sweep pruning procedure. 5

Conversely, Rules 3. and 4. are strongly problem dependent and, thus, externalized.

Instance cost value Valuation-based Model Variable-based Model 1 2 > 60 s 211 (0.34 s) 2 0 > 60 s 178 (0.08 s) 3 1 > 60 s 200 (0.12 s) 4 15 > 60 s 27 (0.04 s) 12 > 60 s 546 (2 s) 5 6 3 > 60 s 1875 (6 s) 7 6 2240 (11.4 s) 160 (0.12 s) 8 9 > 60 s 79 (0.06 s) Table 3. Number of nodes of optimum schedules with n = 15, m = 21, durations between 1 and 4, resource consumption between 1 and 3, ideal capa = 3, max capa = 7. Instance cost value Variable-based Model 1 3 858 (5.8 s) 2 0 627 (1.2 s) 3 > 60 s 0 419 (0.6 s) 4 5 > 60 s 23 263 (1.6 s) 6 7 10 416 (0.9 s) 8 19 197 (0.6 s) Table 4. Number of nodes of optimum one week schedules: n = 25, m = 35, durations between 1 and 4, resource consumption between 1 and 3, ideal capa = 3, max capa = 7.

5.3

Perspectives

We highlighted a real-life case-study where propagating problem-specific practicability constraints is mandatory for solving instances. If the time unit is tiny compared with the makespan, e.g., one minute in a one-year schedule, the same kind of model may be used by grouping time points. For example, each violation variable may correspond to one half-day. Imposing a practicability constraint between two particular minutes into a one-year schedule is generally not useful. For this purpose, the SoftCumulative constraint should be slightly modified. Moreover, we presented dedicated algorithms for the SoftCumulativeSum constraint which are inspired from the classical cumulative algorithms. A perspective is to go further to this orthogonal aspect of our paper. That is, to follow the same methodology than the one we applied to extend sweep and task interval algorithms, in order to extend some other existing techniques. Since many scheduling problems include precedence constraints, we will investigate whether integrating precedence constraints into an energetic reasoning is of interest or not in the context of over-constrained problems, compared with the case where the precedence graph is handled separately from the SoftCumulativeSum constraint.

6

Conclusion

This paper analysed the benefit of propagating a set of global constraints on violations variables, in terms of solving efficiency. To encode the case-study we selected for these experiments, we proposed several filtering procedures for a

Cumulative constraint which is relaxed w.r.t. to its capacity at some points in time. Experiments demonstrated that its own filtering is not sufficient. Propagating globally additional constraints on violation variables is required.

References 1. A. Aggoun and N. Beldiceanu. Extending CHIP in order to solve complex scheduling and placement problems. Mathl. Comput. Modelling, 17(7):57–73, 1993. 2. P. Baptiste, C. Le Pape, and L. Peridy. Global constraints for partial CSPs: A case-study of resource and due date constraints. Proc. CP, pages 87–102, 1998. 3. N. Beldiceanu and M. Carlsson. A new multi-resource cumulatives constraint with negative heights. Proc. CP, pages 63–79, 2002. 4. S. Bistarelli, U. Montanari, F. Rossi, T. Schiex, G. Verfaillie, and H. Fargier. Semiring-based CSPs and valued CSPs: Frameworks, properties, and comparison. Constraints, 4:199–240, 1999. 5. Y. Caseau and F. Laburthe. Cumulative scheduling with task intervals. Proc. JICSLP, pages 363–377, 1996. 6. Choco. A Java library for CSPs, constraint programming and explanation-based constraint solving. URL: http://choco.sourceforge.net/, 2007. 7. E.C. Freuder. Partial constraint satisfaction. Proc. IJCAI, pages 278–283, 1989. 8. E.C. Freuder and R.J. Wallace. Partial constraint satisfaction. Artificial Intelligence, 58:21–70, 1992. 9. W.-J. Van Hoeve, G. Pesant, and L.-M. Rousseau. On global warming: Flow-based soft global constraints. Journal of Heuristics, 12:4-5:475–489, 2006. 10. A. Lahrichi. The notions of Hump, Compulsory Part and their use in Cumulative Problems. C.R. Acad. sc., t. 294:20–211, 1982. 11. J. Larrosa and R. Dechter. Boosting search with variable elimination in constraint optimization and constraint satisfaction problems. Constraints, 8(3):303–326, 2003. 12. J. Larrosa and P.Meseguer. Exploiting the use of DAC in Max-CSP. Proc. CP, pages 308–322, 1996. 13. J. Larrosa and T. Schiex. Solving weighted csp by maintaining arc consistency. Artificial Intelligence, 159(1-2):1–26, 2004. 14. P. Lopez, J. Erschler, and P. Esquirol. Ordonnancement de tˆ aches sous contraintes : une approche ´energ´etique. Automatique, Productique, Informatique Industrielle, 26:5-6:453–481, 1992. 15. G. Pesant. A regular language membership constraint for finite sequences of variables. Proc. CP, pages 482–495, 2004. 16. T. Petit. Propagation of practicability criteria. Research report 0701, Ecole des Mines de Nantes, http://www.emn.fr/x-info/tpetit/TR0701tpetit.pdf, 2007. 17. T. Petit, J-C. R´egin, and C. Bessi`ere. Meta constraints on violations for over constrained problems. Proc. IEEE-ICTAI, pages 358–365, 2000. 18. T. Petit, J-C. R´egin, and C. Bessi`ere. Specific filtering algorithms for over constrained problems. Proc. CP, pages 451–463, 2001. 19. J-C. R´egin. Generalized arc consistency for global cardinality constraint. Proc. AAAI, pages 209–215, 1996. 20. J-C. R´egin, T. Petit, C. Bessi`ere, and J-F. Puget. An original constraint based approach for solving over constrained prolems. Proc. CP, pages 543–548, 2000. 21. H. Rudov´ a and M. Vlk. Multi-criteria soft constraints in timetabling. Proc. MISTA, pages 11–15, 2005.