FOCUS Algorithm in Constraint Programming
- FOCUS Algorithm is a global constraint that clusters high values within short segments to optimize sequencing and scheduling tasks.
- It introduces tunable parameters—threshold, maximum interval length, and interval count—to enforce contiguity while managing computational tractability.
- Generalizations like Springy and Weighted FOCUS expand flexibility by accommodating low values and aggregate lengths, enhancing modeling versatility.
The FOCUS algorithm in constraint programming is a global constraint that enforces concentration of high (or penalized) values within short contiguous segments of a variable sequence. Since its introduction, FOCUS and its generalizations have been instrumental in modeling problems where concentration or clustering of certain events is desirable, while also managing computational tractability via efficient filtering algorithms. The formalism supports a wide array of combinatorial applications, especially within scheduling and sequencing, by precisely controlling "clustering" behaviors through tunable parameters.
1. Formal Definition of the FOCUS Constraint
The original FOCUS constraint operates over a sequence of integer variables and introduces three parameters: a threshold , maximum interval length , and an interval bound variable . Specifically, FOCUS is satisfied if there exists a collection of disjoint intervals such that:
- .
- For each : .
- For all : .
All occurrences of must thus be "concentrated" within at most intervals, each of maximum allowed length (Narodytska et al., 2013).
2. Generalizations of the FOCUS Constraint
Recognizing the restrictive nature of the original definition, three significant generalizations have been developed:
- Springy FOCUS: Allows up to values not exceeding within each covering interval but still requires endpoints . The constraint can be written as . For , it recovers the original FOCUS constraint.
- Weighted FOCUS: Introduces a total covered length variable , bounding the aggregate length of the intervals: , in addition to the original interval count constraint.
- Weighted + Springy FOCUS: Integrates both extensions: bounded total covered length and allowance for up to low values within each covering interval.
These relaxations permit modeling problems where strict interval purity or length limitations are overly severe, increasing modeling flexibility while preserving efficient propagation (Narodytska et al., 2013).
3. Filtering Algorithms and Complexity
Each variant admits a dedicated filtering (propagator) algorithm ensuring bounds consistency (BC) on (and where present) and on each . The main contributions are:
| Constraint Type | Asymptotic Complexity | Key State Structures |
|---|---|---|
| Original FOCUS | ||
| Springy FOCUS | ||
| Weighted/Weighted+Spr. | 2D DPs |
- Original FOCUS: Employs a forward dynamic program to compute, for each position, the minimum number of intervals needed to cover penalizing values up to position under different scenarios, followed by backward scans to prune unsupported variable values.
- Springy: Expands the dynamic state to accommodate up to low values per interval.
- Weighted types: Introduce dynamic programming tables parametrized by both interval count and total cost, with forward and backward passes for full bounds consistency.
Natural decomposition into binaries and aggregate constraints is provably weaker than direct filtering, and incurs higher computational overhead for large or domains (Narodytska et al., 2013).
4. Implementation Considerations
Practical implementation uses flat arrays for dynamic programming states, recycled across pre- and post-scans. Incrementalization is feasible when only narrow changes occur in bounds, but for small- to mid-size standard passes remain computationally cheap. Parameter tuning for or is advised to control the DP table size, while should be minimal to preserve the original semantics. Early instantiation of and can substantially simplify the filtering logic.
5. Applications and Expressiveness
The FOCUS constraint family is well-suited for modeling:
- Temporal or spatial concentration of events (e.g., scheduling maintenance during limited time slots, cluster-based legacy maintenance, or spatially contiguous facility placement).
- Scenarios requiring sparse "bursts" of activity but limited overall intervention (via ) and/or aggregate effort (via ).
- Softening classical "no interruption" or "all at once" constraints in process control.
By switching among original, springy, weighted, and combined generalizations, a modeler can flexibly trade between expressive power and computational efficiency (Narodytska et al., 2013).
6. Comparative Evaluation and Worked Examples
Worked examples provided in the reference text reveal:
- For , , , at most intervals are strictly necessary: e.g., , , .
- Springy FOCUS with and len=2 permits coverage with fewer intervals if tolerance for low values is increased, sometimes at the expense of solution purity.
- Weighted FOCUS enforces not just the interval count but their total length, supporting nuanced trade-offs between segment count and their spatial/temporal duration in the solution space.
Empirical results demonstrate that direct propagators consistently outperform decomposed models, especially as domain sizes grow or additional flexibility (via or ) is introduced (Narodytska et al., 2013).
7. Synthesis and Impact
The FOCUS constraint and its generalizations stand as foundational elements in constraint programming for enforcing concentration and contiguity in sequence assignments. Their clear semantics, linear or quasi-linear filtering, and support for controllable relaxations enable practical use in demanding combinatorial settings. The full family trades only modestly increased overhead for significant modeling flexibility. Real-world adoption benefits from efficient propagators whose performance is robust against a variety of domain sizes and constraint tightness settings. These developments collectively enhance both the expressive and computational capabilities of modern constraint-solving environments (Narodytska et al., 2013).