Robert,
Thanks very much for the fix. It works very nicely!
A couple of more questions:
===================================================
1. When I do load(lbfgs) I get the following messages:
Maxima 5.12.0 http://maxima.sourceforge.net
Using Lisp CMU Common Lisp Snapshot 2004-04 (19D)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
This is a development version of Maxima. The function
bug_report()
provides bug reporting information.
(%i1) load(lbfgs);
;
; Warning: This variable is undefined:
; *LB3-COMMON-BLOCK*
;
; In: LET ((FINISH NIL) (MP 0) (LP 0) (ITER 0) (NFUN 0) ...)
; (LET (# # # # # ...)
; (DECLARE # # #)
; (DEFUN LBFGS # # #))
; Note: Variable MP defined but never used.
;
; Note: Variable LP defined but never used.
;
; Note: Variable GTOL defined but never used.
;
; Note: Variable STPMIN defined but never used.
;
; Note: Variable STPMAX defined but never used.
; ;
; Warning: These functions are undefined:
; DAXPY DDOT LB1 MCSRCH
;
; In: LET ((DG 0.0) (DGM 0.0) (DGINIT 0.0) (DGTEST 0.0) (DGX
0.0) ...)
; (LET (# # # # # ...)
; (DECLARE # # #)
; (DEFUN MCSRCH # # #))
; Note: Variable GTOL defined but never used.
;
; Note: Variable STPMIN defined but never used.
;
; Note: Variable STPMAX defined but never used.
; ;
; Warning: This function is undefined:
; MCSTEP
(%o1)
/opt/maxima/5.12/share/maxima/5.12.0/share/lbfgs/lbfgs.mac
(%i2)
Are these messages suggesting that some improvements can be
made to the code?
=====================================================
2. Can we have augmented_lagrangian load lbfgs, since it
can't be used without it?
I tried adding a simple-minded
if not member($lbfgs, map(op,functions)) then
load(lbfgs);
but the "$" produces a parsing error.
Kostas
Robert Dodier wrote:
> Kostas,
>
> I have made a couple of minor changes which help
> augmented_lagrangian_method
> find a more accurate solution. You can get the new version here:
> http://maxima.cvs.sourceforge.net/maxima/maxima/share/contrib/augmented_lagrangian.mac
>
>
> With that new version I get the following:
>
> h(x,y,z,w) := x*log(x) + y*log(y) + z*log(z) + w*log(w);
> augmented_lagrangian_method(h(x,y,z,w), [x,y,z,w],
> [x+y+z+w-1,3*x+10*y-2], [0.4
> 5,0.25,0.65,0.2], iprint = [-1,0], niter = 30);
> => [[x = 0.240692382960439, y = .1277922851364399,
> z = .3157576661324954, w = .3157576661324701],
> %lambda = [.2847203467130062, .2847203467130062]]
> [x + y + z + w, 3*x + 10*y], first(%);
> => [1.000000000361844, 2.000000000245715]
>
> So that's great. However, the method is not very robust;
> probably you can pose other problems for which it fails.
> There are doubtless much stronger methods. About ipopt,
> that could be used via a foreign-function interface. I believe
> the project called CFFI is the most widely supported of such
> interfaces. CFFI doesn't work with GCL, unfortunately. But
> maybe it is not too early for Maxima to start working on
> libraries in C/C++ and/or Fortran via CFFI for other Lisps.
>
> HTH
> Robert