Skip to content

Commit

Permalink
make sure at least one run in the multistart univariate optimizer use…
Browse files Browse the repository at this point in the history
…s the complete search domain

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@797786 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Luc Maisonobe committed Jul 25, 2009
1 parent 4e2dd4d commit 270d182
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ public double optimize(final UnivariateRealFunction f, final GoalType goalType,
try {
optimizer.setMaximalIterationCount(maxIterations - totalIterations);
optimizer.setMaxEvaluations(maxEvaluations - totalEvaluations);
final double bound1 = min + generator.nextDouble() * (max - min);
final double bound2 = min + generator.nextDouble() * (max - min);
final double bound1 = (i == 0) ? min : min + generator.nextDouble() * (max - min);
final double bound2 = (i == 0) ? max : min + generator.nextDouble() * (max - min);
optima[i] = optimizer.optimize(f, goalType,
Math.min(bound1, bound2),
Math.max(bound1, bound2));
Expand Down

0 comments on commit 270d182

Please sign in to comment.