[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sqp: What are the equality and inequality constraint functions?
From: |
Sebastian Schubert |
Subject: |
Re: sqp: What are the equality and inequality constraint functions? |
Date: |
Thu, 13 Jan 2011 10:03:58 +0100 |
User-agent: |
KMail/1.13.5 (Linux/2.6.34.7-0.7-desktop; KDE/4.4.4; x86_64; ; ) |
Hi,
> > I have a non-linear, non-quadratic function to minimize with some
> > constraints and sqp might be usable. However, I don't fully
> > understand the manual. From the first part, especially,
> >
> > ---------------
> > Function File: [X, OBJ, INFO, ITER, NF, LAMBDA] = sqp (X, PHI, G,
> >
> > H, LB, UB, MAXITER, TOLERANCE)
> >
> > Solve the nonlinear program
> >
> > min phi (x)
> >
> > x
> >
> > subject to
> >
> > g(x) = 0
> > h(x) >= 0
> > lb <= x <= ub
> >
> > ---------------
> Short answer: the documentation is using vector shorthand; g and h
> are vector-valued functions, lb and ub are vectors the size of x.
I think h is a matrix. Citing the manual again:
"If supplied, the gradient function must be of the form
g = gradient (x)
in which X is a vector and G is a vector.
If supplied, the hessian function must be of the form
h = hessian (x)
in which X is a vector and H is a matrix."
> Longer answer: The lb, ub should both be vectors the same size as
> your vector x. The functions g and h in the help file are
> vector-valued functions, and the right-hand-sides are really zero
> vectors whose length is the number of corresponding constraints. In
> other words, your g(x) and h(x) functions should include all your
> constraints at once.
No, at least if the manual is right. g is the gradient
(d/dx1, d/dx2, d/dx3, ...) phi(x),
h the hessian, ie, the matrix of second derivatives. I don't know how
the algorithm works, but I guess both g and h are used with it. The
manual says if not supplied, it estimates g and h. So these are no
boundary conditions as far as I can see.
> So lb, ub should be vectors the same size as x, which will give you
> lb(i)<=x(i)<=ub(i), so in your case let
>
> lb = zeros(size(x)); ub = ones(size(x));
Yes, that is what I also would've done.
> I believe you can just make your g function an anonymous function:
>
> g = @(x) sum(x) - 1;
Because of the reasons above, I guess this would be wrong.
From all this, I would expect that there isn't any possibility to use
function constraints similar to qp, but then there is "If supplied, the
equality and inequality constraint functions must be of the form
r = f (x)
in which X is a vector and R is a vector." What does this mean?
Cheers
Sebastian
signature.asc
Description: This is a digitally signed message part.