How to get started with modelling the following piecewise linear approximation?
AnsweredAny articles or examples related which I can reference from would be helpful, I have no idea what functions to use and how to get started
where s refer to a set of breakpoints, and f the corresponding values. For each point x, we are interested in recovering the corresponding value at x, using a piecewise linear approximation of the points (s,f).
1
-
Hi Jia,
The following should get you started.
- Gurobi has an interface for modelling piecewise-linear objective functions. The linked section explains in detail how to define piecewise-linear functions in Gurobi. The method Model.setPWLObj() can be used in Python to set a piecewise-linear objective function, for example. Check the piecewise.py example for how to define piecewise-linear objective functions.
- Gurobi also has an interface to define piecewise-linear constraints. The method Model.addGenConstrPWL() can be used in Python. Examples gc_pwl.py() and gc_pwl_func() are relevant examples that you might want to check.
Best regards,
Maliheh
0
Please sign in to leave a comment.
Comments
1 comment