QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
base class for Monte Carlo engines More...
#include <mcsimulation.hpp>
Public Types | |
typedef MonteCarloModel< MC, RNG, S >::path_generator_type | path_generator_type |
typedef MonteCarloModel< MC, RNG, S >::path_pricer_type | path_pricer_type |
typedef MonteCarloModel< MC, RNG, S >::stats_type | stats_type |
typedef MonteCarloModel< MC, RNG, S >::result_type | result_type |
Public Member Functions | |
virtual | ~McSimulation ()=default |
result_type | value (Real tolerance, Size maxSamples=QL_MAX_INTEGER, Size minSamples=1023) const |
add samples until the required absolute tolerance is reached More... | |
result_type | valueWithSamples (Size samples) const |
simulate a fixed number of samples More... | |
result_type | errorEstimate () const |
error estimated using the samples simulated so far More... | |
const stats_type & | sampleAccumulator () const |
access to the sample accumulator for richer statistics More... | |
void | calculate (Real requiredTolerance, Size requiredSamples, Size maxSamples) const |
basic calculate method provided to inherited pricing engines More... | |
Protected Member Functions | |
McSimulation (bool antitheticVariate, bool controlVariate) | |
virtual ext::shared_ptr< path_pricer_type > | pathPricer () const =0 |
virtual ext::shared_ptr< path_generator_type > | pathGenerator () const =0 |
virtual TimeGrid | timeGrid () const =0 |
virtual ext::shared_ptr< path_pricer_type > | controlPathPricer () const |
virtual ext::shared_ptr< path_generator_type > | controlPathGenerator () const |
virtual ext::shared_ptr< PricingEngine > | controlPricingEngine () const |
virtual result_type | controlVariateValue () const |
Static Protected Member Functions | |
template<class Sequence > | |
static Real | maxError (const Sequence &sequence) |
static Real | maxError (Real error) |
Protected Attributes | |
ext::shared_ptr< MonteCarloModel< MC, RNG, S > > | mcModel_ |
bool | antitheticVariate_ |
bool | controlVariate_ |
base class for Monte Carlo engines
Eventually this class might offer greeks methods. Deriving a class from McSimulation gives an easy way to write a Monte Carlo engine.
See McVanillaEngine as an example.
Definition at line 43 of file mcsimulation.hpp.
typedef MonteCarloModel<MC,RNG,S>::path_generator_type path_generator_type |
Definition at line 46 of file mcsimulation.hpp.
typedef MonteCarloModel<MC,RNG,S>::path_pricer_type path_pricer_type |
Definition at line 48 of file mcsimulation.hpp.
typedef MonteCarloModel<MC,RNG,S>::stats_type stats_type |
Definition at line 50 of file mcsimulation.hpp.
typedef MonteCarloModel<MC,RNG,S>::result_type result_type |
Definition at line 51 of file mcsimulation.hpp.
|
virtualdefault |
|
protected |
Definition at line 69 of file mcsimulation.hpp.
McSimulation< MC, RNG, S >::result_type value | ( | Real | tolerance, |
Size | maxSamples = QL_MAX_INTEGER , |
||
Size | minSamples = 1023 |
||
) | const |
add samples until the required absolute tolerance is reached
Definition at line 106 of file mcsimulation.hpp.
McSimulation< MC, RNG, S >::result_type valueWithSamples | ( | Size | samples | ) | const |
simulate a fixed number of samples
Definition at line 144 of file mcsimulation.hpp.
McSimulation< MC, RNG, S >::result_type errorEstimate |
error estimated using the samples simulated so far
Definition at line 211 of file mcsimulation.hpp.
const McSimulation< MC, RNG, S >::stats_type & sampleAccumulator |
access to the sample accumulator for richer statistics
Definition at line 217 of file mcsimulation.hpp.
basic calculate method provided to inherited pricing engines
Definition at line 159 of file mcsimulation.hpp.
|
protectedpure virtual |
Implemented in MCLongstaffSchwartzPathEngine< GenericEngine, MC, RNG, S >, MCLongstaffSchwartzPathEngine< PathMultiAssetOption::engine, MultiVariate, PseudoRandom >, MCPathBasketEngine< RNG, S >, MCHullWhiteCapFloorEngine< RNG, S >, MCDoubleBarrierEngine< RNG, S >, MCEverestEngine< RNG, S >, MCHimalayaEngine< RNG, S >, MCPagodaEngine< RNG, S >, MCDiscreteArithmeticAPEngine< RNG, S >, MCDiscreteArithmeticAPHestonEngine< RNG, S, P >, MCDiscreteArithmeticASEngine< RNG, S >, MCDiscreteGeometricAPEngine< RNG, S >, MCDiscreteGeometricAPHestonEngine< RNG, S, P >, MCBarrierEngine< RNG, S >, MCEuropeanBasketEngine< RNG, S >, MCPerformanceEngine< RNG, S >, MCForwardEuropeanBSEngine< RNG, S >, MCForwardEuropeanHestonEngine< RNG, S, P >, MCVarianceSwapEngine< RNG, S >, MCLookbackEngine< I, RNG, S >, MCLongstaffSchwartzEngine< GenericEngine, MC, RNG, S, RNG_Calibration >, MCLongstaffSchwartzEngine< BasketOption::engine, MultiVariate, PseudoRandom >, MCLongstaffSchwartzEngine< VanillaOption::engine, SingleVariate, PseudoRandom, Statistics, PseudoRandom >, MCDigitalEngine< RNG, S >, MCEuropeanEngine< RNG, S >, MCEuropeanGJRGARCHEngine< RNG, S >, MCEuropeanHestonEngine< RNG, S, P >, and MCHestonHullWhiteEngine< RNG, S >.
|
protectedpure virtual |
Implemented in MCLongstaffSchwartzPathEngine< GenericEngine, MC, RNG, S >, MCLongstaffSchwartzPathEngine< PathMultiAssetOption::engine, MultiVariate, PseudoRandom >, MCPathBasketEngine< RNG, S >, MCHullWhiteCapFloorEngine< RNG, S >, MCDoubleBarrierEngine< RNG, S >, MCEverestEngine< RNG, S >, MCHimalayaEngine< RNG, S >, MCPagodaEngine< RNG, S >, MCDiscreteAveragingAsianEngineBase< MC, RNG, S >, MCDiscreteAveragingAsianEngineBase< SingleVariate, PseudoRandom, Statistics >, MCDiscreteAveragingAsianEngineBase< MultiVariate, PseudoRandom, Statistics >, MCBarrierEngine< RNG, S >, MCEuropeanBasketEngine< RNG, S >, MCPerformanceEngine< RNG, S >, MCForwardVanillaEngine< MC, RNG, S >, MCForwardVanillaEngine< SingleVariate, PseudoRandom, Statistics >, MCForwardVanillaEngine< MultiVariate, PseudoRandom, Statistics >, MCVarianceSwapEngine< RNG, S >, MCLookbackEngine< I, RNG, S >, MCLongstaffSchwartzEngine< GenericEngine, MC, RNG, S, RNG_Calibration >, MCLongstaffSchwartzEngine< BasketOption::engine, MultiVariate, PseudoRandom >, MCLongstaffSchwartzEngine< VanillaOption::engine, SingleVariate, PseudoRandom, Statistics, PseudoRandom >, MCVanillaEngine< MC, RNG, S, Inst >, MCVanillaEngine< SingleVariate, PseudoRandom, Statistics >, and MCVanillaEngine< MultiVariate, PseudoRandom, Statistics >.
|
protectedpure virtual |
Implemented in MCLongstaffSchwartzPathEngine< GenericEngine, MC, RNG, S >, MCLongstaffSchwartzPathEngine< PathMultiAssetOption::engine, MultiVariate, PseudoRandom >, MCPathBasketEngine< RNG, S >, MCHullWhiteCapFloorEngine< RNG, S >, MCDoubleBarrierEngine< RNG, S >, MCEverestEngine< RNG, S >, MCHimalayaEngine< RNG, S >, MCPagodaEngine< RNG, S >, MCDiscreteAveragingAsianEngineBase< MC, RNG, S >, MCDiscreteAveragingAsianEngineBase< SingleVariate, PseudoRandom, Statistics >, MCDiscreteAveragingAsianEngineBase< MultiVariate, PseudoRandom, Statistics >, MCBarrierEngine< RNG, S >, MCEuropeanBasketEngine< RNG, S >, MCPerformanceEngine< RNG, S >, MCForwardVanillaEngine< MC, RNG, S >, MCForwardVanillaEngine< SingleVariate, PseudoRandom, Statistics >, MCForwardVanillaEngine< MultiVariate, PseudoRandom, Statistics >, MCVarianceSwapEngine< RNG, S >, MCLookbackEngine< I, RNG, S >, MCLongstaffSchwartzEngine< GenericEngine, MC, RNG, S, RNG_Calibration >, MCLongstaffSchwartzEngine< BasketOption::engine, MultiVariate, PseudoRandom >, MCLongstaffSchwartzEngine< VanillaOption::engine, SingleVariate, PseudoRandom, Statistics, PseudoRandom >, MCVanillaEngine< MC, RNG, S, Inst >, MCVanillaEngine< SingleVariate, PseudoRandom, Statistics >, and MCVanillaEngine< MultiVariate, PseudoRandom, Statistics >.
|
protectedvirtual |
Reimplemented in MCDiscreteArithmeticAPEngine< RNG, S >, MCDiscreteArithmeticAPHestonEngine< RNG, S, P >, MCForwardEuropeanHestonEngine< RNG, S, P >, MCAmericanEngine< RNG, S, RNG_Calibration >, and MCHestonHullWhiteEngine< RNG, S >.
Definition at line 77 of file mcsimulation.hpp.
|
protectedvirtual |
Reimplemented in MCHestonHullWhiteEngine< RNG, S >.
Definition at line 81 of file mcsimulation.hpp.
|
protectedvirtual |
Reimplemented in MCDiscreteArithmeticAPEngine< RNG, S >, MCDiscreteArithmeticAPHestonEngine< RNG, S, P >, MCForwardEuropeanHestonEngine< RNG, S, P >, MCAmericanEngine< RNG, S, RNG_Calibration >, and MCHestonHullWhiteEngine< RNG, S >.
Definition at line 84 of file mcsimulation.hpp.
|
protectedvirtual |
Reimplemented in MCDiscreteAveragingAsianEngineBase< MC, RNG, S >, MCDiscreteAveragingAsianEngineBase< SingleVariate, PseudoRandom, Statistics >, MCDiscreteAveragingAsianEngineBase< MultiVariate, PseudoRandom, Statistics >, MCForwardVanillaEngine< MC, RNG, S >, MCForwardVanillaEngine< SingleVariate, PseudoRandom, Statistics >, MCForwardVanillaEngine< MultiVariate, PseudoRandom, Statistics >, MCAmericanEngine< RNG, S, RNG_Calibration >, MCVanillaEngine< MC, RNG, S, Inst >, MCVanillaEngine< SingleVariate, PseudoRandom, Statistics >, and MCVanillaEngine< MultiVariate, PseudoRandom, Statistics >.
Definition at line 87 of file mcsimulation.hpp.
|
staticprotected |
Definition at line 91 of file mcsimulation.hpp.
Definition at line 94 of file mcsimulation.hpp.
|
mutableprotected |
Definition at line 98 of file mcsimulation.hpp.
|
protected |
Definition at line 99 of file mcsimulation.hpp.
|
protected |
Definition at line 99 of file mcsimulation.hpp.