25#ifndef quantlib_mc_hull_white_cap_floor_engine_hpp
26#define quantlib_mc_hull_white_cap_floor_engine_hpp
41 ext::shared_ptr<HullWhite>,
42 Time forwardMeasureTime);
58 template <
class RNG = PseudoRandom,
class S = Statistics>
76 bool antitheticVariate,
78 Real requiredTolerance,
92 if (RNG::allowsErrorEstimate)
94 this->
mcModel_->sampleAccumulator().errorEstimate();
99 Date referenceDate =
model_->termStructure()->referenceDate();
101 Time forwardMeasureTime =
104 return ext::shared_ptr<path_pricer_type>(
106 forwardMeasureTime));
111 Date referenceDate =
model_->termStructure()->referenceDate();
115 std::vector<Time> times;
126 return TimeGrid(times.begin(), times.end());
132 Date referenceDate = curve->referenceDate();
135 Time forwardMeasureTime =
139 Real a = parameters[0],
sigma = parameters[1];
140 ext::shared_ptr<HullWhiteForwardProcess> process(
142 process->setForwardMeasureTime(forwardMeasureTime);
145 typename RNG::rsg_type generator =
146 RNG::make_sequence_generator(grid.
size()-1,
seed_);
147 return ext::shared_ptr<path_generator_type>(
156 template <
class RNG = PseudoRandom,
class S = Statistics>
168 operator ext::shared_ptr<PricingEngine>()
const;
181 template <
class RNG,
class S>
183 ext::shared_ptr<HullWhite> model)
187 template <
class RNG,
class S>
191 "tolerance already set");
196 template <
class RNG,
class S>
201 "number of samples already set");
203 "chosen random generator policy "
204 "does not allow an error estimate");
205 tolerance_ = tolerance;
209 template <
class RNG,
class S>
212 maxSamples_ = samples;
216 template <
class RNG,
class S>
223 template <
class RNG,
class S>
230 template <
class RNG,
class S>
237 template <
class RNG,
class S>
239 operator ext::shared_ptr<PricingEngine>()
const {
240 return ext::shared_ptr<PricingEngine>(
new
242 brownianBridge_, antithetic_,
243 samples_, tolerance_,
244 maxSamples_, seed_));
1-D array used in linear algebra.
Arguments for cap/floor calculation
std::vector< Date > endDates
std::vector< Date > fixingDates
base class for cap/floor engines
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
CapFloor::results results_
CapFloor::arguments arguments_
Shared handle to an observable.
Forward Hull-White stochastic process
Monte Carlo Hull-White engine for cap/floors.
simulation::stats_type stats_type
MCHullWhiteCapFloorEngine(ext::shared_ptr< HullWhite > model, bool brownianBridge, bool antitheticVariate, Size requiredSamples, Real requiredTolerance, Size maxSamples, BigNatural seed)
ext::shared_ptr< HullWhite > model_
ext::shared_ptr< path_generator_type > pathGenerator() const
void calculate() const override
simulation::path_generator_type path_generator_type
TimeGrid timeGrid() const
McSimulation< SingleVariate, RNG, S > simulation
ext::shared_ptr< path_pricer_type > pathPricer() const
simulation::path_pricer_type path_pricer_type
Monte Carlo Hull-White cap-floor engine factory.
MakeMCHullWhiteCapFloorEngine & withAbsoluteTolerance(Real tolerance)
MakeMCHullWhiteCapFloorEngine(ext::shared_ptr< HullWhite >)
MakeMCHullWhiteCapFloorEngine & withSeed(BigNatural seed)
MakeMCHullWhiteCapFloorEngine & withMaxSamples(Size samples)
MakeMCHullWhiteCapFloorEngine & withBrownianBridge(bool b=true)
ext::shared_ptr< HullWhite > model_
MakeMCHullWhiteCapFloorEngine & withSamples(Size samples)
MakeMCHullWhiteCapFloorEngine & withAntitheticVariate(bool b=true)
base class for Monte Carlo engines
MonteCarloModel< MC, RNG, S >::path_generator_type path_generator_type
ext::shared_ptr< MonteCarloModel< MC, RNG, S > > mcModel_
void calculate(Real requiredTolerance, Size requiredSamples, Size maxSamples) const
basic calculate method provided to inherited pricing engines
MonteCarloModel< MC, RNG, S >::path_pricer_type path_pricer_type
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
single-factor random walk
base class for path pricers
DiscountFactor endDiscount_
ext::shared_ptr< HullWhite > model_
CapFloor::arguments args_
std::vector< Time > endTimes_
std::vector< Time > fixingTimes_
Real operator()(const Path &path) const override
std::vector< Time > startTimes_
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
ext::function< Real(Real)> b
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
std::size_t Size
size of a container
Hull-White stochastic processes.
framework for Monte Carlo engines
unsigned QL_BIG_INTEGER BigNatural
large positive integer
default Monte Carlo traits for single-variate models