Integer Programming - packing wolves and sheep
I would approach it in the following way:

Suppose that I have the following sets:


$A$ - the set of all type of animals, i.e. $A = \{\text{wolf},\text{sheep}\}$
$B$ - the set of all possible bins. $B = \{B_1, \ldots, B_{n_B} \}$


Suppose I have the following parameters:


$c$ - a 1-dimensional matrix of the size of $A$, indicating the number of animals, per type that exist. Example: $c = \{2,3\}$ would mean that there are 2 wolfs and 3 sheeps.
$n_B$ - the number of bins available.


And suppose I have the following variable:


$M$ - is the integer matrix $A \times B$ that represents the number of animals per bin. Rows are animals, columns are bins. $M(\text{wolf},B_1) = 2$, for example, would mean that there are 2 wolfs in bin $B_1$.


So, for example, the following matrix:

$$
       M = \left[
 \begin{array}{ccc}
         2 &amp; 1 &amp; 0 \\
         0 &amp; 0 &amp; 1 \\
 \end{array}
\right]
$$

would indicate that there are 2 wolfs in $B_1$, 1 in $B_2$ and 1 sheep in $B_3$.

Your model would be:

$$
\begin{align}
&amp; \text{Minimize}
&amp; &amp; U = \sum_{i = 1}^{n_B} 1 &amp; \text{such that} \sum_A M_{ab_{i}} &gt; 0 \\
&amp; \text{subject to} 
&amp; &amp; \sum_A M_{ab} \leq 2 &amp; \forall b, \\
&amp;&amp;&amp; \prod_A M_{ab} = 0 &amp; \forall b, \\
&amp;&amp;&amp; \sum_B M_{ab} = c_a &amp; \forall a, \\
\end{align}$$

where $a$ is an element of $A$ and $b$ an element of $B$ and $b_i$ is the element of set $B$ at position $i$.

The OBJECTIVE FUNCTION U is the sum of all bins that are actually being used, and it is this sum that you want to minimize. There might be more elegant ways of defining that, but this is what I could think at the moment. Essentially you would count all bins that contain at least one animal - $\sum_A M_{ab_{i}} &gt; 0$ represents that. In GAMS Programming language, I could represent this as what they call a dollar sign condition ($), check the language you are using to see how to impose this condition to the equation. 

The FIRST CONSTRAINT indicates that there can be a maximum of 2 animals per bin - it translates to the following equations:

$$
\begin{align}
&amp; M_{\text{wolf},B_1} + M_{\text{sheep},B_1} \leq 2 &amp;\text{(rules for bin $B_1$)} \\
&amp; M_{\text{wolf},B_2} + M_{\text{sheep},B_2} \leq 2 &amp;\text{(rules for bin $B_2$)} \\
... \\
&amp; M_{\text{wolf},B_{n_B}} + M_{\text{sheep},B_{n_B}} \leq 2 &amp;\text{(rules for bin $B_{n_B}$)} \\
\end{align}$$ 

The SECOND CONSTRAINT limits the type of animals that can be put together - there can only be animals of one type in the bin, so that $M_{\text{wolf},B_1} \cdot M_{\text{sheep},B_1} = 0$, etc.

The THIRD CONSTRAINT limits the number of animals to be put in the bins to the number of animals available.