|
57 | 57 | "import plotly.graph_objects as go" |
58 | 58 | ] |
59 | 59 | }, |
| 60 | + { |
| 61 | + "cell_type": "markdown", |
| 62 | + "id": "3c038388", |
| 63 | + "metadata": {}, |
| 64 | + "source": [ |
| 65 | + "## Set a path to the data used\n", |
| 66 | + "**If you downloaded the notebook/data and are running this locally**, make sure the data is in the same directory as the notebook and run the cell below, or update it to the correct path." |
| 67 | + ] |
| 68 | + }, |
| 69 | + { |
| 70 | + "cell_type": "code", |
| 71 | + "execution_count": null, |
| 72 | + "id": "7a89d263", |
| 73 | + "metadata": {}, |
| 74 | + "outputs": [], |
| 75 | + "source": [ |
| 76 | + "# Run this cell if you're working locally on your machine.\n", |
| 77 | + "# Change the path if needed.\n", |
| 78 | + "path = ''" |
| 79 | + ] |
| 80 | + }, |
| 81 | + { |
| 82 | + "cell_type": "markdown", |
| 83 | + "id": "f31bd577", |
| 84 | + "metadata": {}, |
| 85 | + "source": [ |
| 86 | + "**If you are running this in Colab** run this cell below to set the path to read the data from the GitHub repository." |
| 87 | + ] |
| 88 | + }, |
| 89 | + { |
| 90 | + "cell_type": "code", |
| 91 | + "execution_count": null, |
| 92 | + "id": "f0fd6095", |
| 93 | + "metadata": {}, |
| 94 | + "outputs": [], |
| 95 | + "source": [ |
| 96 | + "# Run this cell if you are using Colab.\n", |
| 97 | + "path = 'https://raw.githubusercontent.com/Gurobi/modeling-examples/refs/heads/master/optimization301/PoC_to_Production_Exercise/ex1_orders.csv'" |
| 98 | + ] |
| 99 | + }, |
60 | 100 | { |
61 | 101 | "cell_type": "markdown", |
62 | 102 | "id": "9b1d2eb8-8875-4eec-8fca-001285136186", |
|
70 | 110 | }, |
71 | 111 | { |
72 | 112 | "cell_type": "code", |
73 | | - "execution_count": 2, |
| 113 | + "execution_count": null, |
74 | 114 | "id": "96e1ee44-cd58-4593-bbe9-539cefbefb40", |
75 | 115 | "metadata": {}, |
76 | 116 | "outputs": [], |
77 | 117 | "source": [ |
78 | 118 | "def ex1():\n", |
79 | 119 | " # Load the data\n", |
80 | | - " orders = pd.read_csv('ex1_orders.csv')\n", |
81 | | - " vehicles = pd.read_csv('ex1_vehicles.csv')\n", |
| 120 | + " orders = pd.read_csv(path+'ex1_orders.csv')\n", |
| 121 | + " vehicles = pd.read_csv(path+'ex1_vehicles.csv')\n", |
82 | 122 | " num_orders = len(orders)\n", |
83 | 123 | " num_vehicles = len(vehicles)\n", |
84 | 124 | " # Build the model\n", |
|
173 | 213 | }, |
174 | 214 | { |
175 | 215 | "cell_type": "code", |
176 | | - "execution_count": 5, |
| 216 | + "execution_count": null, |
177 | 217 | "id": "2e2c281e-3c4d-4d73-a8f6-38945522163a", |
178 | 218 | "metadata": {}, |
179 | 219 | "outputs": [], |
180 | 220 | "source": [ |
181 | 221 | "def ex2():\n", |
182 | | - " dcs_df = pd.read_csv('ex2_dcs.csv')\n", |
183 | | - " cust_df = pd.read_csv('ex2_customers.csv')\n", |
184 | | - " lanes_df = pd.read_csv('ex2_lanes.csv')\n", |
| 222 | + " dcs_df = pd.read_csv(path+'ex2_dcs.csv')\n", |
| 223 | + " cust_df = pd.read_csv(path+'ex2_customers.csv')\n", |
| 224 | + " lanes_df = pd.read_csv(path+'ex2_lanes.csv')\n", |
185 | 225 | " # Built some objects for convenience and speed\n", |
186 | 226 | " dc = dcs_df['dc_id'].tolist()\n", |
187 | 227 | " cust = cust_df['cust_id'].tolist()\n", |
|
245 | 285 | }, |
246 | 286 | { |
247 | 287 | "cell_type": "code", |
248 | | - "execution_count": 7, |
| 288 | + "execution_count": null, |
249 | 289 | "id": "3feef743-1f31-4fe5-a6fc-d6e75cb1d6a7", |
250 | 290 | "metadata": { |
251 | 291 | "editable": true, |
|
257 | 297 | "outputs": [], |
258 | 298 | "source": [ |
259 | 299 | "def plot_ex2():\n", |
260 | | - " dcs = pd.read_csv('ex2_dcs.csv')\n", |
261 | | - " customers = pd.read_csv('ex2_customers.csv')\n", |
| 300 | + " dcs = pd.read_csv(path+'ex2_dcs.csv')\n", |
| 301 | + " customers = pd.read_csv(path+'ex2_customers.csv')\n", |
262 | 302 | " fig = go.Figure()\n", |
263 | 303 | " # Customers\n", |
264 | 304 | " fig.add_trace(go.Scattermap(\n", |
|
1514 | 1554 | }, |
1515 | 1555 | { |
1516 | 1556 | "cell_type": "code", |
1517 | | - "execution_count": 10, |
| 1557 | + "execution_count": null, |
1518 | 1558 | "id": "704e66ff-cab2-439e-869a-63fcf76e4c19", |
1519 | 1559 | "metadata": {}, |
1520 | 1560 | "outputs": [], |
1521 | 1561 | "source": [ |
1522 | 1562 | "def ex5():\n", |
1523 | | - " dcs_df = pd.read_csv('ex2_dcs.csv')\n", |
1524 | | - " cust_df = pd.read_csv('ex2_customers.csv')\n", |
1525 | | - " lanes_df = pd.read_csv('ex2_lanes.csv')\n", |
| 1563 | + " dcs_df = pd.read_csv(path+'ex2_dcs.csv')\n", |
| 1564 | + " cust_df = pd.read_csv(path+'ex2_customers.csv')\n", |
| 1565 | + " lanes_df = pd.read_csv(path+'ex2_lanes.csv')\n", |
1526 | 1566 | "\n", |
1527 | 1567 | " # Built some objects for convenience and speed\n", |
1528 | 1568 | " dc = dcs_df['dc_id'].tolist()\n", |
|
1845 | 1885 | ], |
1846 | 1886 | "metadata": { |
1847 | 1887 | "kernelspec": { |
1848 | | - "display_name": "opti", |
| 1888 | + "display_name": "Python 3", |
1849 | 1889 | "language": "python", |
1850 | | - "name": "opti" |
| 1890 | + "name": "python3" |
1851 | 1891 | }, |
1852 | 1892 | "language_info": { |
1853 | 1893 | "codemirror_mode": { |
|
1859 | 1899 | "name": "python", |
1860 | 1900 | "nbconvert_exporter": "python", |
1861 | 1901 | "pygments_lexer": "ipython3", |
1862 | | - "version": "3.11.13" |
| 1902 | + "version": "3.13.5" |
1863 | 1903 | } |
1864 | 1904 | }, |
1865 | 1905 | "nbformat": 4, |
|
0 commit comments