Repository navigation
🧩 Constraint Solving POTD:Problem of the Day: Weighted Interval Scheduling #73175
Closed
Replies: 1 comment
|
This discussion has been marked as outdated by Constraint Solving — Problem of the Day. A newer discussion is available at Discussion #73489. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem Statement
Given a set of jobs (intervals), each with a start time, end time, and profit (or weight), select a subset of non-overlapping jobs that maximizes total profit. Two jobs conflict if their intervals overlap (i.e., job i and job j conflict if
start_i < end_jandstart_j < end_i).Concrete Instance
Suppose you have 6 jobs:
Goal: Select jobs so no two overlap and the total profit is maximized.
Optimal solution: Select jobs {1, 3, 6} with total profit = 5 + 5 + 7 = 17.
Input/Output
Why It Matters
This problem bridges classical optimization and real-world scheduling constraints—it's simple to state but offers rich algorithmic insights.
Modeling Approaches
Approach 1: Dynamic Programming (Classical)
Paradigm: Declarative optimization via value iteration
Sort jobs by end time. Let
dp[i]= maximum profit using jobs from 1 to i. For each job i, decide: include it (add profit_i to dp[p(i)], where p(i) is the latest job ending before job i starts) or skip it (take dp[i-1]).Pros:
Cons:
Recurrence:
Approach 2: Integer Linear Programming (MIP)
Paradigm: Constraint and optimization modeling
Define binary variable
x_i ∈ {0, 1}for each job (1 = select, 0 = skip).Decision variables:
x_i ∈ {0, 1}for job iConstraints:
x_i + x_j ≤ 1Σ profit_i × x_iObjective:
Σ profit_i × x_iPros:
Cons:
Approach 3: Constraint Programming with Global Constraints
Paradigm: Declarative constraint satisfaction with specialized propagators
Use a global cumulative-style constraint or custom
no_overlappredicate.Pseudo-code (MiniZinc-like):
Pros:
Cons:
Example Model (MiniZinc Pseudo-code)
Key Techniques
1. Sorting and Preprocessing
Sorting jobs by end time is crucial for the DP approach. It reduces the recurrence to O(n) after O(n log n) preprocessing. For any model, removing dominated jobs (subsumed by better alternatives) tightens bounds.
2. Binary Search for Latest Compatible Job
In DP, finding p(i) (the latest job ending before job i) via binary search reduces overall complexity from O(n2) to O(n log n). This is a classic trick for interval problems.
3. Symmetry Breaking and Lower Bounds (MIP/CP)
4. Greedy Heuristics as Initial Bounds
Greedy algorithms—e.g., "select earliest-ending non-conflicting job" or "select highest-profit non-conflicting job"—rarely give optimal solutions but provide fast initial upper/lower bounds, accelerating solver convergence.
Challenge Corner
Can you solve a constrained variant?
Extend the problem: each selected job consumes a resource (e.g., staff hours). If you have a limited resource budget B, how does the model change? Can you still use DP? What if jobs now have precedence constraints (job i must finish before job j can start)?
Deeper question: The unweighted interval scheduling problem (maximize number of non-overlapping jobs) is solved greedily in O(n log n). Why doesn't the greedy approach work when profits are added? Can you construct a small counterexample?
References
Kleinberg, J. & Tardos, É. (2006). Algorithm Design (Chapters 6–7). Pearson. — Classic DP coverage with interval scheduling as a starred example.
Williams, H. P. (2013). Model Building in Mathematical Programming (5th ed.). Wiley. — MIP modeling perspective on scheduling problems.
Rossi, F., van Beek, P., & Walsh, T. (2006). Handbook of Constraint Programming (Chapter 11). Elsevier. — Global constraints and constraint propagation for scheduling.
Skiena, S. S. (2020). The Algorithm Design Manual (3rd ed.), Section 7.6. — Accessible treatment with implementation guidance.
All reactions