Custom Regularization Functions

(Alex Benjamin) #1

I am currently trying to solve a problem of the form:

variable x(n)
minimize norm (A*x - b, 1) + myFun(x)

myFun takes the unknown variable and does a whole bunch of operations on it (gradients etc) using MATLAB’s in-built functions. Because x is initialized as type cvx, i am unable to perform MATLAB operations on it (e.g. gradient expects type double). How do I get around this?



(Mark L. Stone) #2

You have to follow CVX’s rules; otherwise you will have to use something other than CVX. The rules for what you can do inside myfun are the same as if the operations were done in the main body of your CVX program. Please read “New functions via the DCP ruleset”