Let the following data be given.
- Two positive integers $m$ and $n$.
- A family of sets $B_a \subseteq \{1, \dots, n\}$ (for $a \in \{1, \dots, m\}$).
The task is to count the number $N$ of injective functions $$f \colon \{1, \dots, m\} \to \{1, \dots, n\}$$ such that $f(a) \in B_a$ for each $a \in \{1, \dots, m\}$.
I'm pretty much sure this must be a well known problem in combinatorial enumeration.
For example, the numbers $1,\dots,n$ represent $n$ employees, the numbers $1,\dots,m$ represent $m$ tasks, the set $B_a$ represent the tasks that employee $a$ can perform, and $f$ is an assignment of the tasks (assuming that no more than one employee can work on a task, and it is fine is some tasks are unassigned). Then $N$ is the number of possible task assignments.
Also, the question is similar to that of determining rooks polynomials, but somehow weaker, because all the board must be filled.
Also also, I suspect the problem to be "hard". Something like the "analog" of NP-complete for counting problems (I'm not familiar with complexity classes of counting problems, sorry).
My question is: Where can I find a reference to this problem and to the state-of-the-art algorithms to solve it?
I'm aware of a simple recursive algorithm to compute $N$ (simply loop over the possible $f(1)$, then recursively over the possible $f(2)$, ... keeping tracks of the used values) that has complexity about $N$.
Thanks!