Transportation problem with the least number of transportations. I have a non trivial case of transportational problem. Let me get you familiar with it.
We have $n$ suppliers $a_1, ..., a_n$ and $m$ consumers $b_1, ..., b_m$.
The suppliers volume of goods to supply and consumers volume of goods to consume are non negative real numbers $a_1 \geq 0, ... a_n\geq0 $ and $b_1 \geq 0, ... b_m\geq0 $.
The total volume to supply is equal to the total volume to consume $\sum_{i=1}^{n}a_i = \sum_{i=1}^{m}b_i$.
All the consumers should be satisfied and hence all the suppliers should be emptied  $a_i=\sum_{j=1}^{m}c_{ij}$ and $b_{j}=\sum_{i=1}^{n}c_{ij}$. Where $c_{ij}$ is the positive volume which should be transfered from the supplier $a_i$ to the consumer $b_j$.
Now I introduce the following funciton $f(c_{ij})=
\begin{cases}
 & 1, \quad for \quad c_{ij}>0\\ 
 & 0, \quad for \quad c_{ij}=0 
\end{cases}$.
Now I want to minimize $f$.
My question is what methods may you suggest for the solution of the above problem? I am aware of mathematical programming, but I still can not go further than the formulation I gave above.
Will appreciate any help on the matter.
 A: You can formulate the problem as a Mixed-Integer Program (MIP). To do so, we first introduce a binary indicator variable which will indicate whether supplier $i$ services consumer $j$:
$$x_{ij} =\begin{cases} 1, \text{ supplier } i \text{ services consumer } j\\
0, \text{ otherwise.}  \end{cases}$$
This binary variable is closely related to your function $f$ which we won't be using to solve the problem. Binary decision variables are much more common for this purpose.
Next we introduce a demand variable $c_{ij}$ which will tell us how much of the goods supplier $i$ delivers to consumer $j$ (just as you did above). We can now formulate the whole problem as:
$$\begin{equation*}
\begin{aligned}
& \underset{x}{\text{minimize}}
& & \sum_{i=1}^n x_{ij} \\
& \text{subject to}
& & b_j=\sum_{i=1}^{n}c_{ij}, &\; j = 1, \ldots, m\\
&&& c_{ij} \le x_{ij} a_i & \; j = 1, \ldots, m, \; i= 1, \ldots, n\\
&&& c_{ij} \ge 0&\; j = 1, \ldots, m, \; i= 1, \ldots, n\\
&&& x_{ij} \in \{0,1\} &\; j = 1, \ldots, m, \; i= 1, \ldots, n
\end{aligned}
\end{equation*}$$
The objective function counts how many suppliers deliver different consumers. The first set of constraints makes sure that each consumer is fully delivered. The second set of constraints ensures that if $i$ delivers $j$ then $x_{i_j}$ needs to equal 1. In this problem the goods are modeled as continous variables. If they are supposed to be discrete then you would need to add an additional constraint such as $c_{ij}  \in \mathbb{Z}$. The problem itself can be solved with a MIP solver. In addition to the commercial ones as CPLEX and Gurobi there are also many free open source solvers to solve problems like this.
One more remark concerning your variable names: $c$ is usually used for costs. In such problems the demand variable is usually called $d$. Of course it is completely up to you what you call your variables. I just wanted to point out that in the literature these variable names often serve a different purpose.
