Skip to content
This repository was archived by the owner on Nov 23, 2018. It is now read-only.

Commit da599e3

Browse files
committed
Rename FunctionGradientEvals in Settings and Stats to FuncGradEvaluations
1 parent bb19d32 commit da599e3

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

local.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,14 @@ func checkConvergence(loc *Location, iterType IterationType, stats *Stats, setti
273273
}
274274

275275
if settings.FuncEvaluations > 0 {
276-
totalFun := stats.FuncEvaluations + stats.FunctionGradientEvals
276+
totalFun := stats.FuncEvaluations + stats.FuncGradEvaluations
277277
if totalFun >= settings.FuncEvaluations {
278278
return FunctionEvaluationLimit
279279
}
280280
}
281281

282282
if settings.GradEvaluations > 0 {
283-
totalGrad := stats.GradEvaluations + stats.FunctionGradientEvals
283+
totalGrad := stats.GradEvaluations + stats.FuncGradEvaluations
284284
if totalGrad >= settings.GradEvaluations {
285285
return GradientEvaluationLimit
286286
}
@@ -334,13 +334,13 @@ func evaluate(funcInfo *functionInfo, evalType EvaluationType, xNext []float64,
334334
}
335335
if funcInfo.IsFunctionGradient {
336336
loc.F = funcInfo.functionGradient.FuncGrad(loc.X, loc.Gradient)
337-
stats.FunctionGradientEvals++
337+
stats.FuncGradEvaluations++
338338
return
339339
}
340340
case FuncGradEvaluation:
341341
if funcInfo.IsFunctionGradient {
342342
loc.F = funcInfo.functionGradient.FuncGrad(loc.X, loc.Gradient)
343-
stats.FunctionGradientEvals++
343+
stats.FuncGradEvaluations++
344344
return
345345
}
346346
if funcInfo.IsGradient {

printer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (p *Printer) Record(loc *Location, _ EvaluationType, iter IterationType, st
7171
// Make the value strings
7272
var valueStrings [nPrinterOut]string
7373
valueStrings[0] = strconv.Itoa(stats.MajorIterations)
74-
valueStrings[1] = strconv.Itoa(stats.FuncEvaluations + stats.FunctionGradientEvals)
74+
valueStrings[1] = strconv.Itoa(stats.FuncEvaluations + stats.FuncGradEvaluations)
7575
valueStrings[2] = fmt.Sprintf("%g", loc.F)
7676
if p.printGrad {
7777
norm := floats.Norm(loc.Gradient, math.Inf(1))

types.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ type Result struct {
8989

9090
// Stats contains the statistics of the run.
9191
type Stats struct {
92-
MajorIterations int // Total number of major iterations
93-
FuncEvaluations int // Number of evaluations of Func()
94-
GradEvaluations int // Number of evaluations of Grad()
95-
FunctionGradientEvals int // Number of evaluations of FuncGrad()
96-
Runtime time.Duration // Total runtime of the optimization
92+
MajorIterations int // Total number of major iterations
93+
FuncEvaluations int // Number of evaluations of Func()
94+
GradEvaluations int // Number of evaluations of Grad()
95+
FuncGradEvaluations int // Number of evaluations of FuncGrad()
96+
Runtime time.Duration // Total runtime of the optimization
9797
}
9898

9999
// FunctionInfo is data to give to the optimizer about the objective function.

unconstrained_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ func testLocal(t *testing.T, tests []unconstrainedTest, method Method) {
738738
// Check that providing initial data reduces the number of function
739739
// and/or gradient calls exactly by one.
740740
if funcInfo.IsFunctionGradient {
741-
if result.FunctionGradientEvals != result2.FunctionGradientEvals+1 {
741+
if result.FuncGradEvaluations != result2.FuncGradEvaluations+1 {
742742
t.Errorf("Providing initial data does not reduce the number of function/gradient calls for:\n%v", test)
743743
continue
744744
}

0 commit comments

Comments
 (0)