QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
lsstrategy.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2006 Mark Joshi
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20#ifndef quantlib_longstaff_schwartz_exercise_strategy_hpp
21#define quantlib_longstaff_schwartz_exercise_strategy_hpp
22
27
28namespace QuantLib {
29
30 class MarketModelDiscounter;
31
33 : public ExerciseStrategy<CurveState> {
34 public:
36 std::vector<std::vector<Real> > basisCoefficients,
37 const EvolutionDescription& evolution,
38 const std::vector<Size>& numeraires,
41 std::vector<Time> exerciseTimes() const override;
42 std::vector<Time> relevantTimes() const override;
43 void reset() override;
44 bool exercise(const CurveState& currentState) const override;
45 void nextStep(const CurveState& currentState) override;
46 std::unique_ptr<ExerciseStrategy<CurveState> > clone() const override;
47 private:
49 std::vector<std::vector<Real> > basisCoefficients_;
52 std::vector<Size> numeraires_;
53 // work variable
56 std::vector<Time> exerciseTimes_, relevantTimes_;
58 std::valarray<bool> isExerciseTime_;
59 std::vector<MarketModelDiscounter> rebateDiscounters_;
60 std::vector<MarketModelDiscounter> controlDiscounters_;
61 mutable std::vector<std::vector<Real> > basisValues_;
62 std::vector<Size> exerciseIndex_;
63 };
64
65}
66
67
68#endif
cloning proxy to an underlying object
Definition: clone.hpp:40
Curve state for market-model simulations
Definition: curvestate.hpp:41
Market-model evolution description.
std::vector< std::vector< Real > > basisCoefficients_
Definition: lsstrategy.hpp:49
std::vector< Time > relevantTimes() const override
Definition: lsstrategy.cpp:93
Clone< MarketModelBasisSystem > basisSystem_
Definition: lsstrategy.hpp:48
std::vector< std::vector< Real > > basisValues_
Definition: lsstrategy.hpp:61
std::vector< MarketModelDiscounter > controlDiscounters_
Definition: lsstrategy.hpp:60
Clone< MarketModelExerciseValue > exercise_
Definition: lsstrategy.hpp:50
Clone< MarketModelExerciseValue > control_
Definition: lsstrategy.hpp:51
bool exercise(const CurveState &currentState) const override
Definition: lsstrategy.cpp:105
std::unique_ptr< ExerciseStrategy< CurveState > > clone() const override
Definition: lsstrategy.cpp:158
std::vector< MarketModelDiscounter > rebateDiscounters_
Definition: lsstrategy.hpp:59
void nextStep(const CurveState &currentState) override
Definition: lsstrategy.cpp:136
std::vector< Time > exerciseTimes() const override
Definition: lsstrategy.cpp:88
cloning proxy to an underlying object
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35