Skip to content

Commit

Permalink
Pass through max evaluations to the solver (#1792)
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio authored Sep 21, 2023
2 parents 7e0e5df + f369336 commit fd99a8e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ql/termstructures/iterativebootstrap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ namespace detail {
Real maxFactor = 2.0,
Real minFactor = 2.0,
bool dontThrow = false,
Size dontThrowSteps = 10);
Size dontThrowSteps = 10,
Size maxEvaluations = MAX_FUNCTION_EVALUATIONS);
void setup(Curve* ts);
void calculate() const;
private:
Expand Down Expand Up @@ -132,12 +133,15 @@ namespace detail {
Real maxFactor,
Real minFactor,
bool dontThrow,
Size dontThrowSteps)
Size dontThrowSteps,
Size maxEvaluations)
: accuracy_(accuracy), minValue_(minValue), maxValue_(maxValue), maxAttempts_(maxAttempts),
maxFactor_(maxFactor), minFactor_(minFactor), dontThrow_(dontThrow),
dontThrowSteps_(dontThrowSteps), ts_(nullptr), loopRequired_(Interpolator::global) {
QL_REQUIRE(maxFactor_ >= 1.0, "Expected that maxFactor would be at least 1.0 but got " << maxFactor_);
QL_REQUIRE(minFactor_ >= 1.0, "Expected that minFactor would be at least 1.0 but got " << minFactor_);
firstSolver_.setMaxEvaluations(maxEvaluations);
solver_.setMaxEvaluations(maxEvaluations);
}

template <class Curve>
Expand Down

0 comments on commit fd99a8e

Please sign in to comment.