Papers
Topics
Authors
Recent
2000 character limit reached

FOCUS Algorithm in Constraint Programming

Updated 7 December 2025
  • 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 nn integer variables X=[x0,…,xn−1]X = [x_0, \ldots, x_{n-1}] and introduces three parameters: a threshold kk, maximum interval length len\mathit{len}, and an interval bound variable ycy_c. Specifically, FOCUS(X,yc,len,k)(X, y_c, \mathit{len}, k) is satisfied if there exists a collection SXS_X of disjoint intervals [i,j][i,j] such that:

  1. ∣SX∣≤yc|S_X| \leq y_c.
  2. For each ℓ<n\ell < n: xℓ>k  ⟺  ∃s∈SX:ℓ∈sx_\ell > k \iff \exists s \in S_X: \ell \in s.
  3. For all si,j∈SXs_{i,j} \in S_X: j−i+1≤lenj - i + 1 \leq \mathit{len}.

All occurrences of xâ„“>kx_{\ell} > k must thus be "concentrated" within at most ycy_c intervals, each of maximum allowed length len\mathit{len} (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 hh values not exceeding kk within each covering interval but still requires endpoints xi,xj>kx_i, x_j > k. The constraint can be written as SpringyFocus(X,yc,len,h,k)\text{SpringyFocus}(X, y_c, \mathit{len}, h, k). For h=0h=0, it recovers the original FOCUS constraint.
  • Weighted FOCUS: Introduces a total covered length variable zcz_c, bounding the aggregate length of the intervals: ∑s∈SX∣s∣≤zc\sum_{s\in S_X} |s| \leq z_c, in addition to the original interval count constraint.
  • Weighted + Springy FOCUS: Integrates both extensions: bounded total covered length and allowance for up to hh 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 ycy_c (and zcz_c where present) and on each xâ„“x_\ell. The main contributions are:

Constraint Type Asymptotic Complexity Key State Structures
Original FOCUS O(n)O(n) p≤(ℓ),p>(ℓ)p_\leq(\ell), p_>(\ell)
Springy FOCUS O(n)O(n) p≤,pS,p>p_\leq, p_S, p_>
Weighted/Weighted+Spr. O(nâ‹…zcU)O(n \cdot z_c^U) 2D DPs f[c,â„“],b[c,â„“]f[c,\ell], b[c,\ell]
  • 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 â„“\ell under different scenarios, followed by backward scans to prune unsupported variable values.
  • Springy: Expands the dynamic state to accommodate up to hh 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 ycy_c or zcz_c 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 nn standard O(n)O(n) passes remain computationally cheap. Parameter tuning for len\mathit{len} or zcz_c is advised to control the DP table size, while hh should be minimal to preserve the original semantics. Early instantiation of ycy_c and zcz_c 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 ycy_c) and/or aggregate effort (via zcz_c).
  • 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 X=[1,0,0,1,1,0,1]X=[1,0,0,1,1,0,1], k=0k=0, len=2\mathit{len}=2, at most yc=2y_c=2 intervals are strictly necessary: e.g., [0,0][0,0], [3,4][3,4], [6,6][6,6].
  • Springy FOCUS with h=1h=1 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 hh or zcz_c) 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).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Whiteboard

Follow Topic

Get notified by email when new papers are published related to FOCUS Algorithm.