edu.stanford.nlp.optimization
Class QNMinimizer
java.lang.Object
edu.stanford.nlp.optimization.QNMinimizer
- All Implemented Interfaces:
- Minimizer
public class QNMinimizer
- extends java.lang.Object
- implements Minimizer
Limited-Memory Quasi-Newton BFGS implementation based on the algorithms in
Jorge Norcedal's Numerical Optimization book (pg 224+)
As of now, it requires a
differentiable function (DiffFunction) as input.
The basic way to use the minimizer is with a null constructor, then
the simple minimize method:
Minimizer qnm = new QNMinimizer();
DiffFunction df = new SomeDiffFunction();
double tol = 1e-4;
double[] initial = getInitialGuess();
double[] minimum = qnm.minimize(df,tol,initial);
If you do not choose a value of M, it will use the max amount of memory
available, up to M of 20. This will slow things down a bit at first due
to forced garbage collection, but is probably faster overall b/c you are
guaranteed the largest possible M.
- Since:
- 1.0
Method Summary |
static void |
main(java.lang.String[] args)
|
float[] |
minimize(FloatFunction function,
float functionTolerance,
float[] initial)
|
double[] |
minimize(Function function,
double functionTolerance,
double[] initial)
Attempts to find an unconstrained minimum of the objective
function starting at initial , within
functionTolerance . |
void |
setM(int m)
|
void |
shutUp()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QNMinimizer
public QNMinimizer(int m)
QNMinimizer
public QNMinimizer()
QNMinimizer
public QNMinimizer(Function monitor)
QNMinimizer
public QNMinimizer(Function monitor,
int m)
QNMinimizer
public QNMinimizer(FloatFunction monitor)
shutUp
public void shutUp()
setM
public void setM(int m)
minimize
public double[] minimize(Function function,
double functionTolerance,
double[] initial)
- Description copied from interface:
Minimizer
- Attempts to find an unconstrained minimum of the objective
function
starting at initial
, within
functionTolerance
.
- Specified by:
minimize
in interface Minimizer
- Parameters:
function
- the objective functionfunctionTolerance
- a double
valueinitial
- a initial feasible point
minimize
public float[] minimize(FloatFunction function,
float functionTolerance,
float[] initial)
main
public static void main(java.lang.String[] args)