[Paper Review] Projection onto the capped simplex
This paper presents an exact, O(D²)-time algorithm for Euclidean projection onto the capped simplex—a set defined by a sum constraint and box constraints (0 ≤ x ≤ 1). The method leverages KKT conditions and a two-loop search over active sets to identify zero, intermediate, and unit-value components, enabling efficient and precise projection. The approach outperforms general solvers like CVX and lsqlin, especially in high dimensions, with C++ implementation achieving two orders of magnitude speedup over MATLAB.
We provide a simple and efficient algorithm for computing the Euclidean projection of a point onto the capped simplex---a simplex with an additional uniform bound on each coordinate---together with an elementary proof. Both the MATLAB and C++ implementations of the proposed algorithm can be downloaded at https://eng.ucmerced.edu/people/wwang5.
Motivation & Objective
- To develop a fast and exact algorithm for computing the Euclidean projection of a point onto the capped simplex, a set defined by a sum constraint and box constraints.
- To generalize the projection onto the probability simplex (s = 1) to arbitrary s ∈ [0, D] with upper and lower bounds on variables.
- To provide a simple, efficient, and provably correct algorithm with explicit implementation and elementary proof.
- To demonstrate significant performance gains over general-purpose convex optimization solvers in high-dimensional settings.
Proposed method
- The algorithm begins by sorting the input vector y in ascending order to align with the expected order of the optimal solution x.
- It searches over all possible pairs (a, b) where a is the number of zero components and b is the index up to which components are strictly between 0 and 1.
- For each candidate (a, b), it computes the dual variable γ using the formula γ = (s + b - D - T_a + T_b) / (b - a), where T_k is the partial sum of the first k sorted components.
- It validates candidate (a, b, γ) by checking the KKT conditions: y_a + γ ≤ 0, y_{a+1} + γ > 0, y_b + γ < 1, and y_{b+1} + γ ≥ 1.
- The final solution is constructed as x_i = 0 for i ≤ a, x_i = y_i + γ for i = a+1 to b, and x_i = 1 for i > b.
- A special case handles when a = b (all components are 0 or 1), requiring s = D - a and y_{a+1} - y_a ≥ 1.
Experimental results
Research questions
- RQ1How can we efficiently compute the exact Euclidean projection onto the capped simplex, a constrained set combining a sum constraint and box bounds?
- RQ2What is the computational complexity of solving this problem exactly, and how does it compare to general convex optimization solvers?
- RQ3Can we derive a simple and efficient algorithm based on KKT conditions and active set identification?
- RQ4How does the performance of the proposed method scale with dimension D, especially in comparison to CVX and lsqlin?
- RQ5What is the impact of implementing the algorithm in C++ versus MATLAB on runtime performance?
Key findings
- The proposed O(D²) algorithm computes the exact projection onto the capped simplex, with correctness proven via KKT conditions and an elementary proof.
- The algorithm is significantly faster than CVX and lsqlin, especially as dimension D increases, with the C++ version achieving up to 100× speedup over MATLAB.
- For D = 100,000, the C++ implementation runs in 8.78 seconds, while lsqlin and CVX run out of memory.
- The performance gap widens with increasing D, confirming that exploiting problem structure is critical for scalability.
- The method is robust and handles all s ∈ [0, D], including the special case s = 1 (probability simplex), as a subset.
- The algorithm avoids iterative methods and converges in a fixed number of steps, ensuring deterministic and precise results.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.