Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
LinkableCalibratedModel Class Reference

Calibrated model class with linkable parameters. More...

#include <qle/models/linkablecalibratedmodel.hpp>

+ Inheritance diagram for LinkableCalibratedModel:
+ Collaboration diagram for LinkableCalibratedModel:

Classes

class  PrivateConstraint
 Linkable Calibrated Model. More...
 

Public Member Functions

 LinkableCalibratedModel ()
 
void update () override
 
virtual void calibrate (const std::vector< QuantLib::ext::shared_ptr< CalibrationHelper > > &, OptimizationMethod &method, const EndCriteria &endCriteria, const Constraint &constraint=Constraint(), const std::vector< Real > &weights=std::vector< Real >(), const std::vector< bool > &fixParameters=std::vector< bool >())
 Calibrate to a set of market instruments (usually caps/swaptions) More...
 
virtual void calibrate (const std::vector< QuantLib::ext::shared_ptr< BlackCalibrationHelper > > &, OptimizationMethod &method, const EndCriteria &endCriteria, const Constraint &constraint=Constraint(), const std::vector< Real > &weights=std::vector< Real >(), const std::vector< bool > &fixParameters=std::vector< bool >())
 for backward compatibility More...
 
Real value (const Array &params, const std::vector< QuantLib::ext::shared_ptr< CalibrationHelper > > &)
 
Real value (const Array &params, const std::vector< QuantLib::ext::shared_ptr< BlackCalibrationHelper > > &)
 for backward compatibility More...
 
const QuantLib::ext::shared_ptr< Constraint > & constraint () const
 
EndCriteria::Type endCriteria () const
 Returns end criteria result. More...
 
const Array & problemValues () const
 Returns the problem values. More...
 
Array params () const
 Returns array of arguments on which calibration is done. More...
 
virtual void setParams (const Array &params)
 
virtual void setParam (Size idx, const Real value)
 

Protected Member Functions

virtual void generateArguments ()
 

Protected Attributes

std::vector< QuantLib::ext::shared_ptr< Parameter > > arguments_
 
QuantLib::ext::shared_ptr< Constraintconstraint_
 
EndCriteria::Type endCriteria_
 
Array problemValues_
 

Friends

class CalibrationFunction
 

Detailed Description

Calibrated model class with linkable parameters.

Definition at line 40 of file linkablecalibratedmodel.hpp.

Constructor & Destructor Documentation

◆ LinkableCalibratedModel()

Definition at line 30 of file linkablecalibratedmodel.cpp.

31 : constraint_(new PrivateConstraint(arguments_)), endCriteria_(EndCriteria::None) {}
std::vector< QuantLib::ext::shared_ptr< Parameter > > arguments_
QuantLib::ext::shared_ptr< Constraint > constraint_

Member Function Documentation

◆ update()

void update ( )
override

Definition at line 44 of file linkablecalibratedmodel.hpp.

44 {
46 notifyObservers();
47 }
+ Here is the call graph for this function:

◆ calibrate() [1/2]

virtual void calibrate ( const std::vector< QuantLib::ext::shared_ptr< CalibrationHelper > > &  ,
OptimizationMethod method,
const EndCriteria &  endCriteria,
const Constraint constraint = Constraint(),
const std::vector< Real > &  weights = std::vector< Real >(),
const std::vector< bool > &  fixParameters = std::vector< bool >() 
)
virtual

Calibrate to a set of market instruments (usually caps/swaptions)

An additional constraint can be passed which must be satisfied in addition to the constraints of the model.

+ Here is the caller graph for this function:

◆ calibrate() [2/2]

virtual void calibrate ( const std::vector< QuantLib::ext::shared_ptr< BlackCalibrationHelper > > &  ,
OptimizationMethod method,
const EndCriteria &  endCriteria,
const Constraint constraint = Constraint(),
const std::vector< Real > &  weights = std::vector< Real >(),
const std::vector< bool > &  fixParameters = std::vector< bool >() 
)
virtual

for backward compatibility

◆ value() [1/2]

Real value ( const Array &  params,
const std::vector< QuantLib::ext::shared_ptr< CalibrationHelper > > &   
)
+ Here is the caller graph for this function:

