octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

QP solves for zero instead of min?


From: Juan Pablo Carbajal
Subject: QP solves for zero instead of min?
Date: Sat, 2 Aug 2014 19:38:20 +0200

Hi,

It seems that when QP receives linear equality constrains it goes for
the zero of the cost function instead of a minimum.
Might somebody find my mistake? Here is my test problem

x = randn (2,5);
H = x.'*x; #Cov matrix to make sure is a good one.
Q = - ones (size(H,1),1);
A = [ones(1,floor(length(Q)/2)) -ones(1,ceil(length(Q)/2))];

a0 = rand (size(H,2),1);
a = qp (a0, H, Q, A, 0);  % I get all zeros here.

# Try with SQP
phi = @(x) 0.5*x.'*H*x + x.'*Q;
g   = @(x) A*x;

a_sqp = sqp (a0, phi, g);
a_r = a_sqp / sqrt(sumsq (a_sqp));

phi(a) # gives a zero
g(a)   # it solves the constraints
phi(a_r) # negative!
g(a_r) # solves the constratins to tolerance



reply via email to

[Prev in Thread] Current Thread [Next in Thread]