Help on error message in cvx/prod


(Daniel Tweed) #1

Periodically, I get a “Shouldn’t be here” error message from line 90 in cvx/prod and I cannot figure out why this is happening. I’ve tried tracing through the source code but still am unsure of the conditions which generate this.

The prod is being taken over a vector of “cvx mixed positive constant/log-affine expression” and it seems that the greater the proportion of positive constants, the more frequent this error message, but I cannot see from the the code, or understand why, this would be the case.

I know this question has been asked before but never answered, so I am really hoping that someone (hopefully the author) can expand on the error message. Why shouldn’t I be there? What conditions which should never exist are resulting in this error message?


(Daniel Tweed) #2

So, this unhelpful error message is still plaguing me. A little more detail, in case someone wants to weigh in:

I had though maybe it was a scaling issue, as the product of many of these variables will potentially be quite small (on the order of 10^-7). The presence of the positive constants are my code replacing very small values in the matrix with 1, so I both adjusted this threshold (realizing that this may invalidate the results, but results I can interpret in light of this approximation are better than the nothing I am getting) and I rescaled the remaining terms… No joy, however.

As far as I can tell, the product of log-affine expressions and positive constants should be allowed by the code in cvx\prod but it simply fails without explanation.

A few more questions:
Is the fact that the error message “Shouldn’t be here” indicative of a set of conditions which cause prod to fail? Is this a bug in the code the developer just never bothered to deal with or properly document? Am I wrong in believing that this type of product is in fact valid?

I’m beginning to question reality at this point, and if you’re reading this, please feel free to reply with a non-answer, an opinion, or anything. Given the other questions on this particular cvx function which have not reply from the dev, I’m starting to think this topic is auto-/shadow-banned.

Cheers


(Michael C. Grant) #3

You’re not shadowbanned. This is a volunteer-driven forum which cannot possibly offer promises of a particular turnaround time. Personally, I haven’t answered because I’ve been in a conference for several days, and I don’t have an answer. I don’t know when I’ll have time to investigate this particular issue.


(Daniel Tweed) #4

I wasn’t seriously implying I (or actually, the topic itself) was shadow-banned. But, it is a very unhelpful and unusual error message. It was asked about in Nov. 2014 and not answered. I probably should not have posted the question to a community-driven forum, since the answer can only come from the developer, but it’s also not really a bug since it is obviously intentional.

Since I originally posted, I have solved that problem without using CVX, but I CVX is overall very helpful, so I would still like to try to find out, when I receive this error message, “Why shouldn’t I be there? What conditions which should never exist are resulting in this error message?”

Cheers :slight_smile:


(Daniel Tweed) #5

Seems to only come up when the product is being taken over strictly cvx positive constant expressions.


(Michael C. Grant) #6

Ah, so this is CVX version 3.0beta? Hmm. If you can come up with a good example that reliably (if not always) produces this error I’m happy to try and debug it.


(Daniel Tweed) #7

If I run cvx_setup, it shows version Version 2.1, Build 1110. I wanted to stay away from the beta version, as per the warning about being in the middle of important work. I notice now that build 1116 is available–would this build possibly be different in the prod function?

Anyways, here is a very small example which produces the error reliably if I leave xt(1,1) and xt(1,2) as cvx positive constants. If I uncomment either the lines which set to variable expressions or negative constants, the problem runs (though it is an unbounded problem,but that’s not really the issue and I’m in a hurry to get to a meeting).

 cvx_begin gp
 variable x
 expression xt(2,2)
 xt = cvx(ones(2,2));

%%%% Setting as variables 
%xt(1,1) = 1+x;
%xt(1,2) = 2+x;

%%%% Setting as negative constants
% xt(1,1) = -1*xt(1,1);
% xt(1,2) = -1*xt(1,2);

xt(2,1) = 1+x;
xt(2,2) = 2+x;

expression xprod(2,1)
xprod = prod(xt,2)

minimize x+1
subject to
    xt <= 1;
cvx_end

Output with error:

Error using cvx/prod (line 90)
Shouldn't be here.

Error in cvxtest (line 18)
xprod = prod(xt,2)

(Michael C. Grant) #8

This is excellent. I’m so glad we have a reproducible case now! I should be able to get this nailed down soon.


(Michael C. Grant) #9

If you’re feeling ambitious, you can edit builtins/@cvx/prod.m and change lines 60-61 to:

t3 = t0 & t1;
ta = t3 + 2 * ( t2 & ~t3 );

(Daniel Tweed) #10

Seems to do the trick! Thanks a million for looking at this so quickly!


(Michael C. Grant) #11

That’s great to know. I’m not sure “quickly” is the right word given that this bug has been there for so long! But you gave me a great, isolated test case, so it was a no-brainer. Thank you!


(Daniel Tweed) #12

Quickly from my point of view, not being sarcastic this time I promise. A platform I use for another part of my research has had 17 updates in two years which haven’t addressed more than a handful of dozens of SEV1 bugs in their bug-tracker which are more than 2 years old.

Also, “luckily”, my problem generated a lot of these errors so it was easy for me to narrow down the parameters which led to it.

Cheers :smiley: