Understand Greedy Pruning for NChooseK Constraints
mainGreedy pruning is a feasibility-first optimization technique used to satisfy NChooseK constraints (cardinality constraints) and semi-continuity constraints (e.g., allow_zero = True with a lower bound lb).
Unlike the standard BONSAI algorithm which prioritizes minimizing acquisition loss, this implementation prioritizes finding a feasible candidate that exactly satisfies the constraints. It works by starting with an acquisition function maximization on a convex relaxation and then iteratively applying greedy actions to resolve violations.
The Pruning Process
- Step 0: Initial Optimization: Perform acquisition function maximization on the convex relaxation of the problem.
- Step 1: Greedy Pruning Loop: While constraints (like
max_countor semi-continuity) are violated:- Evaluate potential actions (e.g.,
zero(x_i)oractive(x_i)). - Project candidates onto the mixture/equality constraints.
- Select the action with the highest acquisition value (smallest acquisition reduction).
- The
min_countguard prevents actions that would violate the minimum required active features.
- Evaluate potential actions (e.g.,
- Step 2: Termination: The loop terminates when all features are non-fractional and the active count
asatisfiesmin_count <= a <= max_count. - Step 3: Local Reoptimization (Optional): If
final_local_reoptis enabled, a final local optimization is run with the pruned features fixed to zero to refine the remaining active values.