An algorithm for controlled selection