several approaches for solving problems with piecewise linear functions. More...
Go to the source code of this file.
Functions | |
| def | mult_selection (model, a, b) |
| def | convex_comb_sos (model, a, b) |
| def | convex_comb_dis (model, a, b) |
| def | gray (i) |
| def | convex_comb_dis_log (model, a, b) |
| def | convex_comb_agg (model, a, b) |
| def | convex_comb_agg_log (model, a, b) |
several approaches for solving problems with piecewise linear functions.
Definition in file piecewise.py.
| def piecewise.convex_comb_agg | ( | model, | |
| a, | |||
| b | |||
| ) |
convex_comb_agg -- add piecewise relation convex combination formulation -- non-disaggregated.
Parameters:
- model: a model where to include the piecewise linear relation
- a[k]: x-coordinate of the k-th point in the piecewise linear relation
- b[k]: y-coordinate of the k-th point in the piecewise linear relation
Returns the model with the piecewise linear relation on added variables X, Y, and z.
Definition at line 149 of file piecewise.py.
| def piecewise.convex_comb_agg_log | ( | model, | |
| a, | |||
| b | |||
| ) |
convex_comb_agg_log -- add piecewise relation with a logarithmic number of binary variables
using the convex combination formulation -- non-disaggregated.
Parameters:
- model: a model where to include the piecewise linear relation
- a[k]: x-coordinate of the k-th point in the piecewise linear relation
- b[k]: y-coordinate of the k-th point in the piecewise linear relation
Returns the model with the piecewise linear relation on added variables X, Y, and z.
Definition at line 178 of file piecewise.py.
| def piecewise.convex_comb_dis | ( | model, | |
| a, | |||
| b | |||
| ) |
convex_comb_dis -- add piecewise relation with convex combination formulation
Parameters:
- model: a model where to include the piecewise linear relation
- a[k]: x-coordinate of the k-th point in the piecewise linear relation
- b[k]: y-coordinate of the k-th point in the piecewise linear relation
Returns the model with the piecewise linear relation on added variables X, Y, and z.
Definition at line 73 of file piecewise.py.
| def piecewise.convex_comb_dis_log | ( | model, | |
| a, | |||
| b | |||
| ) |
convex_comb_dis_log -- add piecewise relation with a logarithmic number of binary variables
using the convex combination formulation.
Parameters:
- model: a model where to include the piecewise linear relation
- a[k]: x-coordinate of the k-th point in the piecewise linear relation
- b[k]: y-coordinate of the k-th point in the piecewise linear relation
Returns the model with the piecewise linear relation on added variables X, Y, and z.
Definition at line 105 of file piecewise.py.
| def piecewise.convex_comb_sos | ( | model, | |
| a, | |||
| b | |||
| ) |
convex_comb_sos -- add piecewise relation with gurobi's SOS constraints
Parameters:
- model: a model where to include the piecewise linear relation
- a[k]: x-coordinate of the k-th point in the piecewise linear relation
- b[k]: y-coordinate of the k-th point in the piecewise linear relation
Returns the model with the piecewise linear relation on added variables X, Y, and z.
Definition at line 49 of file piecewise.py.
| def piecewise.gray | ( | i | ) |
returns i^int(i/2)
Definition at line 100 of file piecewise.py.
| def piecewise.mult_selection | ( | model, | |
| a, | |||
| b | |||
| ) |
mult_selection -- add piecewise relation with multiple selection formulation
Parameters:
- model: a model where to include the piecewise linear relation
- a[k]: x-coordinate of the k-th point in the piecewise linear relation
- b[k]: y-coordinate of the k-th point in the piecewise linear relation
Returns the model with the piecewise linear relation on added variables X, Y, and z.
Definition at line 18 of file piecewise.py.