◆ value() [2/2]

Real value ( const Array &  params,
const std::vector< QuantLib::ext::shared_ptr< BlackCalibrationHelper > > &  instruments 
)

for backward compatibility

Definition at line 109 of file linkablecalibratedmodel.cpp.

110 {
111 vector<ext::shared_ptr<CalibrationHelper> > tmp(instruments.size());
112 for (Size i = 0; i < instruments.size(); ++i)
113 tmp[i] = ext::static_pointer_cast<CalibrationHelper>(instruments[i]);
114 return value(params, tmp);
115}
Array params() const
Returns array of arguments on which calibration is done.
Real value(const Array &params, const std::vector< QuantLib::ext::shared_ptr< CalibrationHelper > > &)
+ Here is the call graph for this function:

◆ constraint()

const QuantLib::ext::shared_ptr< Constraint > & constraint ( ) const
+ Here is the caller graph for this function:

◆ endCriteria()

EndCriteria::Type endCriteria ( ) const

Returns end criteria result.

Definition at line 72 of file linkablecalibratedmodel.hpp.

72{ return endCriteria_; }
+ Here is the caller graph for this function:

◆ problemValues()

const Array & problemValues ( ) const

Returns the problem values.

Definition at line 75 of file linkablecalibratedmodel.hpp.

◆ params()

Array params ( ) const

Returns array of arguments on which calibration is done.

Definition at line 124 of file linkablecalibratedmodel.cpp.

124 {
125 Size size = 0, i;
126 for (i = 0; i < arguments_.size(); i++)
127 size += arguments_[i]->size();
128 Array params(size);
129 Size k = 0;
130 for (i = 0; i < arguments_.size(); i++) {
131 for (Size j = 0; j < arguments_[i]->size(); j++, k++) {
132 params[k] = arguments_[i]->params()[j];
133 }
134 }
135 return params;
136}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setParams()

void setParams ( const Array &  params)
virtual

Definition at line 138 of file linkablecalibratedmodel.cpp.

138 {
139 Array::const_iterator p = params.begin();
140 for (Size i = 0; i < arguments_.size(); ++i) {
141 for (Size j = 0; j < arguments_[i]->size(); ++j, ++p) {
142 QL_REQUIRE(p != params.end(), "parameter array too small");
143 arguments_[i]->setParam(j, *p);
144 }
145 }
146 QL_REQUIRE(p == params.end(), "parameter array too big!");
148 notifyObservers();
149}
+ Here is the call graph for this function:

◆ setParam()

void setParam ( Size  idx,
const Real  value 
)
virtual

Definition at line 151 of file linkablecalibratedmodel.cpp.

151 {
152 int tmp = static_cast<int>(idx);
153 for (Size i = 0; i < arguments_.size(); ++i) {
154 for (Size j = 0; j < arguments_[i]->size(); ++j) {
155 if (tmp-- == 0)
156 arguments_[i]->setParam(j, value);
157 }
158 }
160 notifyObservers();
161}
+ Here is the call graph for this function:

◆ generateArguments()

virtual void generateArguments ( )
protectedvirtual

Reimplemented in CommoditySchwartzModel, CrCirpp, CrossAssetModel, HwModel, and LinearGaussMarkovModel.

Definition at line 84 of file linkablecalibratedmodel.hpp.

84{}
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ CalibrationFunction

friend class CalibrationFunction
friend

Definition at line 95 of file linkablecalibratedmodel.hpp.

Member Data Documentation

◆ arguments_

std::vector<QuantLib::ext::shared_ptr<Parameter> > arguments_
protected

Definition at line 85 of file linkablecalibratedmodel.hpp.

◆ constraint_

QuantLib::ext::shared_ptr<Constraint> constraint_
protected

Definition at line 86 of file linkablecalibratedmodel.hpp.

◆ endCriteria_

EndCriteria::Type endCriteria_
protected

Definition at line 87 of file linkablecalibratedmodel.hpp.

◆ problemValues_

Array problemValues_
protected

Definition at line 88 of file linkablecalibratedmodel.hpp.