A condition for avoiding CVX related errors


(Ali) #1

Hello,
Thanks in advance for helping!
Please suppose that I have an optimization problem in two variables x and y. Also, suppose that the problem is convex in x only, and that I will do exhaustive search for y while solving for x as follows.

for y=1:n
optimize f(x,y) using CVX
end

Apparently, there are values for y that yield a CVX error, e.g. “Disciplined convex programming error:
Cannot perform the operation: {real affine} .* {invalid}”. So, is there a way to formulate a condition related to CVX outcome to skip the instances of y that yields an error and continue the loop for next value of y (assuming the next value of y yields an output for CVX)? For instance as follows.

for y=1:n
optimize f(x,y) using CVX
if there is CVX error
continue
end
end


(Mark L. Stone) #2

Solution using MATLAB’s try catch is provided in Detecting of returning error in CVX


(Ali) #3

Thanks a lot for helping.
Ali