Example #1
0
func NewCubic() *Cubic {
	return &Cubic{
		// Cubic has lower bound of 0 for step
		step: uni.NewBoundedStep(),

		// Default Settings
		StepDecreaseMin: 1E-4,
		StepDecreaseMax: 0.9,
		StepIncreaseMin: 1.25,
		StepIncreaseMax: 1E3,

		FloatingpointRelTol: 1E-15, // dealing with numerical errors in the function value
	}
}
Example #2
0
func NewLbfgs() *Lbfgs {
	l := &Lbfgs{
		step: uni.NewBoundedStep(),

		LinesearchMethod:   univariate.NewCubic(),
		LinesearchSettings: univariate.NewUniGradSettings(),
		NumStore:           30,
		Wolfe:              &linesearch.StrongWolfeConditions{},
	}
	l.Wolfe.SetFunConst(0)
	l.Wolfe.SetGradConst(0.9)
	l.LinesearchSettings.MaximumFunctionEvaluations = 100
	l.LinesearchSettings.Display = false
	l.LinesearchSettings.GradientAbsoluteTolerance = 0 // Force convergence from wolfe conditions
	return l
}