Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
calibrationconfiguration.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file ored/model/calibrationconfiguration.hpp
20 \brief class for holding calibration configuration details
21 \ingroup models
22*/
23
24#pragma once
25
27#include <ql/types.hpp>
28#include <ql/math/optimization/constraint.hpp>
29#include <map>
30
31namespace ore {
32namespace data {
33
34/*! Class for holding calibration configuration details.
35 \todo Possibly add information about optimisation method, optimisation parameters and end criteria.
36 \ingroup models
37*/
39public:
40 //! Constructor
41 CalibrationConfiguration(QuantLib::Real rmseTolerance = 0.0001,
42 QuantLib::Size maxIterations = 50);
43
44 //! \name Inspectors
45 //@{
46 //! A final tolerance on the RMSE of the calibration that may be used by various builders.
47 QuantLib::Real rmseTolerance() const;
48
49 /*! High level maximum iterations. This may mean different to things to different builders. This is not the
50 maximum number of iterations used by the EndCriteria for optimisation. If this is needed, this should be added
51 in another XML object along with the other EndCriteria elements and included as a CalibrationConfiguration
52 member.
53 */
54 QuantLib::Size maxIterations() const;
55
56 /*! Return constraint for the parameter \p name.
57
58 Currently, only boundary constraints are supported. If the parameter \name does not have a constraint, a
59 NoConstraint instance is returned.
60 */
61 QuantLib::ext::shared_ptr<QuantLib::Constraint> constraint(const std::string& name) const;
62
63 /*! Return the boundaries for the parameter \p name.
64
65 If no boundaries have been given for parameter \p name, a pair with both elements set to Null<Real>() is
66 returned.
67 */
68 std::pair<QuantLib::Real, QuantLib::Real> boundaries(const std::string& name) const;
69 //@}
70
71 /*! Add a boundary constraint on the parameter \p name.
72 */
73 void add(const std::string& name, QuantLib::Real lowerBound, QuantLib::Real upperBound);
74
75 //! \name Serialisation
76 //@{
77 void fromXML(XMLNode* node) override;
78 XMLNode* toXML(XMLDocument& doc) const override;
79 //@}
80
81protected:
82 QuantLib::Real rmseTolerance_;
83 QuantLib::Size maxIterations_;
84 std::map<std::string, std::pair<QuantLib::Real, QuantLib::Real>> constraints_;
85};
86
87
88}
89}
QuantLib::Real rmseTolerance() const
A final tolerance on the RMSE of the calibration that may be used by various builders.
QuantLib::ext::shared_ptr< QuantLib::Constraint > constraint(const std::string &name) const
std::map< std::string, std::pair< QuantLib::Real, QuantLib::Real > > constraints_
std::pair< QuantLib::Real, QuantLib::Real > boundaries(const std::string &name) const
XMLNode * toXML(XMLDocument &doc) const override
void add(const std::string &name, QuantLib::Real lowerBound, QuantLib::Real upperBound)
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
string name
XML utility functions.