## edu.stanford.nlp.optimization
Class CGMinimizer

    java.lang.Object
      edu.stanford.nlp.optimization.CGMinimizer

All Implemented Interfaces:
  Minimizer<DiffFunction>

    public class CGMinimizer

extends Object
implements Minimizer<DiffFunction>

Conjugate-gradient implementation based on the code in Numerical Recipes in C. (See p. 423 and others.) As of now, it requires a differentiable function (DiffFunction) as input. Equality constraints are supported; inequality constraints may soon be added.

The basic way to use the minimizer is with a null constructor, then the simple minimize method:

`Minimizer cgm = new CGMinimizer();`
`DiffFunction df = new SomeDiffFunction();`
`double tol = 1e-4;`
`double[] initial = getInitialGuess();`
`double[] minimum = cgm.minimize(df,tol,initial);`

Since:
  1.0
Author:
  Dan Klein

Constructor Summary
`CGMinimizer()` Basic constructor, use this.
`CGMinimizer(boolean silent)` Pass in `false` to get per-iteration progress reports (to stderr).
`CGMinimizer(Function monitor)` Perform minimization with monitoring.

Method Summary
`double[]` `minimize(DiffFunction function, double functionTolerance, double[] initial)` Attempts to find an unconstrained minimum of the objective `function` starting at `initial`, within `functionTolerance`.
`double[]` `minimize(DiffFunction dfunction, double functionTolerance, double[] initial, int maxIterations)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CGMinimizer

    public CGMinimizer()

  Basic constructor, use this.

### CGMinimizer

    public CGMinimizer(boolean silent)

  Pass in `false` to get per-iteration progress reports (to stderr).

  Parameters:
    `silent` - a `boolean` value

### CGMinimizer

    public CGMinimizer(Function monitor)

  Perform minimization with monitoring. After each iteration, monitor.valueAt(x) gets called, with the double array `x` being that iteration's ending point. A return `< tol` forces convergence (terminates the CG procedure). Specially for Kristina.

  Parameters:
    `monitor` - a `Function` value

Method Detail

### minimize

    public double[] minimize(DiffFunction 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<DiffFunction>`
  Parameters:
    `function` - the objective function
    `functionTolerance` - a `double` value
    `initial` - a initial feasible point
  Returns:
    Unconstrained minimum of function

### minimize

    public double[] minimize(DiffFunction dfunction,
                             double functionTolerance,
                             double[] initial,
                             int maxIterations)

  Specified by:
    `minimize` in interface `Minimizer<DiffFunction>`

Stanford NLP Group