Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ILP for pathfinding/routing #761

Merged
merged 21 commits into from
Dec 8, 2023
Merged

ILP for pathfinding/routing #761

merged 21 commits into from
Dec 8, 2023

Conversation

makslevental
Copy link
Contributor

@makslevental makslevental commented Nov 15, 2023

This PR implements routing/path-finding using ILP (using Gurobi/or-tools) through the python pass registration mechanism landed in #710.

Background literature on the (static) Traffic Assignment problem can be found here and here. Brief summary of the model follows; define:

  • $(i,j) \in A$ : edges/wires between switchboxes;
  • $\mathbf{h}$ : all possible flows, indexed by possible paths $\pi \in \Pi(r, s)$ from path-endpoint (source) $r$ to path-endpoint (target) $s$;
  • $d^{rs}$ : number of flows we need to route from $r$ to $s$;
  • $x_{ij}$ : amount of flow across an edge/link/wire;
  • $t_{ij}(x_{ij})$ : the link performance/penalty functions.

Then the optimization problems is

$$\begin{align} \min_{\mathbf{x}, \mathbf{h}} & & \sum_{\mathbf{h}} t_{ij}(x_{ij})\cdot x_{ij} && (1) \\\ \text{s.t.} & & x_{ij} = \sum_{\pi \in \Pi} \delta_{ij}^\pi h^\pi && (2) \\\ && d^{rs} = \sum_{\pi \in \Pi(r ,s)} h^\pi && (2) \\\ && x_{ij} \in \{0, \dots, c_{ij} \} && (3) \end{align}$$

where

  1. the objective to minimze, is the Total System Sime (TST), i.e., can be read as "minimize distance $\times$ time for all flows";
  2. flow constraints - flow across each edge is the sum of contributions from all flows with paths passing through that edge;
  3. all requested flows must be routed;
  4. each edge must not exceed its capacity.

The above model is (roughly) encoded in two modeling languages (Gurobi and or-tools), in utils.py, and tested in CI (only or-tools). Furthermore, in the or-tools formulation, another objective is implemented (minimum number of global edges) in order to compare/constrast with the existing AIEPathfinder.

I am still iterating on the pieces/parts/places but the core (the modeling) is done (I believe) and it would be good to get feedback on the design ASAP.

@makslevental makslevental force-pushed the python_dynamic_tiling_pass branch 30 times, most recently from 2f9b9cd to e64b995 Compare November 18, 2023 18:30
@makslevental makslevental force-pushed the python_dynamic_tiling_pass branch 2 times, most recently from a3b3f1a to 60ca87a Compare December 8, 2023 08:07
@makslevental makslevental force-pushed the python_dynamic_tiling_pass branch from 60ca87a to cc9357d Compare December 8, 2023 08:08
@makslevental makslevental force-pushed the python_dynamic_tiling_pass branch from cc9357d to a532b0c Compare December 8, 2023 08:38
@makslevental makslevental enabled auto-merge (squash) December 8, 2023 08:40
@makslevental makslevental merged commit a63eb5d into main Dec 8, 2023
7 checks passed
@makslevental makslevental deleted the python_dynamic_tiling_pass branch December 8, 2023 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants