GSL, FFI, GCL, Windows; was: find_root with bfloats



 On 9/29/10 3:01 PM, Kostas Oikonomou wrote:
> I am solving a convex optimization problem with linear inequality
> constraints, and lbgfs (augmented_lagrangian) handles only equalities.
>
> I remember your donlp2 effort, and recall that it fell though for some
> reason.
FWIW, I found a Fortran version of COBYLA2 (Constrained Optimization BY
Linear Approximation) by Powell and created a simple interface to it
from maxima.  This is used in SciPy.  To use this in maxima. we'll
probably have to ask Powell for permission; the code itself doesn't have
any information about licensing issues.

Anyway,  here are couple of examples.

Minimize f(x1,x2) = x1*x2 subject to 1-x1^2-x2^2 >= 0:

(%i43) fmin_cobyla2(x1*x2, [1-x1^2-x2^2],[x1, x2], [1d0, 1d0], iprint=1);
   Normal return from subroutine COBYLA

   NFVALS =   66   F =-5.000000E-01    MAXCV = 1.999956E-12
   X = 7.071058E-01  -7.071077E-01
Evaluation took 0.0100 seconds (0.0100 elapsed) using 363.352 KB.
(%o43)          [[.7071058493484819, - .7071077130247994], 66]

The theoretical answer is 1/sqrt(2), -1/sqrt(2).

Minimize x1*x2*x3 subject to 1-x1^2-2*x2^2-3*x3^2 >= 0:

(%i47) fmin_cobyla2(x1*x2*x3, [1-x1^2-2*x2^2-3*x3^2], [x1, x2, x3],
[1d0, 1d0, 1d0], iprint=1);

   Normal return from subroutine COBYLA

   NFVALS =   94   F =-7.856742E-02    MAXCV = 5.935807E-12
   X = 5.773509E-01   4.082474E-01  -3.333336E-01
Evaluation took 0.0100 seconds (0.0200 elapsed) using 476.547 KB.
(%o47) [[.5773509172259506, .4082474453988019, - 0.333333649184014], 94]

The theoretical answer is 1/sqrt(3), 1/sqrt(6), -1/3.

Perhaps it would be useful to add this to maxima, if we can obtain
permission from Powell.  (I don't have his email address, so it might
take some time.)

Ray