Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- optimize :: forall f. Traversable f => Parameters -> Double -> f Double -> (forall s. Reifies s Tape => f (Reverse s Double) -> Reverse s Double) -> IO (f Double, Result, Statistics)
- data Result
- data Statistics = Statistics {
- finalValue :: Double
- gradNorm :: Double
- totalIters :: CInt
- funcEvals :: CInt
- gradEvals :: CInt
- defaultParameters :: Parameters
- data Parameters = Parameters {
- printFinal :: Bool
- printParams :: Bool
- verbose :: Verbose
- lineSearch :: LineSearch
- qdecay :: Double
- stopRules :: StopRules
- estimateError :: EstimateError
- quadraticStep :: Maybe Double
- debugTol :: Maybe Double
- initialStep :: Maybe Double
- maxItersFac :: Double
- nexpand :: CInt
- nsecant :: CInt
- restartFac :: Double
- funcEpsilon :: Double
- nanRho :: Double
- techParameters :: TechParameters
- data Verbose
- = Quiet
- | Verbose
- | VeryVerbose
- data LineSearch
- data StopRules
- data EstimateError
- data TechParameters = TechParameters {}
- class (Num t, Num (Scalar t)) => Mode t where
Main function
:: Traversable f | |
=> Parameters | How should we optimize. |
-> Double |
|
-> f Double | Initial guess. |
-> (forall s. Reifies s Tape => f (Reverse s Double) -> Reverse s Double) | Function to be minimized. |
-> IO (f Double, Result, Statistics) |
Run the CG_DESCENT
optimizer and try to minimize the function.
It uses reverse mode automatic differentiation to compute the gradient.
Result and statistics
ToleranceStatisfied | Convergence tolerance was satisfied. |
FunctionChange | Change in function value was less than |
MaxTotalIter | Total iterations exceeded |
NegativeSlope | Slope was always negative in line search. |
MaxSecantIter | Number of secant iterations exceed nsecant. |
NotDescent | Search direction not a descent direction. |
LineSearchFailsInitial | Line search fails in initial interval. |
LineSearchFailsBisection | Line search fails during bisection. |
LineSearchFailsUpdate | Line search fails during interval update. |
DebugTol | Debug tolerance was on and the test failed (see |
FunctionValueNaN | Function value became |
StartFunctionValueNaN | Initial function value was |
data Statistics #
Statistics given after the process finishes.
Statistics | |
|
Instances
Options
defaultParameters :: Parameters #
Default parameters. See the documentation for Parameters
and TechParameters
to see what are the defaults.
data Parameters #
Parameters given to the optimizer.
Parameters | |
|
Instances
How verbose we should be.
Quiet | Do not output anything to |
Verbose | Print what work is being done on each iteraction. |
VeryVerbose | Print information about every step, may be useful for troubleshooting. |
Instances
Enum Verbose | |
Eq Verbose | |
Ord Verbose | |
Defined in Numeric.Optimization.Algorithms.HagerZhang05 | |
Read Verbose | |
Show Verbose | |
data LineSearch #
Line search methods that may be used.
ApproximateWolfe | Use approximate Wolfe line search. |
AutoSwitch Double | Use ordinary Wolfe line search, switch to approximate Wolfe when |f_{k+1} - f_k| < AWolfeFac * C_k where |
Instances
Eq LineSearch | |
Defined in Numeric.Optimization.Algorithms.HagerZhang05 (==) :: LineSearch -> LineSearch -> Bool # (/=) :: LineSearch -> LineSearch -> Bool # | |
Ord LineSearch | |
Defined in Numeric.Optimization.Algorithms.HagerZhang05 compare :: LineSearch -> LineSearch -> Ordering # (<) :: LineSearch -> LineSearch -> Bool # (<=) :: LineSearch -> LineSearch -> Bool # (>) :: LineSearch -> LineSearch -> Bool # (>=) :: LineSearch -> LineSearch -> Bool # max :: LineSearch -> LineSearch -> LineSearch # min :: LineSearch -> LineSearch -> LineSearch # | |
Read LineSearch | |
Defined in Numeric.Optimization.Algorithms.HagerZhang05 readsPrec :: Int -> ReadS LineSearch # readList :: ReadS [LineSearch] # readPrec :: ReadPrec LineSearch # readListPrec :: ReadPrec [LineSearch] # | |
Show LineSearch | |
Defined in Numeric.Optimization.Algorithms.HagerZhang05 showsPrec :: Int -> LineSearch -> ShowS # show :: LineSearch -> String # showList :: [LineSearch] -> ShowS # |
Stop rules used to decided when to stop iterating.
DefaultStopRule Double |
|g_k|_infty <= max(grad_tol, |g_0|_infty * stop_fac) where |
AlternativeStopRule |
|g_k|_infty <= grad_tol * (1 + |f_k|) |
data EstimateError #
How to calculate the estimated error in the function value.
AbsoluteEpsilon Double |
|
RelativeEpsilon Double |
|
Instances
Eq EstimateError | |
Defined in Numeric.Optimization.Algorithms.HagerZhang05 (==) :: EstimateError -> EstimateError -> Bool # (/=) :: EstimateError -> EstimateError -> Bool # | |
Ord EstimateError | |
Defined in Numeric.Optimization.Algorithms.HagerZhang05 compare :: EstimateError -> EstimateError -> Ordering # (<) :: EstimateError -> EstimateError -> Bool # (<=) :: EstimateError -> EstimateError -> Bool # (>) :: EstimateError -> EstimateError -> Bool # (>=) :: EstimateError -> EstimateError -> Bool # max :: EstimateError -> EstimateError -> EstimateError # min :: EstimateError -> EstimateError -> EstimateError # | |
Read EstimateError | |
Defined in Numeric.Optimization.Algorithms.HagerZhang05 readsPrec :: Int -> ReadS EstimateError # readList :: ReadS [EstimateError] # | |
Show EstimateError | |
Defined in Numeric.Optimization.Algorithms.HagerZhang05 showsPrec :: Int -> EstimateError -> ShowS # show :: EstimateError -> String # showList :: [EstimateError] -> ShowS # |
Technical parameters
data TechParameters #
Technical parameters which you probably should not touch.
You should read the papers of CG_DESCENT
to understand how
you can tune these parameters.
TechParameters | |
|
Instances
Eq TechParameters | |
Defined in Numeric.Optimization.Algorithms.HagerZhang05 (==) :: TechParameters -> TechParameters -> Bool # (/=) :: TechParameters -> TechParameters -> Bool # | |
Ord TechParameters | |
Defined in Numeric.Optimization.Algorithms.HagerZhang05 compare :: TechParameters -> TechParameters -> Ordering # (<) :: TechParameters -> TechParameters -> Bool # (<=) :: TechParameters -> TechParameters -> Bool # (>) :: TechParameters -> TechParameters -> Bool # (>=) :: TechParameters -> TechParameters -> Bool # max :: TechParameters -> TechParameters -> TechParameters # min :: TechParameters -> TechParameters -> TechParameters # | |
Read TechParameters | |
Defined in Numeric.Optimization.Algorithms.HagerZhang05 readsPrec :: Int -> ReadS TechParameters # readList :: ReadS [TechParameters] # | |
Show TechParameters | |
Defined in Numeric.Optimization.Algorithms.HagerZhang05 showsPrec :: Int -> TechParameters -> ShowS # show :: TechParameters -> String # showList :: [TechParameters] -> ShowS # |
Re-export
class (Num t, Num (Scalar t)) => Mode t where #