QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
parametricexercise.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2006 StatPro Italia srl
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
21#ifndef quantlib_parametric_exercise_hpp
22#define quantlib_parametric_exercise_hpp
23
24#include <ql/methods/montecarlo/nodedata.hpp>
25#include <ql/math/optimization/method.hpp>
26
27namespace QuantLib {
28
30 public:
31 virtual ~ParametricExercise() = default;
32 // possibly different for each exercise
33 virtual std::vector<Size> numberOfVariables() const = 0;
34 virtual std::vector<Size> numberOfParameters() const = 0;
35 virtual bool exercise(Size exerciseNumber,
36 const std::vector<Real>& parameters,
37 const std::vector<Real>& variables) const = 0;
38 virtual void guess(Size exerciseNumber,
39 std::vector<Real>& parameters) const = 0;
40 };
41
42
44 /* TODO document:
45 n exercises, n+1 elements in simulationData
46 simulationData[0][j] -> cashflows up to first exercise, j-th path
47 simulationData[i+1][j] -> i-th exercise, j-th path
48
49 simulationData[0][j].foo unused (unusable?) if foo != cumulatedCashFlows
50
51 parameters.size() = n
52 */
54 std::vector<std::vector<NodeData> >& simulationData,
55 const ParametricExercise& exercise,
56 std::vector<std::vector<Real> >& parameters,
57 const EndCriteria& endCriteria,
58 OptimizationMethod& method);
59
60}
61
62
63#endif
64
Criteria to end optimization process:
Definition: endcriteria.hpp:40
Abstract class for constrained optimization method.
Definition: method.hpp:36
virtual void guess(Size exerciseNumber, std::vector< Real > &parameters) const =0
virtual std::vector< Size > numberOfVariables() const =0
virtual std::vector< Size > numberOfParameters() const =0
virtual bool exercise(Size exerciseNumber, const std::vector< Real > &parameters, const std::vector< Real > &variables) const =0
virtual ~ParametricExercise()=default
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
Real genericEarlyExerciseOptimization(std::vector< std::vector< NodeData > > &simulationData, const ParametricExercise &exercise, std::vector< std::vector< Real > > &parameters, const EndCriteria &endCriteria, OptimizationMethod &method)
returns the biased estimate obtained while optimizing