Hi there,
I have an optimisation problem. When I use lamba_max as one of the constraints, everything is ok. But when I use “lambda_min”, there is a problem and I receive the following error : “One or more output arguments not assigned during call to “varargout”.” I am sure that problem is feasible. I also do not activate the cvx precision in my code. Do you have any idea how I can tackle this problem?
Best,
You can start by copy and pasting with Preformatted text icon, your code, preferably with input data
1 Like
Thanks for your suggestion,
I would appreciate if you could send me an email?
Then I can send you the whole code with input data.
Try to post a minimum (as small and simple as possible) reproducible example.
Also, the output of cvx_version
1 Like
here you could find the code. It runs very fast. The problem is line 261. CVX does not recognize this command (lamba_min).
You can comment this line and uncomment the lines 263 and 264, it again does not work (for spectral radius). You can increase the value of parameter lamba_maximum in line 51(for example to 10) to make sure that the problem is feasible for sure.
But if you uncomment the command lamda_max in line 258, the code works very well.
please let me know if you find a problem regarding running the code.
All the best
lambda_min(X)
is concave if X
is symmetric (hermitian). So lambda_min(X) <= some_number
is a non-convex constraint, and therefore is not accepted by CVX. But, lambda_min(X) >= some_number
would be a non-convex constraint, and would be accepted by CVX.
However, lambda_max(X)
is convex if X
is symmetric (hermitian), so lambda_max(X) <= some_number
is a convex constraint, and is accepted by CVX.
CVX error messages are not always informative as to what the actual cause is. This is apparently such an instance.
1 Like
Thanks for your reply. But there is the same problem with “lambda_min(X) >= some_number” as well. I suppose that lambda_min(X) and lambda_max(X) are just numbers, and CVX uses a numerical technique to compute the maximum value of lambda. Even if we consider their characteristic functions (|lambda*I-X|), it should be the same for both of them? Then maybe, both of them are noncocave, and both of them do not work? am I right? Or I do not see something? because “lambda_min(X) >= some_number” does not work in the code as well.
I am referring to X
being a CVX variable or affine expression of variables. Therefore, lambda_min(X)
is a concave expression. lambda_min(X) >= some_number
should be accepted by CVX. lambda_min(X) <= some_number
should not be accepted by CVX. If the behavior is otherwise, either 1) something is not as you say or 2) something is messed up in your CVX installation or session or 3) there is a bug.
So please post, on this forum, a minimum reproducible example of the error when using lambda_min(X) >= some_number
Hopefully that will be a very simple and short program. And make sure the error occurs when you run the example in a FRESH MATLAB session. And please do as I requested and post the results of cvx_version
(do not use CVX 3.0beta, because that has many bugs). And don’t make us comment or uncomment lines to exhibit the error.
1 Like
Thanks for your comment.
I solved my problem with lambda_max, but I am also interested to find out what is the problem exactly.
In the first step, I am sending the CVX version. It seems there are some warning.
Could you please check that and let me know if I have to change something in order to avoid the warning if they are important.
You could find that in the following link:
I don’t think these messages are anything to worry about.
But please copy and paste your stuff into posts here, and use Preformatted text icon for any MATLAB/CVX code.
2021-05-14T22:00:00Z → 2021-05-15T22:00:00ZPreformatted text
Best
Is this really your minimum reproducible example? Can you make it all preformattext text? Then copy into a FRESH MATLAB session (not the same as clear). If that exhibits the error, then reinstall CVX. Then try again in a fresh MATLAB session. if that all fails, then post the minimum reproducible example here, making sure it is all copy and pastable from the post into a MATLAB session. We shouldn’t be seeing smiley faces, as your current post does, because it has :)
not in preformattedt text.
1 Like
sorry for that. I pasted the whole code in the following link with MATLAB format. It can be easily and pasted in any version of MATLAB.
findN
is not a standard MATLAB function. I suppose you can just set whatever value you need instead of invoking that function. Of course, you better start a fresh MATLAB session and verify the error still occurs, because who knows what that mystery function actually might do behind the scenes.
1 Like
Yes, You are right. I had to comment that function. Sorry for that. I checked the code even after commenting that line and run in a new session but the problem exists again. The new code is here:
I ran it to successful solution:
Status: Solved
Optimal value (cvx_optval): +97.9652
I suspect something is screwed up in your installation. Have you tried reinstalling CVX as I suggested? Or perhaps you have some 3rd party stuff in your MATLAB installation which is cutting in front of a same-named CVX function, thereby causing an error when the wrong function is called?
1 Like
There was a previous instance of this error when using lambda_min
posted at One or more output arguments not assigned , but no resolution was provided.
1 Like
lambda_min(X)
just returns -lambda_max(-X)
, So as a workaround, try using -lambda_max(-X)
1 Like
Yes. As I told you I solved my problem at the moment with this trick temporarily. I just wanted to realize that what is the problem with Lambda_min, maybe for future codings!
O.k., i didn’t know what you meant by “I solved my problem with lambda_max”, but now I do.
1 Like