This is a minimum working example
of Parametric Integer Programming1 (PIP),
a means to solving Integer Linear Programs (ILPs) with parameters
The principal idea is to run a simplex solver but symbolically, i.e., leave the parameters unevaluated until the pivot step, at which point you branch depending on the sign of the coefficient (and already explored branches). The solution is then a piecewise affine function of the parameters.
For example, the system
induces the following tree structure
and produces the following solution
Images from 2.
What's a use-case for this technique? Suppose you have a Deep Neural Network (DNN), for which you'd like to statically plan memory allocations (for the intermediate tensors produced during a forward pass of the DNN). This is an instance of Dynamic Storage Allocation:
where tensors
where
This is clearly an Integer Linear Program (ILP) and if we treat
Besides the dependencies listed in requirements.txt, you will, at minimum, need a free license for
Wolfram Engine.
A license for Gurobi is also recommended; be sure to set GRB_LICENSE_FILE=<PATH>/gurobi.lic
in the env variables.
This repo is purely for illustration and experimentation. The code is guaranteed to be neither correct nor fast nor original i.e., it has, in fact, been cobbled together from various sources. Maybe one day it'll be something...
Footnotes
-
Section 5.1 of New Algorithmics for Polyhedral Calculus via Parametric Linear Programming by Alexandre Maréchal (this is the best gentle introduction to the ideas) ↩