It seems the problem was just documentation. The docs for
PDL::Opt::NonLinear on search.cpan.org and metacpan.org include the
functions smnsx, mnsx, and a bunch of others that are excluded when
the .pd file is processed. It looks like the .pd files shouldn't be
indexed by PAUSE. Instead a .pod file should be generated during "make
dist" and that should be indexed.

Anyway, I was able to use one of the ::NonLinear functions to solve
the QP, unfortunately it is really slow. I think this is due to the
fact that (i) I had to include the constraints as part of f(x), and
(ii) I opted to use one of the algorithms (dhc) which doesn't require
a gradient.

I included the constraints as part of function to be optimized,
because one of the contraints is sum(x0,x1,x2,..xn) = 1. The functions
in ::NonLinear that support constraints, appear to only support simple
inequalities (ie, a < x < b). The actual function I am optimizing is:

   f(x) = x'Ax      (in PDL terms, $x->transpose x $A x $x)
    s.t.   x'1 = 1   (ie, sum($x) = 1)

So my f(x) is:

   $f = $x->transpose x $A x $x                                  # The
func to optimize
         + 1000 * ( $x->transpose x ones(1,3) - 1 )**2;     # Large if
the constraint if violated

For some problems, I have several constraints that I create in the
same fashion. This feels like I'm abusing the optimization, is there a
better way? Doing it this way the constraints increase the problem
complexity, when you would expect them to reduce it.

Lastly, would an algorithm that requires a gradient speed this up (at
the cost of figuring out how to differentiate each constraint)?

Thanks,
Mark

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to