0

in my optimization problem, I want to put a piecewise function in my objective function. i.e f(x)=0.3 for x in (0,0.1);f(x)=0.5 for x in (0.1,0.4), etc and I'm solving for a series of x i.e. x1, x2,...xn subject to a bunch of constraints. Can I put the f(x) I defined in my objective function?I'm using the python interface of scip

Florence
  • 29
  • 6

1 Answers1

0

No, unfortunately, this is not (yet) supported. You would need to model your problem differently.

SOS1 and SOS2 constraints can be generated using the Python interface and may be of good use as pointed out in the link in stefan's comment.

mattmilten
  • 6,242
  • 3
  • 35
  • 65
  • Do u have any suggestions on how to model this kind of optimization problem? – Florence Apr 12 '16 at 07:41
  • Is it possible to put it in the constraint? – Florence Apr 12 '16 at 07:48
  • Google points me to http://yetanothermathprogrammingconsultant.blogspot.de/2015/10/piecewise-linear-functions-in-mip-models.html – stefan Apr 12 '16 at 08:04
  • On a separate note, is it possible to input a self defined piecewise function into the method addCons of the scip python interface? – Florence Apr 12 '16 at 09:05
  • No, the ```addCons()``` method only accepts linear or quadratic equations or inequalities. – mattmilten Apr 12 '16 at 09:14
  • Thanks for the replies. So making use of the SOS1 constraints, it should be doable? I am also a little confused about how the addConsSOS1 is implemented. Are there any examples? – Florence Apr 13 '16 at 07:24
  • Well, you simply call ```model.addConsSOS1(vars)``` with ```vars``` being the list of variables that are supposed to be in the special ordered set, i.e. of which only one can be non-zero. – mattmilten Apr 13 '16 at 07:51