-
Notifications
You must be signed in to change notification settings - Fork 9
Combine implementations of Global and Local #186
Conversation
This is step two of the plan. After this is comments and a real global method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
global.go
Outdated
case NoOperation: | ||
case InitIteration: | ||
panic("optimize: GlobalMethod return InitIteration") | ||
panic("optimize: Method return InitIteration") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... returned ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
guessandcheck.go
Outdated
func (g *GuessAndCheck) InitGlobal(dim, tasks int) int { | ||
g.eval = make([]bool, tasks) | ||
g.bestF = math.Inf(1) | ||
g.bestX = make([]float64, dim) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reuse g.bestX
if possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
minimize.go
Outdated
// If local is true, gradient convergence is also checked. | ||
func checkConvergence(loc *Location, settings *Settings, local bool) Status { | ||
if local { | ||
if loc.Gradient != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge this with if local
?
minimize.go
Outdated
} | ||
|
||
// checkLimits returns NotTerminated status if the various limits given by | ||
// settings has not been reached. Otherwise it returns a corresponding status. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/has/have/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
minimize.go
Outdated
|
||
// checkLimits returns NotTerminated status if the various limits given by | ||
// settings has not been reached. Otherwise it returns a corresponding status. | ||
// Unlike checkConvergence, checkLimits is called by Local at _every_ iteration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... is called by Local and Global at every iteration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
0a82f21
to
977c989
Compare
No description provided.