In [1], I discussed coloring all US counties (3,221 of them) such that neighboring counties have a different color. The famous 4-color theorem says we can do this with just 4 colors. After some adventures with the data, I was indeed able to produce maps with 4 colors.
Model 1: US Counties colored with minimum number of colors |
An interesting part is the color count table. That table shows the number of counties colored by each color. This is a bit unbalanced. So an obvious question is:
Can we find a 4-coloring that has a more equal use of colors?
To recap, the original graph coloring model looked like:
Model 1: Minimize number of colors model |
---|
\[\begin{align} \min & \sum_c \color{darkred}u_c \\ & \sum_c \color{darkred}x_{n,c}=1 &&\forall n \\ & \color{darkred}x_{i,c}+\color{darkred}x_{j,c} \le \color{darkred}u_c && \forall \color{darkblue}{\mathit{arc}}_{i,j}, c \\ & \color{darkred}u_c \le \color{darkred}u_{c-1} && \forall c\gt 1 \\ & \color{darkred}x_{n,\color{darkgreen}{\mathit{color1}}} = 1 && \text{for all isolated counties}\\ & \color{darkred}x_{n,c} \in \{0,1\} \\ & \color{darkred}u_c \in \{0,1\} \end{align} \] |
This model delivered 4 as the optimal solution. Now we want to minimize the spread in the color count. We can reuse the original model, and convert the objective into a constraint: \[\sum_c \color{darkred}u_c=4\] but another, probably simpler approach is just to restrict the set \(c\) of colors to just 4 elements. With this, a model can be:
Model 2: Minimize spread in color count |
---|
\[\begin{align} \min\> & \color{darkred}{\mathit{range}} = \color{darkred}{\mathit{maxCount}} -\color{darkred}{\mathit{minCount}}\\ &\color{darkred}{\mathit{maxCount}} \ge \color{darkred}{\mathit{count}}_c && \forall c\\ &\color{darkred}{\mathit{minCount}} \le \color{darkred}{\mathit{count}}_c && \forall c\\ &\color{darkred}{\mathit{count}}_c = \sum_n\color{darkred}x_{n,c} && \forall c\\ & \sum_c \color{darkred}x_{n,c}=1 &&\forall n \\ & \color{darkred}x_{i,c}+\color{darkred}x_{j,c} \le 1 && \forall \color{darkblue}{\mathit{arc}}_{i,j}, c \\ & \color{darkred}x_{n,c} \in \{0,1\} \\ & c = \{\color{darkgreen}{col1},\color{darkgreen}{col2},\color{darkgreen}{col3},\color{darkgreen}{col4}\} \end{align} \] |
- The variable \(\color{darkred}u_c\) is dropped. We know it is 1 if set \(c\) has just 4 colors.
- Isolated counties now become interesting again: they play a role. We no longer fix them to have color 1.
Symmetry breaking
Alabama counties |
The worst spread
Model 3a: Maximize spread in color count |
---|
\[\begin{align} \max\> & \color{darkred}{\mathit{range}} = \color{darkred}{\mathit{maxCount}} -\color{darkred}{\mathit{minCount}}\\ &\color{darkred}{\mathit{maxCount}} \ge \color{darkred}{\mathit{count}}_c && \forall c \\ &\color{darkred}{\mathit{maxCount}} \le \color{darkred}{\mathit{count}}_c + \color{dakblue}M \color{darkred}\delta^{\mathit{max}}_c&&\forall c \\ & \sum_c \color{darkred}\delta^{\mathit{max}}_c = {\bf{card}}(c)-1 \\ &\color{darkred}{\mathit{minCount}} \le \color{darkred}{\mathit{count}}_c && \forall c \\ &\color{darkred}{\mathit{minCount}} \ge \color{darkred}{\mathit{count}}_c - \color{dakblue}M \color{darkred}\delta^{\mathit{min}}_c&&\forall c \\ & \sum_c \color{darkred}\delta^{\mathit{min}}_c = {\bf{card}}(c)-1 \\ &\color{darkred}{\mathit{count}}_c = \sum_n\color{darkred}x_{n,c} && \forall c\\ & \sum_c \color{darkred}x_{n,c}=1 &&\forall n \\ & \color{darkred}x_{i,c}+\color{darkred}x_{j,c} \le 1 && \forall \color{darkblue}{\mathit{arc}}_{i,j}, c \\ & \color{darkred}x_{n,c} \in \{0,1\} \\ & \color{darkred}\delta^{\mathit{min}}_c, \color{darkred}\delta^{\mathit{max}}_c \in \{0,1\} \\ & c = \{\color{darkgreen}{col1},\color{darkgreen}{col2},\color{darkgreen}{col3},\color{darkgreen}{col4}\} \end{align} \] |
- A conservative value for \(\color{darkblue}M\) is \(\color{darkblue}M = {\bf{card}}(n)\).
- We can use the solution of model 1 as incumbent using the mipstart option.
- This is a very difficult model to solve.
Model 3b: Maximize spread in color count |
---|
\[\begin{align} \max\> & \color{darkred}{\mathit{range}} = \color{darkred}{\mathit{count}}_{\color{darkgreen}{\mathit{col1}}} - \color{darkred}{\mathit{count}}_{\color{darkgreen}{\mathit{col4}}}\\ &\color{darkred}{\mathit{count}}_c = \sum_n\color{darkred}x_{n,c} && \forall c\\ & \sum_c \color{darkred}x_{n,c}=1 &&\forall n \\ & \color{darkred}x_{i,c}+\color{darkred}x_{j,c} \le 1 && \forall \color{darkblue}{\mathit{arc}}_{i,j}, c \\ &\color{darkred}{\mathit{count}}_c \le \color{darkred}{\mathit{count}}_{c-1} && \forall c \gt 1 \\ & \color{darkred}x_{n,c} \in \{0,1\} \\ & c = \{\color{darkgreen}{col1},\color{darkgreen}{col2},\color{darkgreen}{col3},\color{darkgreen}{col4}\} \end{align} \] |
Conclusion
References
- http://yetanothermathprogrammingconsultant.blogspot.com/2022/01/coloring-us-county-map.html
- Data-Driven Documents, https://d3js.org/.
Appendix: GAMS Model 2
$ontext |