29 typedef MarketModelMultiProduct::CashFlow
CashFlow;
33 std::vector<std::vector<Real> > basisCoefficients,
35 const std::vector<Size>& numeraires,
38 : basisSystem_(
std::move(basisSystem)), basisCoefficients_(
std::move(basisCoefficients)),
39 exercise_(
std::move(exercise)), control_(
std::move(control)), numeraires_(numeraires) {
52 control_->evolution().evolutionTimes());
56 std::valarray<bool>
v =
exercise_->isExerciseTime();
57 Size exercises = 0, idx = 0;
70 const std::vector<Time>& rateTimes = evolution.
rateTimes();
71 std::vector<Time> rebateTimes =
exercise_->possibleCashFlowTimes();
73 for (i=0; i<rebateTimes.size(); ++i)
76 std::vector<Time> controlTimes =
control_->possibleCashFlowTimes();
78 for (i=0; i<controlTimes.size(); ++i)
81 std::vector<Size> basisSizes =
basisSystem_->numberOfFunctions();
113 .numeraireBonds(currentState,
120 .numeraireBonds(currentState,
128 Real continuationValue =
129 std::inner_product(alphas.begin(), alphas.end(),
133 return exerciseValue >= continuationValue;
157 std::unique_ptr<ExerciseStrategy<CurveState>>
Base class for cash flows.
virtual Real amount() const =0
returns the amount of the cash flow
cloning proxy to an underlying object
Curve state for market-model simulations
virtual Real discountRatio(Size i, Size j) const =0
Market-model evolution description.
const std::vector< Time > & rateTimes() const
const std::vector< Time > & evolutionTimes() const
std::vector< std::vector< Real > > basisCoefficients_
std::vector< Time > relevantTimes_
Real principalInNumerairePortfolio_
std::valarray< bool > isControlTime_
std::valarray< bool > isRebateTime_
std::vector< Time > relevantTimes() const override
LongstaffSchwartzExerciseStrategy(Clone< MarketModelBasisSystem > basisSystem, std::vector< std::vector< Real > > basisCoefficients, const EvolutionDescription &evolution, const std::vector< Size > &numeraires, Clone< MarketModelExerciseValue > exercise, Clone< MarketModelExerciseValue > control)
std::vector< Size > exerciseIndex_
std::valarray< bool > isBasisTime_
Clone< MarketModelBasisSystem > basisSystem_
std::vector< std::vector< Real > > basisValues_
std::vector< MarketModelDiscounter > controlDiscounters_
Clone< MarketModelExerciseValue > exercise_
Clone< MarketModelExerciseValue > control_
bool exercise(const CurveState ¤tState) const override
std::vector< Time > exerciseTimes_
std::unique_ptr< ExerciseStrategy< CurveState > > clone() const override
std::vector< MarketModelDiscounter > rebateDiscounters_
std::vector< Size > numeraires_
std::valarray< bool > isExerciseTime_
void nextStep(const CurveState ¤tState) override
std::vector< Time > exerciseTimes() const override
std::size_t Size
size of a container
std::valarray< bool > isInSubset(const std::vector< Time > &set, const std::vector< Time > &subset)
void checkCompatibility(const EvolutionDescription &evolution, const std::vector< Size > &numeraires)
MarketModelMultiProduct::CashFlow CashFlow
const ParametricExercise & exercise_
ext::shared_ptr< BlackVolTermStructure > v