Introduction
In time-critical computing, "anytime algorithms" are essential tools that can return a valid result even if interrupted, with the quality of that result typically improving as more computation time is allocated. These algorithms generally fall into two categories: interruptible algorithms, which can be stopped at any moment to yield a result, and contract algorithms, which require a pre-specified execution time (a "contract") before they begin. While interruptible algorithms offer more flexibility, many complex real-world systems are composed of contract-style modules.
This paper addresses the challenge of deploying contract algorithms in "crisis situations"—scenarios where a deadline is known to occur within a specific time window, but the exact moment of interruption is uncertain. The goal is to schedule a sequence of contracts to maximize the average quality of the result over the entire possible interruption interval.
The Problem of Uncertain Deadlines
Consider a scenario where an event (the deadline) will occur at some time $t$ within the interval $[t_0, t_e]$. If we schedule a single long contract and the deadline occurs before it completes, the system returns nothing. Conversely, a very short contract provides a result early but may lack the necessary quality. To mitigate this, one can run a sequence of increasingly longer contracts.
The authors demonstrate that finding the absolute optimal sequence of contracts to maximize average quality is NP-hard, as it can be reduced to the classic Knapsack problem. However, they provide a framework for finding near-optimal solutions using discrete approximations and dynamic programming.
Methodology and Approximation
To make the optimization problem tractable, the authors employ several key techniques:
- Stepwise Discretization: Continuous performance profiles—functions that map execution time to result quality—are approximated using stepwise constant functions. The authors prove that the error introduced by this discretization translates linearly to the error in the calculated average quality.
- Dynamic Programming: For scenarios where the time interval is sufficiently large, the problem can be solved in quadratic time ($O(n^2)$) using a dynamic programming approach.
- Empirical Simulation: The strategies were tested against a family of synthetic performance profiles with varying curvatures to evaluate how different quality growth rates affect the optimal scheduling strategy.
Key Insights: The Power of Two
One of the most significant findings of the research is the effectiveness of the "Mixed Preparation" strategy. Instead of a complex schedule of many small contracts, the authors found that running just two well-chosen contracts is remarkably effective.
In their simulations, the average quality achieved by the best two-contract schedule was consistently within 2.75% of the theoretical optimum. While moving from one contract to two provides a massive jump in average quality (slashing error rates from over 12% to under 3%), adding a third or fourth contract yields diminishing returns, often improving the result by less than 0.5%.
Furthermore, the benefit of multiple contracts is highly dependent on the "curvature" of the performance profile. "Concave" profiles, where quality increases rapidly at the start, benefit significantly from multiple contracts. In contrast, for "convex" profiles, a single contract is often sufficient.
Conclusion and Future Work
This research provides a practical heuristic for managing contract algorithms under uncertainty: start with a short contract to establish a baseline result, then use the remaining time for a longer, high-quality contract. This simple two-step approach offers near-optimal performance for most real-world performance profiles.
Future research directions include accounting for "deliberation overhead" (the time taken to compute the schedule itself) and exploring non-uniform probability distributions for the deadline, such as Gaussian distributions, which may more accurately reflect specific real-world risks.
Summary updated