experiments.sumofproducts
Module summary
Performs the sum-of-products linearize/solve exercise.
(In the implementation details below, click on class/function names for additional documentation and links to the source code.)
❖❖❖
Implements functions (outside the classes above):
|
Generates an instance. |
|
Makes a MIP model for the problem, with Gurobi. |
❖❖❖
Implementation details
❖❖❖
Functions
- experiments.sumofproducts.gen_instance(n, M=3, jmax=3, Cmax=10.0)[source]
Generates an instance.
- Parameters
n (int) – number of variables
M (int) – number of terms in the sum
jmax (int) – number of vars in a term, at most
Cmax (float) – cost coefficient will be -Cmax..Cmax
- Returns
list of lists of indices c (list): list of costs (per sum term)
- Return type
I (list)