|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.von_gagern.martin.confoo.opt.Newton
public class Newton
Newton method for Convex Optimization.
This class implements Newton method for convex optimization with backtracking line search. The details can be found in the book Convex Optimization by Boyd and Vanderberghe which is available online.
| Nested Class Summary | |
|---|---|
static class |
Newton.ExitCondition
Enumeration of possible reasons for the termination of an optimization. |
| Method Summary | |
|---|---|
no.uib.cipr.matrix.Vector |
getArgMin()
Get position of critical point. |
Newton.ExitCondition |
getExitCondition()
Get cause for the termination of the most recent optimization. |
double |
getExitError()
Get residual error for exit condition. |
static Newton |
getInstance(Functional f)
Construct new optimizer for given functional. |
void |
lineSearchParameters(double alpha,
double beta,
double gamma)
Set parameters for backtracking line search. |
void |
optimize()
Find approximatively optimal solution. |
void |
run()
Runnable interface to the optimize method. |
void |
setEpsilon(Newton.ExitCondition cond,
double epsilon)
Set error bound for given termination condition. |
void |
setMaxIterations(int max)
Set maximum number of iterations. |
void |
setNorm(Newton.ExitCondition cond,
no.uib.cipr.matrix.Vector.Norm norm)
Set the norm used to compare a vector with an error bound. |
void |
throwInterceptedExceptions()
Re-throw exceptions intercepted by run. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Newton getInstance(Functional f)
f - the functional to be optimized
public void optimize()
throws no.uib.cipr.matrix.sparse.IterativeSolverNotConvergedException
This is the main method of the optimizer. It uses settings made by previous call to varous configuration methods, and makes its results available to various result access methods.
When this method terminates, the most recent call to
setArgument for the underlying functional will
have been for the found optimum. Thus the functional itself can
be queried to get the optimal value, residual gradient and so
on.
no.uib.cipr.matrix.sparse.IterativeSolverNotConvergedException - if the Newton step
could not be determined, e.g. because the functional is
not convex.Functional.setArgument(Vector)public Newton.ExitCondition getExitCondition()
public double getExitError()
getExitCondition()public no.uib.cipr.matrix.Vector getArgMin()
public void setEpsilon(Newton.ExitCondition cond,
double epsilon)
cond - one of GRADIENT, DELTA or
ESTIMATEepsilon - the new bound to be set
IllegalArgumentException - for other conditions
public void setNorm(Newton.ExitCondition cond,
no.uib.cipr.matrix.Vector.Norm norm)
cond - one of GRADIENT or DELTAnorm - the norm to evaluate for the specified vectorssetEpsilon(net.von_gagern.martin.confoo.opt.Newton.ExitCondition, double)public void setMaxIterations(int max)
max - the new maximum number of iterationsNewton.ExitCondition.ITERATIONS
public void lineSearchParameters(double alpha,
double beta,
double gamma)
Once the Newton step is determined, the actual change in function value at the end of the step is compared with the change predicted by the gradient. The actual difference has to be at least alpha times the predicted difference. Otherwise the step size is reduced by multiplication with beta. The parameter gamma defines a minimal proportion of the original step size; after this has been reached the line search will terminate no matter what.
alpha - factor by which to multiply predicted change.
0 < alpha < 0.5beta - factor to reduce step size. 0 < beta < 1gamma - minimum step size factor. 0 <= gamma <= betapublic void run()
optimize method.
This method allows performing the optimization in a different
thread. However, as a run method may not throw any
checked exceptions, special care has to be taken to catch these
exceptions later on. The main thread that was waiting for the
result should call throwInterceptedExceptions to
re-throw any exceptions that occurred during execution in a
different thread.
Any application not using multiple threads should rather call
optimize directly to deal with exceptions more
easily.
run in interface RunnableIllegalStateException - if there is an uncleared
exception from a previous invocationoptimize(),
throwInterceptedExceptions()
public void throwInterceptedExceptions()
throws no.uib.cipr.matrix.sparse.IterativeSolverNotConvergedException
run.
This method must be called after every invocation of
run in order to clear and re-throw any exceptions
which occurred during the execution of optimize.
no.uib.cipr.matrix.sparse.IterativeSolverNotConvergedExceptionrun()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||