Hello,
I have troubles getting sqp to work. Problem is defined as finding points on an ellipse verifying some optimum condition.
objective: f =@(x) -prod(x);
gradient: fg = @(x) -[x(2); x(1)];
equality: ce = @(x) (x-center).'*M*(x-center) - level
gradient: ceg = @(x) 2*M*(x-center)
where x is a (2, 1) vector, center is a (2, 1) vector with the center coordinates, M is symetric, positive definite and level the sum of square of the distances between each point and the two ellipse defining points.
The call is as follows:
1) find some good candidate by trying a few points, let's call it xinit
2) lb = .95*xinit; ub = 1.05*xinit %# define a five percent search interval
3) [xopt, obj, info, iter, nf, lambda] = sqp(xinit, {f fg}, {ce ceg}, [], lb, ub);
The problems are at line 343 and 377
F = feval (ce_grd, x);
C = feval (ci_grd, x);
A = [F; C];
F is supposed to be (n, 1); while C is (2*n, n): they are not compatible ... I tried transposing F or padding F with zeroes : if line 343 succeeds, the code fails elsewhere, f.i. in line 377: t4 = norm (lambda .* con) which expects lambda (rows(F), 1) and con (= [ce; ci]) to be the same dimensions.
Could someone please tell me the expected dimensions of the various gradients ?
Regards
Pascal