{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "---\n", "title: Geographical Clustering With Additional Constraint\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Originally Contributed by**: Matthew Helm ([with help from Mathieu Tanneau on Julia Discourse](https://discourse.julialang.org/t/which-jump-jl-solver-for-this-problem/43350/17?u=mthelm85))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The goal of this exercise is to cluster $n$ cities into $k$ groups, minimizing the total pairwise distance between cities \n", "*and* ensuring that the variance in the total populations of each group is relatively small." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For this example, we'll use the 20 most populous cities in the United States." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
city | population | lat | lon | |
---|---|---|---|---|
String | Int64 | Float64 | Float64 | |
1 | New York, NY | 8405837 | 40.7127 | -74.0059 |
2 | Los Angeles, CA | 3884307 | 34.0522 | -118.244 |
3 | Chicago, IL | 2718782 | 41.8781 | -87.6297 |
4 | Houston, TX | 2195914 | 29.7604 | -95.3698 |
5 | Philadelphia, PA | 1553165 | 39.9525 | -75.1652 |
6 | Phoenix, AZ | 1513367 | 33.4483 | -112.074 |
7 | San Antonio, TX | 1409019 | 29.4241 | -98.4936 |
8 | San Diego, CA | 1355896 | 32.7157 | -117.161 |
9 | Dallas, TX | 1257676 | 32.7766 | -96.7969 |
10 | San Jose, CA | 998537 | 37.3382 | -121.886 |
11 | Austin, TX | 885400 | 30.2671 | -97.743 |
12 | Indianapolis, IN | 843393 | 39.7684 | -86.158 |
13 | Jacksonville, FL | 842583 | 30.3321 | -81.6556 |
14 | San Francisco, CA | 837442 | 37.7749 | -122.419 |
15 | Columbus, OH | 822553 | 39.9611 | -82.9987 |
16 | Charlotte, NC | 792862 | 35.227 | -80.8431 |
17 | Fort Worth, TX | 792727 | 32.7554 | -97.3307 |
18 | Detroit, MI | 688701 | 42.3314 | -83.0457 |
19 | El Paso, TX | 674433 | 31.7775 | -106.442 |
20 | Memphis, TN | 653450 | 35.1495 | -90.0489 |