24#ifndef quantext_calibrated_model_hpp
25#define quantext_calibrated_model_hpp
27#include <ql/math/optimization/endcriteria.hpp>
28#include <ql/math/optimization/method.hpp>
29#include <ql/models/calibrationhelper.hpp>
30#include <ql/models/parameter.hpp>
31#include <ql/option.hpp>
32#include <ql/patterns/observable.hpp>
55 const std::vector<Real>& weights = std::vector<Real>(),
56 const std::vector<bool>& fixParameters = std::vector<bool>());
61 const std::vector<Real>& weights = std::vector<Real>(),
62 const std::vector<bool>& fixParameters = std::vector<bool>());
64 Real
value(
const Array&
params,
const std::vector<QuantLib::ext::shared_ptr<CalibrationHelper> >&);
67 Real
value(
const Array&
params,
const std::vector<QuantLib::ext::shared_ptr<BlackCalibrationHelper> >&);
69 const QuantLib::ext::shared_ptr<Constraint>&
constraint()
const;
85 std::vector<QuantLib::ext::shared_ptr<Parameter> >
arguments_;
103 class Impl :
public Constraint::Impl {
105 Impl(
const std::vector<QuantLib::ext::shared_ptr<Parameter> >& arguments) :
arguments_(arguments) {}
109 for (Size i = 0; i <
arguments_.size(); i++) {
111 Array testParams(size);
112 for (Size j = 0; j < size; j++, k++)
113 testParams[j] =
params[k];
123 for (Size i = 0; i <
arguments_.size(); i++) {
126 Array result(totalSize);
127 for (Size i = 0; i <
arguments_.size(); i++) {
129 Array partialParams(size);
130 for (Size j = 0; j < size; j++, k++)
131 partialParams[j] =
params[k];
132 Array tmpBound =
arguments_[i]->constraint().upperBound(partialParams);
133 for (Size j = 0; j < size; j++, k2++)
134 result[k2] = tmpBound[j];
142 for (Size i = 0; i <
arguments_.size(); i++) {
145 Array result(totalSize);
146 for (Size i = 0; i <
arguments_.size(); i++) {
148 Array partialParams(size);
149 for (Size j = 0; j < size; j++, k++)
150 partialParams[j] =
params[k];
151 Array tmpBound =
arguments_[i]->constraint().lowerBound(partialParams);
152 for (Size j = 0; j < size; j++, k2++)
153 result[k2] = tmpBound[j];
159 const std::vector<QuantLib::ext::shared_ptr<Parameter> >&
arguments_;
bool test(const Array ¶ms) const override
Array lowerBound(const Array ¶ms) const override
Array upperBound(const Array ¶ms) const override
Impl(const std::vector< QuantLib::ext::shared_ptr< Parameter > > &arguments)
const std::vector< QuantLib::ext::shared_ptr< Parameter > > & arguments_
Linkable Calibrated Model.
PrivateConstraint(const std::vector< QuantLib::ext::shared_ptr< Parameter > > &arguments)
Calibrated model class with linkable parameters.
const Array & problemValues() const
Returns the problem values.
virtual void generateArguments()
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
const QuantLib::ext::shared_ptr< Constraint > & constraint() const
Array params() const
Returns array of arguments on which calibration is done.
EndCriteria::Type endCriteria() const
Returns end criteria result.
friend class CalibrationFunction
virtual void setParam(Size idx, const Real value)
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)
std::vector< QuantLib::ext::shared_ptr< Parameter > > arguments_
QuantLib::ext::shared_ptr< Constraint > constraint_
LinkableCalibratedModel()
EndCriteria::Type endCriteria_
Real value(const Array ¶ms, const std::vector< QuantLib::ext::shared_ptr< CalibrationHelper > > &)
virtual void setParams(const Array ¶ms)