Re: constrained optimization
- From: Ron Shepard <ron-shepard@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 15 Jul 2009 10:20:12 -0500
Beliavsky <beliavsky@xxxxxxx> wrote:
I want to maximimize a function of N real variables x(1:N) with the
constraint that the sum of the squared elements equals one. In
Fortran, sum(x**2) == 1 . There are constrained optimization Fortran
codes, but is there a way I could transform the x's so that this
constraint holds automatically?
You have an N-dimensional space, and you are interested in a
solution to some equation on the surface of a unit sphere in that
There are two general approaches. One approach is to transform to a
set of (N-1) "essential" variables that satisfy the constraint by
construction. Having done that, you can either transform your
original problem to this new (N-1) dimensional coordinate system, or
you can use the chain rule to transform the derivatives from your
original coordinates to the new coordinates and use those
derivatives to optimize the new function. There are many general
ways to do this kind of transformation, and the best choice depends
often on the details of the problem (the symmetries involved, the
range of values of input variables, boundary conditions, etc.).
The other approach is to add a lagrange multipier to the original
problem and solve the unconstrained problem in this new (N+1)
So you can optimize in an (N-1) dimensional space in which the
constraint is automatically satisfied at each optimization step, or
you can optimize within an (N+1) dimensional space in which the
converged solution (and sometimes only at convergence) satisfies the
What about the case where, in
addition, all x's are non-negative? In Fortran, sum(x**2) == 1 .and.
all(x >= 0).
These problems are called linear constraint problems. Usually
different approaches are used for these because the constraints only
come into the problem along the borders. Within the allowed space,
you have an N-dimensional problem (you can move infinitesimally in
all directions), but at the borders you can only move in some subset
of this space. In your above specification, you have both kinds of
constraints. You might try to use a lagrange multiplier for the
first constraint, and then use the linear constraint approach for
the other N constraints.
I would have asked these questions in sci.math.num-analysis, but
unfortunately that once useful newsgroup has become overrun by spam.
I've noticed that too. Hopefully you can get some good replies to
your question here in clf.
$.02 -Ron Shepard
- constrained optimization
- From: Beliavsky
- constrained optimization
- Prev by Date: Re: Rank mismatch in array reference
- Next by Date: Re: Old Fortran code
- Previous by thread: Re: constrained optimization
- Next by thread: Re: constrained optimization