positive part of a vector #944
-
Hello, I wanted to ask if the subplus function of Matlab is supported by YALMIP. I am asking this because I want to add constraints that look like this: I have tried using the subplus function with YALMIP in the following manner: Thank you for the help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
subplus is not overloaded, why not simply write max(x-y,0)^2? Note though that you will get a nonconvex quadratic model with binary variables. If you use the max^2 operator in a convex way, you are better of to do the modelling manually, as squaring a convex function does not preserve convexity and thus forces YALMIP to go to a MLP model Hence, if you have the max^2 operator entering in a convex way, you should introduce an epigraph variable t and use t^2 with the constraints t>=0, t>=x-y There is also https://yalmip.github.io/command/hinge/, although I think it requires you to install the develop version |
Beta Was this translation helpful? Give feedback.
subplus is not overloaded, why not simply write max(x-y,0)^2?
Note though that you will get a nonconvex quadratic model with binary variables. If you use the max^2 operator in a convex way, you are better of to do the modelling manually, as squaring a convex function does not preserve convexity and thus forces YALMIP to go to a MLP model
Hence, if you have the max^2 operator entering in a convex way, you should introduce an epigraph variable t and use t^2 with the constraints t>=0, t>=x-y
There is also https://yalmip.github.io/command/hinge/, although I think it requires you to install the develop version