Skip to content

Commit

Permalink
fixed files form Math #62
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 5c64a20 commit f270a50
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public UnivariateRealPointValuePair optimize(final FUNC f,
final GoalType goal,
final double min, final double max)
throws FunctionEvaluationException {
return optimize(f, goal, min, max, 0);
return optimize(f, goal, min, max, min + 0.5 * (max - min));
}

/** {@inheritDoc} */
Expand All @@ -157,9 +157,8 @@ public UnivariateRealPointValuePair optimize(final FUNC f, final GoalType goal,
// Multi-start loop.
for (int i = 0; i < starts; ++i) {
try {
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, goal, FastMath.min(bound1, bound2), FastMath.max(bound1, bound2));
final double s = (i == 0) ? startValue : min + generator.nextDouble() * (max - min);
optima[i] = optimizer.optimize(f, goal, min, max, s);
} catch (FunctionEvaluationException fee) {
optima[i] = null;
} catch (ConvergenceException ce) {
Expand Down

0 comments on commit f270a50

Please sign in to comment.