Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
onedimsolverconfig.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 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/configuration/onedimsolverconfig.hpp
20 \brief Class for holding 1-D solver configuration
21 \ingroup configuration
22*/
23
24#pragma once
25
28#include <ql/utilities/null.hpp>
29
30namespace ore {
31namespace data {
32
33/*! Serializable 1-D solver configuration
34 \ingroup configuration
35*/
37public:
38 //! Default constructor with everything \c QuantLib::Null
40
41 //! Constructor for max min based solver configuration
43 QuantLib::Real initialGuess,
44 QuantLib::Real accuracy,
45 const std::pair<QuantLib::Real, QuantLib::Real>& minMax,
46 QuantLib::Real lowerBound = QuantLib::Null<QuantLib::Real>(),
47 QuantLib::Real upperBound = QuantLib::Null<QuantLib::Real>());
48
49 //! Constructor for step based solver configuration
51 QuantLib::Real initialGuess,
52 QuantLib::Real accuracy,
53 QuantLib::Real step,
54 QuantLib::Real lowerBound = QuantLib::Null<QuantLib::Real>(),
55 QuantLib::Real upperBound = QuantLib::Null<QuantLib::Real>());
56
57 //! \name XMLSerializable interface
58 //@{
59 void fromXML(ore::data::XMLNode* node) override;
61 //@}
62
63 //! \name Inspectors
64 //@{
65 QuantLib::Size maxEvaluations() const { return maxEvaluations_; }
66 QuantLib::Real initialGuess() const { return initialGuess_; }
67 QuantLib::Real accuracy() const { return accuracy_; }
68 const std::pair<QuantLib::Real, QuantLib::Real>& minMax() const { return minMax_; }
69 QuantLib::Real step() const { return step_; }
70 QuantLib::Real lowerBound() const { return lowerBound_; }
71 QuantLib::Real upperBound() const { return upperBound_; }
72 //@}
73
74 //! Return \c true if default constructed and not populated i.e. no useful configuration.
75 bool empty() const { return empty_; }
76
77 //! Conversion to QuantExt::Solver1DOptions
78 operator QuantExt::Solver1DOptions() const;
79
80private:
81 QuantLib::Size maxEvaluations_;
82 QuantLib::Real initialGuess_;
83 QuantLib::Real accuracy_;
84 std::pair<QuantLib::Real, QuantLib::Real> minMax_;
85 QuantLib::Real step_;
86 QuantLib::Real lowerBound_;
87 QuantLib::Real upperBound_;
88
89 // Set to false if members are initialised.
90 bool empty_;
91
92 //! Basic checks
93 void check() const;
94};
95
96}
97}
OneDimSolverConfig()
Default constructor with everything QuantLib::Null.
OneDimSolverConfig(QuantLib::Size maxEvaluations, QuantLib::Real initialGuess, QuantLib::Real accuracy, const std::pair< QuantLib::Real, QuantLib::Real > &minMax, QuantLib::Real lowerBound=QuantLib::Null< QuantLib::Real >(), QuantLib::Real upperBound=QuantLib::Null< QuantLib::Real >())
Constructor for max min based solver configuration.
void check() const
Basic checks.
QuantLib::Real accuracy() const
void fromXML(ore::data::XMLNode *node) override
bool empty() const
Return true if default constructed and not populated i.e. no useful configuration.
QuantLib::Real upperBound() const
QuantLib::Real lowerBound() const
std::pair< QuantLib::Real, QuantLib::Real > minMax_
const std::pair< QuantLib::Real, QuantLib::Real > & minMax() const
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
QuantLib::Real initialGuess() const
QuantLib::Size maxEvaluations() const
OneDimSolverConfig(QuantLib::Size maxEvaluations, QuantLib::Real initialGuess, QuantLib::Real accuracy, QuantLib::Real step, QuantLib::Real lowerBound=QuantLib::Null< QuantLib::Real >(), QuantLib::Real upperBound=QuantLib::Null< QuantLib::Real >())
Constructor for step based solver configuration.
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
XML utility functions.