Class L_BFGS_B


  • public class L_BFGS_B
    extends java.lang.Object
    This is a port of the FORTRAN 77 L-BFGS-B code to Java L-BFGS-B is released under the “New BSD License” (aka “Modified BSD License” or “3-clause license”) =========== L-BFGS-B (version 3.0. April 25, 2011 =================== This is a modified version of L-BFGS-B. Minor changes in the updated code appear preceded by a line comment as follows c-jlm-jn Major changes are described in the accompanying paper: Jorge Nocedal and Jose Luis Morales, Remark on "Algorithm 778: L-BFGS-B: Fortran Subroutines for Large-Scale Bound Constrained Optimization" (2011). To appear in ACM Transactions on Mathematical Software, The paper describes an improvement and a correction to Algorithm 778. It is shown that the performance of the algorithm can be improved significantly by making a relatively simple modication to the subspace minimization phase. The correction concerns an error caused by the use of routine dpmeps to estimate machine precision. The total work space **wa** required by the new version is 2*m*n + 11m*m + 5*n + 8*m the old version required 2*m*n + 12m*m + 4*n + 12*m J. Nocedal Department of Electrical Engineering and Computer Science. Northwestern University. Evanston, IL. USA J.L Morales Departamento de Matematicas, Instituto Tecnologico Autonomo de Mexico Mexico D.F. Mexico. March 2011 3-clause license ("New BSD License" or "Modified BSD License") New BSD License Author Regents of the University of California Publisher Public Domain Published July 22, 1999[8] DFSG compatible Yes[7] FSF approved Yes[1] OSI approved Yes[3] GPL compatible Yes[1] Copyleft No[1] Copyfree Yes Linking from code with a different license Yes The advertising clause was removed from the license text in the official BSD on July 22, 1999 by William Hoskins, Director of the Office of Technology Licensing for UC Berkeley.[8] Other BSD distributions removed the clause, but many similar clauses remain in BSD-derived code from other sources, and unrelated code using a derived license. While the original license is sometimes referred to as "BSD-old", the resulting 3-clause version is sometimes referred to by "BSD-new." Other names include "New BSD", "revised BSD", "BSD-3", or "3-clause BSD". This version has been vetted as an Open source license by the OSI as the "The BSD License".[3] The Free Software Foundation, which refers to the license as the "Modified BSD License", states that it is compatible with the GNU GPL. The FSF encourages users to be specific when referring to the license by name (i.e. not simply referring to it as "a BSD license" or "BSD-style") to avoid confusion with the original BSD license.[1] This version allows unlimited redistribution for any purpose as long as its copyright notices and the license's disclaimers of warranty are maintained. The license also contains a clause restricting use of the names of contributors for endorsement of a derived work without specific permission. Copyright (c) , All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    • Constructor Summary

      Constructors 
      Constructor Description
      L_BFGS_B()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void active​(int n, double[] l, double[] u, int[] nbd, double[] x, int[] iwhere, int iprint, boolean[] prjctd, boolean[] cnstnd, boolean[] boxed)  
      private void bmv​(int m, double[][] sy, double[][] wt, int col, double[] v, double[] p, int[] info)  
      private void cauchy​(int n, double[] x, double[] l, double[] u, int[] nbd, double[] g, int[] iorder, int[] iwhere, double[] t, double[] d, double[] xcp, int m, double[][] wy, double[][] ws, double[][] sy, double[][] wt, double theta, int col, int head, double[] p, double[] c, double[] wbp, double[] v, int[] nseg, int iprint, double sbgnrm, int[] info, double epsmch)  
      private void cmprlb​(int n, int m, double[] x, double[] g, double[][] ws, double[][] wy, double[][] sy, double[][] wt, double[] z, double[] r, double[] wa1, double[] wa2, int[] index, double theta, int col, int head, int nfree, boolean cnstnd, int[] info)  
      private void dcsrch​(double[] f, double[] g, double[] stp, double ftol, double gtol, double xtol, double stpmin, double stpmax, java.lang.String[] task, int[] isave, double[] dsave)  
      private void dcstep​(double[] stx, double[] fx, double[] dx, double[] sty, double[] fy, double[] dy, double[] stp, double fp, double dp, boolean[] brackt, double stpmin, double stpmax)  
      private void dpofa​(double[][] a, int lda, int n, int[] info)  
      void driver1()  
      void driver2()  
      void driver3()  
      private void dtrsl​(double[][] t, int ldt, int n, double[] b, int job, int[] info)  
      private double epsilon()  
      private void errclb​(int n, int m, double factr, double[] l, double[] u, int[] nbd, java.lang.String[] task, int[] info, int[] k)  
      private void formk​(int n, int nsub, int[] ind, int nenter, int ileave, int[] indx2, int iupdat, boolean updatd, double[][] wn, double[][] wn1, int m, double[][] ws, double[][] wy, double[][] sy, double theta, int col, int head, int[] info)  
      private void formt​(int m, double[][] wt, double[][] sy, double[][] ss, int col, double theta, int[] info)  
      private void freev​(int n, int[] nfree, int[] index, int[] nenter, int[] ileave, int[] indx2, int[] iwhere, boolean[] wrk, boolean updatd, boolean cnstnd, int iprint, int iter)  
      private void hpsolb​(int n, double[] t, int[] iorder, int iheap)  
      private void lnsrlb​(int n, double[] l, double[] u, int[] nbd, double[] x, double[] f, double[] fold, double[] gd, double[] gdold, double[] g, double[] d, double[] r, double[] t, double[] z, double[] stp, double[] dnorm, double[] dtd, double[] xstep, double[] stpmx, int iter, int[] ifun, int[] iback, int[] nfgv, int[] info, java.lang.String[] task, boolean boxed, boolean cnstnd, java.lang.String[] csave, int[] isave, double[] dsave)  
      void mainlb​(int n, int m, double[] x, double[] l, double[] u, int[] nbd, double[] f, double[] g, double factr, double pgtol, double[][] ws, double[][] wy, double[][] sy, double[][] ss, double[][] wt, double[][] wn, double[][] snd, double[] z, double[] r, double[] d, double[] t, double[] xp, double[] wa1, double[] wa2, double[] wa3, double[] wa4, int[] index, int[] iwhere, int[] indx2, java.lang.String[] task, int iprint, java.lang.String[] csave, boolean[] lsave, int[] isave, double[] dsave, java.io.RandomAccessFile raFile)  
      private void matupd​(int n, int m, double[][] ws, double[][] wy, double[][] sy, double[][] ss, double[] d, double[] r, int[] itail, int iupdat, int[] col, int[] head, double[] theta, double rr, double dr, double stp, double dtd)  
      void prn1lb​(int n, int m, double[] l, double[] u, double[] x, int iprint, java.io.RandomAccessFile raFile, double epsmch)  
      private void prn2lb​(int n, double[] x, double f, double[] g, int iprint, java.io.RandomAccessFile raFile, int iter, int nfgv, int nact, double sbgnrm, int nseg, java.lang.String[] word, int iword, int iback, double stp, double xstep)  
      private void prn3lb​(int n, double[] x, double f, java.lang.String task, int iprint, int info, java.io.RandomAccessFile raFile, int iter, int nfgv, int nintol, int nskip, int nact, double sbgnrm, double time, int nseg, java.lang.String word, int iback, double stp, double xstep, int k, double cachyt, double sbtime, double lnscht)  
      private void projgr​(int n, double[] l, double[] u, int[] nbd, double[] x, double[] g, double[] sbgnrm)  
      void setulb​(int n, int m, double[] x, double[] l, double[] u, int[] nbd, double[] f, double[] g, double factr, double pgtol, java.lang.String[] task, int iprint, java.lang.String[] csave, boolean[] lsave, int[] isave, double[] dsave, java.io.RandomAccessFile raFile)  
      private void subsm​(int n, int m, int nsub, int[] ind, double[] l, double[] u, int[] nbd, double[] x, double[] d, double[] xp, double[][] ws, double[][] wy, double theta, double[] xx, double[] gg, int col, int head, int[] iword, double[] wv, double[][] wn, int iprint, int[] info)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • L_BFGS_B

        public L_BFGS_B()
    • Method Detail

      • driver1

        public void driver1()
      • driver2

        public void driver2()
      • driver3

        public void driver3()
      • setulb

        public void setulb​(int n,
                           int m,
                           double[] x,
                           double[] l,
                           double[] u,
                           int[] nbd,
                           double[] f,
                           double[] g,
                           double factr,
                           double pgtol,
                           java.lang.String[] task,
                           int iprint,
                           java.lang.String[] csave,
                           boolean[] lsave,
                           int[] isave,
                           double[] dsave,
                           java.io.RandomAccessFile raFile)
      • mainlb

        public void mainlb​(int n,
                           int m,
                           double[] x,
                           double[] l,
                           double[] u,
                           int[] nbd,
                           double[] f,
                           double[] g,
                           double factr,
                           double pgtol,
                           double[][] ws,
                           double[][] wy,
                           double[][] sy,
                           double[][] ss,
                           double[][] wt,
                           double[][] wn,
                           double[][] snd,
                           double[] z,
                           double[] r,
                           double[] d,
                           double[] t,
                           double[] xp,
                           double[] wa1,
                           double[] wa2,
                           double[] wa3,
                           double[] wa4,
                           int[] index,
                           int[] iwhere,
                           int[] indx2,
                           java.lang.String[] task,
                           int iprint,
                           java.lang.String[] csave,
                           boolean[] lsave,
                           int[] isave,
                           double[] dsave,
                           java.io.RandomAccessFile raFile)
      • epsilon

        private double epsilon()
      • errclb

        private void errclb​(int n,
                            int m,
                            double factr,
                            double[] l,
                            double[] u,
                            int[] nbd,
                            java.lang.String[] task,
                            int[] info,
                            int[] k)
      • prn3lb

        private void prn3lb​(int n,
                            double[] x,
                            double f,
                            java.lang.String task,
                            int iprint,
                            int info,
                            java.io.RandomAccessFile raFile,
                            int iter,
                            int nfgv,
                            int nintol,
                            int nskip,
                            int nact,
                            double sbgnrm,
                            double time,
                            int nseg,
                            java.lang.String word,
                            int iback,
                            double stp,
                            double xstep,
                            int k,
                            double cachyt,
                            double sbtime,
                            double lnscht)
      • prn1lb

        public void prn1lb​(int n,
                           int m,
                           double[] l,
                           double[] u,
                           double[] x,
                           int iprint,
                           java.io.RandomAccessFile raFile,
                           double epsmch)
      • prn2lb

        private void prn2lb​(int n,
                            double[] x,
                            double f,
                            double[] g,
                            int iprint,
                            java.io.RandomAccessFile raFile,
                            int iter,
                            int nfgv,
                            int nact,
                            double sbgnrm,
                            int nseg,
                            java.lang.String[] word,
                            int iword,
                            int iback,
                            double stp,
                            double xstep)
      • active

        private void active​(int n,
                            double[] l,
                            double[] u,
                            int[] nbd,
                            double[] x,
                            int[] iwhere,
                            int iprint,
                            boolean[] prjctd,
                            boolean[] cnstnd,
                            boolean[] boxed)
      • projgr

        private void projgr​(int n,
                            double[] l,
                            double[] u,
                            int[] nbd,
                            double[] x,
                            double[] g,
                            double[] sbgnrm)
      • cauchy

        private void cauchy​(int n,
                            double[] x,
                            double[] l,
                            double[] u,
                            int[] nbd,
                            double[] g,
                            int[] iorder,
                            int[] iwhere,
                            double[] t,
                            double[] d,
                            double[] xcp,
                            int m,
                            double[][] wy,
                            double[][] ws,
                            double[][] sy,
                            double[][] wt,
                            double theta,
                            int col,
                            int head,
                            double[] p,
                            double[] c,
                            double[] wbp,
                            double[] v,
                            int[] nseg,
                            int iprint,
                            double sbgnrm,
                            int[] info,
                            double epsmch)
      • bmv

        private void bmv​(int m,
                         double[][] sy,
                         double[][] wt,
                         int col,
                         double[] v,
                         double[] p,
                         int[] info)
      • dtrsl

        private void dtrsl​(double[][] t,
                           int ldt,
                           int n,
                           double[] b,
                           int job,
                           int[] info)
      • hpsolb

        private void hpsolb​(int n,
                            double[] t,
                            int[] iorder,
                            int iheap)
      • freev

        private void freev​(int n,
                           int[] nfree,
                           int[] index,
                           int[] nenter,
                           int[] ileave,
                           int[] indx2,
                           int[] iwhere,
                           boolean[] wrk,
                           boolean updatd,
                           boolean cnstnd,
                           int iprint,
                           int iter)
      • formk

        private void formk​(int n,
                           int nsub,
                           int[] ind,
                           int nenter,
                           int ileave,
                           int[] indx2,
                           int iupdat,
                           boolean updatd,
                           double[][] wn,
                           double[][] wn1,
                           int m,
                           double[][] ws,
                           double[][] wy,
                           double[][] sy,
                           double theta,
                           int col,
                           int head,
                           int[] info)
      • dpofa

        private void dpofa​(double[][] a,
                           int lda,
                           int n,
                           int[] info)
      • cmprlb

        private void cmprlb​(int n,
                            int m,
                            double[] x,
                            double[] g,
                            double[][] ws,
                            double[][] wy,
                            double[][] sy,
                            double[][] wt,
                            double[] z,
                            double[] r,
                            double[] wa1,
                            double[] wa2,
                            int[] index,
                            double theta,
                            int col,
                            int head,
                            int nfree,
                            boolean cnstnd,
                            int[] info)
      • subsm

        private void subsm​(int n,
                           int m,
                           int nsub,
                           int[] ind,
                           double[] l,
                           double[] u,
                           int[] nbd,
                           double[] x,
                           double[] d,
                           double[] xp,
                           double[][] ws,
                           double[][] wy,
                           double theta,
                           double[] xx,
                           double[] gg,
                           int col,
                           int head,
                           int[] iword,
                           double[] wv,
                           double[][] wn,
                           int iprint,
                           int[] info)
      • lnsrlb

        private void lnsrlb​(int n,
                            double[] l,
                            double[] u,
                            int[] nbd,
                            double[] x,
                            double[] f,
                            double[] fold,
                            double[] gd,
                            double[] gdold,
                            double[] g,
                            double[] d,
                            double[] r,
                            double[] t,
                            double[] z,
                            double[] stp,
                            double[] dnorm,
                            double[] dtd,
                            double[] xstep,
                            double[] stpmx,
                            int iter,
                            int[] ifun,
                            int[] iback,
                            int[] nfgv,
                            int[] info,
                            java.lang.String[] task,
                            boolean boxed,
                            boolean cnstnd,
                            java.lang.String[] csave,
                            int[] isave,
                            double[] dsave)
      • dcsrch

        private void dcsrch​(double[] f,
                            double[] g,
                            double[] stp,
                            double ftol,
                            double gtol,
                            double xtol,
                            double stpmin,
                            double stpmax,
                            java.lang.String[] task,
                            int[] isave,
                            double[] dsave)
      • dcstep

        private void dcstep​(double[] stx,
                            double[] fx,
                            double[] dx,
                            double[] sty,
                            double[] fy,
                            double[] dy,
                            double[] stp,
                            double fp,
                            double dp,
                            boolean[] brackt,
                            double stpmin,
                            double stpmax)
      • formt

        private void formt​(int m,
                           double[][] wt,
                           double[][] sy,
                           double[][] ss,
                           int col,
                           double theta,
                           int[] info)
      • matupd

        private void matupd​(int n,
                            int m,
                            double[][] ws,
                            double[][] wy,
                            double[][] sy,
                            double[][] ss,
                            double[] d,
                            double[] r,
                            int[] itail,
                            int iupdat,
                            int[] col,
                            int[] head,
                            double[] theta,
                            double rr,
                            double dr,
                            double stp,
                            double dtd)