optimize() fails for specific problem in R2018a but works in R2017a

38 views
Skip to first unread message

Mauro Pfister

unread,
Nov 22, 2018, 12:26:10 PM11/22/18
to YALMIP
Hi,

First of all sorry for the strange title. I didn't really know how to briefly describe the problem.

I'm trying to denoise an image by solving the maximization problem attached as an image. While this works in R2017a the solver crashes in R2018a for exactly the same script. 
I'm running OSX High Sierra but my friend on Ubuntu has the same issue.

The error I get is the following:

Index exceeds array bounds.

Error in extract_bounds_from_abs_operator (line 16)
    LU(extvariables(i),1) = max([0 LU(extvariables(i),1)]);

Error in setupBounds (line 25)
            LU = extract_bounds_from_abs_operator(LU,extstruct,extendedvariables,i);

Error in expandmodel (line 135)
        LUbounds = setupBounds(F,options,extendedvariables);

Error in compileinterfacedata (line 116)
    [F,failure,cause,operators] = expandmodel(F,h,options);

Error in solvesdp (line 231)
[interfacedata,recoverdata,solver,diagnostic,F,Fremoved,ForiginalQuadratics] =
compileinterfacedata(F,[],logdetStruct,h,options,0,solving_parametric);

Error in optimize (line 31)
[varargout{1:nargout}] = solvesdp(varargin{:});

Error in p3q12 (line 42)
diagnosis = optimize(con, obj, opt);

I attached all the files needed to run the script.

Thanks in advance for your help!
denoising_problem.JPG
denoising.zip

Johan Löfberg

unread,
Nov 22, 2018, 12:41:51 PM11/22/18
to YALMIP
It is not the solver crashing (mosek) but YALMIP.

I cannot reproduce this in R2018a. Which version of YALMIP are you running?

Mauro Pfister

unread,
Nov 22, 2018, 12:46:12 PM11/22/18
to YALMIP
Thanks for the fast response.

According to yalmip('version') I'm using 20180209.

Mauro Pfister

unread,
Nov 22, 2018, 12:48:41 PM11/22/18
to YALMIP
I updated YALMIP using tbxmanager and everything is working fine now. Sorry, I didn't think about that before.

Thanks a lot for the quick help!

Johan Löfberg

unread,
Nov 22, 2018, 12:48:58 PM11/22/18
to yal...@googlegroups.com
Start by installing the latest version so we don't try to hunt down an already fixed bug

Johan Löfberg

unread,
Nov 22, 2018, 12:52:46 PM11/22/18
to YALMIP
and initialize the code with yalmip('clear') to ensure you start in a clean state without any messed up stuff internally.

(though I think you will have to restart matlab when you go from that version to the most recent as class definitions have changed)

Johan Löfberg

unread,
Nov 22, 2018, 12:54:41 PM11/22/18
to YALMIP
btw, the lazy student does TV_term = norm(X,'tv') (figured I could reveal that as you already did the hard work :-)


Johan Löfberg

unread,
Nov 22, 2018, 12:55:54 PM11/22/18
to YALMIP
OK. Odd that it failed in that version for you (and your friend) as I checked out that version and it ran here.Anyway, all good then

Mauro Pfister

unread,
Nov 22, 2018, 12:57:44 PM11/22/18
to YALMIP
Thanks for the hint with yalmip(clear) and the norm! I searched the Matlab documentation for such a function but I couldn't find anything. Do you have a link by any chance? It's not the first time I needed such a function ;) 

However, concerning the restart: The code worked just fine without restarting Matlab.

Johan Löfberg

unread,
Nov 22, 2018, 1:01:34 PM11/22/18
to YALMIP
'tv' is an extension of MATLABs norm operator in YALMIP. Other extensions are 'nuc' and '*' representing nuclear norm

Mauro Pfister

unread,
Nov 22, 2018, 1:08:57 PM11/22/18
to YALMIP
Thanks for the information =)


Mark L. Stone

unread,
Nov 22, 2018, 1:37:06 PM11/22/18
to YALMIP
>> help sdpvar/norm
 norm (overloaded)
 
  t = norm(x,P)
 
  The variable t can only be used in convexity preserving
  operations such as t<=1, max(t,y)<=1, minimize t etc.
 
     For matrices...
       norm(X)       models the largest singular value of X, max(svd(X)).
       norm(X,2)     is the same as norm(X).
       norm(X,1)     models the 1-norm of X, the largest column sum, max(sum(abs(X))).
       norm(X,inf)   models the infinity norm of X, the largest row sum, max(sum(abs(X'))).
       norm(X,'inf') same as above
       norm(X,'fro') models the Frobenius norm, sqrt(sum(diag(X'*X))).
       norm(X,'nuc') models the Nuclear norm, sum of singular values.
       norm(X,'*')   same as above
       norm(X,'tv')  models the (isotropic) total variation semi-norm
     For vectors...
       norm(V) = norm(V,2) = standard Euclidean norm.
       norm(V,inf) = max(abs(V)).
       norm(V,1) = sum(abs(V))
 
  SEE ALSO sumk, sumabsk

Santosh Sharma

unread,
Jan 13, 2020, 1:08:16 PM1/13/20
to YALMIP
I was having the similar issue, installing latest version fixed the problem. Thanks!
Reply all
Reply to author
Forward
0 new messages