Skip to content

positive part of a vector #944

Discussion options

You must be logged in to vote

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

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by johanlofberg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants