Constraint Evaluates as False Logical

871 views
Skip to first unread message

C. Priess

unread,
Aug 27, 2013, 5:29:01 PM8/27/13
to yal...@googlegroups.com
I have a constraint that evaluates as a false logical, and am unable to determine the reason.  A toy version of the code that reproduces the problem is below:

---------------------------------------------------------
N=25;
x0=0.1*randn(N,1);

opt=sdpsettings('usex0',1);

P=randn(N,N);
P=P'*P;

a=0.9;  

x=sdpvar(N,1);
assign(x,x0);  

obj=sum(P*x);

c0=zeros(N,1);
r0=zeros(1,N);
r=r0;

Acl=zeros(N,1);

for i=2:N
   r(i)=1;

   Q=1/N*toeplitz(c0,r);

   Acl(i)=x0'*Q*x0+x0'*(Q+Q')*(x-x0);

   r=r0;
end

con=[-a<=Acl<=a,-1<=x<=1];

sol=solvesdp(con,obj,opt);

-------------------------------------------------------------------

The strange-looking term "Acl" is just a local linear Taylor-series approximation of the autocorrelation function.  What is very strange is that this constraint causes Yalmip to give the error "One of the constraints evaluates to a FALSE LOGICAL variable" when a<1, but it works fine when a>=1.  However, evaluating Acl at x=x0, or indeed essentially any x within the region -1<=x<=1 produces max values of Acl which are MUCH smaller than 1.  Is this a problem because Q is, in general, singular, or is something else going on?  Thanks for any help.

Johan Löfberg

unread,
Aug 28, 2013, 1:21:40 AM8/28/13
to yal...@googlegroups.com
You have been hit by this "design feature" in MATLAB

Hence, define Acl using concatenation instead.

Qifeng Li

unread,
Oct 22, 2015, 4:26:33 PM10/22/15
to YALMIP
Hi there,

So, in the end, how did you define Acl using concatenation in the for-loop?

Thanks.

Johan Löfberg

unread,
Oct 23, 2015, 2:28:02 AM10/23/15
to YALMIP
Acl = 0;
for i=2:N
   r(i)=1;
   Q=1/N*toeplitz(c0,r);
   Acl=[Acl x0'*Q*x0+x0'*(Q+Q')*(x-x0)];
   r=r0;
end


Reply all
Reply to author
Forward
0 new messages