  The model of population protocols provides a universal platform to study
distributed processes driven by pairwise interactions of anonymous agents.
While population protocols present an elegant and robust model for randomized
distributed computation, their efficiency wanes when tackling issues that
require more focused communication or the execution of multiple processes. To
address this issue, we propose a new, selective variant of population protocols
by introducing a partition of the state space and the corresponding conditional
selection of responders. We demonstrate on several examples that the new model
offers a natural environment, complete with tools and a high-level description,
to facilitate more efficient solutions.
  In particular, we provide fixed-state stable and efficient solutions to two
central problems: leader election and majority computation, both with
confirmation. This constitutes a separation result, as achieving stable and
efficient majority computation requires $\Omega(\log n)$ states in standard
population protocols, even when the leader is already determined. Additionally,
we explore the computation of the median using the comparison model, where the
operational state space of agents is fixed, and the transition function
determines the order between (arbitrarily large) hidden keys associated with
interacting agents. Our findings reveal that the computation of the median of
$n$ numbers requires $\Omega(n)$ time. Moreover, we demonstrate that the
problem can be solved in $O(n\log n)$ time, both in expectation and with high
probability, in standard population protocols. In contrast, we establish that a
feasible solution in selective population protocols can be achieved in
$O(\log^4 n)$ time.
