I am again looking at simple models based on the transportation model:
| Dense Transportation Model |
|---|
| \[\begin{align}\min&\sum_{i,j}\color{darkblue}c_{i,j}\cdot\color{darkred}x_{i,j}\\ & \sum_j \color{darkred}x_{i,j} \le \color{darkblue}a_i && \forall i \\& \sum_i \color{darkred}x_{i,j} \ge \color{darkblue}b_j && \forall j \\ & \color{darkred}x_{i,j} \ge 0 \end{align}\] |
This is a good time to discuss what happens when some links can not be used. When a significant number of links cannot be used, the underlying bipartite graph is called sparse. Let's discuss some of the approaches often used to handle this.
- Use a dense formulation with a large cost coefficient \(\color{darkblue}c_{i,j}=99999\) if the link \(i\rightarrow j\) should not be used. This is my least favorite approach. We need to invent a large penalty cost (should we use 99999 or 999999 or something even more extreme?). This may make the problem poorly scaled.
- Use a dense formulation, but fix \(\color{darkblue}x_{i,j}=0\) for the non-existing links. The solver will remove these fixed variables in the presolve phase before starting to iterate.
- In GAMS we can add to this model.holdfixed=1;. This will remove all fixed variables from the model even before passing on the model to the solver.
- Use a sparse formulation, where don't even generate the non-existing links. I.e. only generate \(\color{darkblue}x_{i,j}\) for existing links. This is my favorite approach. It is the most work, but it is also the most explicit.
- During model generation
- The solver receives a larger model
- Hopefully, it can presolve things away
- The solver has to re-insert solution values during postsolve
- The modeling system receives a larger solution
- 500 supply nodes
- 500 demand nodes
- 80% of the arcs are removed
---- 132 PARAMETER results performance comparison
c x.fx holdfixed sparse
Variables 250001.000250001.00049667.00049667.000
Equations 1001.0001001.0001001.0001001.000
Nonzero elem. 750001.000549667.000148999.000148999.000
Modelstat Optimal Optimal Optimal Optimal
Objective 12015.21812015.21812015.21812015.218
Generation time 0.2420.3010.1580.096
Solver time 0.4680.3310.1070.112
Iterations 967.0001351.0001351.0001351.000
Unexpectedly the first method needs the fewest iterations. The models holdfixed and sparse are almost identical (which makes sense) and are the winners. In general, however, timings are just quite good for this model.
Appendix: GAMS Model
$onText |