I am currently trying to minimize the following:
minimize(norm(A_con*x-b ,1) + lambda*function(x);
I have written the function x according to the DCP ruleset. My question is where does this function get defined? Is it inserted as a constraint? a “subject to” statement?
If you have a function
myfunction(x) which accepts a CVX expression
x, and it follows the DCP rules given whatever argument the calling program uses, you may define (place)
myfunction anywhere you could if it were a “regular” MATLAB function you were calling with a MATLAB variable argument. So it would not be inside your CVX program, and does not constitute a CVX constraint. For instance, place it in
myfunction.m somewhere in your MATLAB path.
[output] = myfunction(x)
output = norm(x);
subject to is a “placebo” which does absolutely nothing, but can be used for program readability should you choose to use it.
Awesome. Thank you!
Can the function have additional arguments that are not the variable being optimized?
Yes. BTW, You can call
myfunction(x) defined above with calling argument being either a MATLAB double precision variable (or number) or a CVX variable or DCP compliant expression.
x will be whatever type was provided in the argument used to call it.