## Best algorithm/software for solving a planar transportation problem ?

### Remember to vote up questions/answers you find interesting or helpful (requires 15 reputation points)

I am looking for software (open-source or otherwise) or an implementable algorithm for solving a continuous transportation problem. The input consists of a pointset in a planar rectangle, and we need to relocate these points within the rectangle to decrease the peak density below a given threshold (feasibility can be assumed), while minimizing total displacement.

The distances inside the rectangle are Manhattan/taxicab, although efficient solutions for the Euclidean distance can also be helpful. Total displacement is interpreted in the $L_1$ sense, but efficient solutions for the $L_2$ case can also be helpful. The peak density can be evaluated with respect to a uniform grid (is there another practical way ?)

My students implemented a geometric algorithm (without having any background in transportation) that works great in our application, but we don't know how far the results are from optimal. Just in case, our application also imposes rectangular "exclusion zones", where no points can be placed (more generally, we can assume a "bounding probability distribution").

-

Have you tried it on examples where you know what the optimal placement is?  Gerhard "Ask Me About System Design" Paseman,  2012.02.04 – Gerhard Paseman Feb 5 2012 at 5:07
Yes, and it is suboptimal. Recall that 1D transportation has a simple/closed-form solution, implemented for a pointset input by sorting. In 2D, we alternate optimal transportation in X,Y directions, position cutlines at median locations, then recursively divide and conquer. Now consider a pointset distributed normally in 2D. The 1D solution can be applied radially, but our algorithm produces something blocky. A more important question for us is how the suboptimality affects our application (which can "transport" millions of points 40-50 times per run)- this is difficult to answer w/o a solver  – Igor Markov Feb 6 2012 at 8:15

## 2 Answers

How much have you looked into the theory of optimal transport? It's very popular for image warping/registration.

There's codes available to compute the $l1$-optimal transport distance (also referred to as "Earth mover's distance") here: http://ai.stanford.edu/~rubner/emd/default.htm and here: http://www.cs.huji.ac.il/~ofirpele/FastEMD/code/

The $l2$ optimal mass transport problem is quite difficult but can be solved: http://www.springerlink.com/index/40PGJBKDC9V0UH94.pdf

Once it's possible to compute the cost to get between two distributions of points I guess you'll have to optimize to see which distribution is closest to the one you have. Maybe something like: $$\min_\rho d(\rho_0, \rho)\;subject\;to\;\rho \leq c, \rho \geq 0,\int \rho = 1$$ where $\rho$ is a probability distribution describing the density of points and $c$ is your threshold. Maybe you can do this with a Lagrange multiplier and gradient descent?

-

Looking into it very closely now. While we are now leaning toward $l_2$-optimal transport because it tends to preserve the relative ordering of "the grains of sand" being transported. Also, the uniqueness of $l_2$-optimal solutions is useful. But we'll definitely take a look at the software you suggested. – Igor Markov Mar 30 2012 at 21:36
Sure. The book by Villani (who got a fields medal last time around) "Topics in Optimal Transportation" has more information in this field than I can give you. – rcompton Mar 30 2012 at 22:36

### You can accept an answer to one of your own questions by clicking the check mark next to it. This awards 15 reputation points to the person who answered and 2 reputation points to you.

You can use the code packages rcompton mentioned to compute transportation with any kind of cost function (called also ground distance). If you have "exclusion zones" you can just set the cost there to be a very high number there (you can for example, compute a solution that is not optimal and set it as a cost). If you have many edges with this maximum distance, it also has the advantage of this code running faster: http://www.cs.huji.ac.il/~ofirpele/FastEMD/code/

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 8, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9038892984390259, "perplexity_flag": "middle"}