Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CreditSimulationParameters Class Reference

Credit simulation description. More...

#include <orea/aggregation/creditsimulationparameters.hpp>

+ Inheritance diagram for CreditSimulationParameters:
+ Collaboration diagram for CreditSimulationParameters:

Public Member Functions

 CreditSimulationParameters ()
 Default constructor. More...
 
Inspectors
const std::map< string, Matrix > & transitionMatrix () const
 
const std::vector< string > & entities () const
 
const std::vector< Array > & factorLoadings () const
 
const std::vector< string > & transitionMatrices () const
 
const std::vector< Size > & initialStates () const
 
bool marketRisk () const
 
bool creditRisk () const
 
bool zeroMarketPnl () const
 
const string & evaluation () const
 
bool doubleDefault () const
 
Size seed () const
 
Size paths () const
 
const std::string & creditMode () const
 
const std::string & loanExposureMode () const
 
const std::vector< string > & nettingSetIds () const
 
Setters
std::map< string, Matrix > & transitionMatrix ()
 
std::vector< string > & entities ()
 
std::vector< Array > & factorLoadings ()
 
std::vector< string > & transitionMatrices ()
 
std::vector< Size > & initialStates ()
 
boolmarketRisk ()
 
boolcreditRisk ()
 
boolzeroMarketPnl ()
 
string & evaluation ()
 
booldoubleDefault ()
 
Size & seed ()
 
Size & paths ()
 
std::string & creditMode ()
 
std::string & loanExposureMode ()
 
std::vector< string > & nettingSetIds ()
 
- Public Member Functions inherited from XMLSerializable
virtual ~XMLSerializable ()
 
virtual void fromXML (XMLNode *node)=0
 
virtual XMLNodetoXML (XMLDocument &doc) const=0
 
void fromFile (const std::string &filename)
 
void toFile (const std::string &filename) const
 
void fromXMLString (const std::string &xml)
 
std::string toXMLString () const
 

Serialisation

std::map< string, Matrix > transitionMatrix_
 \Equality Operators More...
 
std::vector< string > entities_
 
std::vector< Array > factorLoadings_
 
std::vector< string > transitionMatrices_
 
std::vector< Size > initialStates_
 
bool marketRisk_
 
bool creditRisk_
 
bool zeroMarketPnl_
 
string evaluation_
 
bool doubleDefault_
 
Size seed_
 
Size paths_
 
string creditMode_
 
string loanExposureMode_
 
std::vector< string > nettingSetIds_
 
virtual void fromXML (XMLNode *node)
 
virtual XMLNodetoXML (XMLDocument &doc) const
 

Detailed Description

Credit simulation description.

Definition at line 42 of file creditsimulationparameters.hpp.

Constructor & Destructor Documentation

◆ CreditSimulationParameters()

Default constructor.

Definition at line 45 of file creditsimulationparameters.hpp.

45{};

Member Function Documentation

◆ transitionMatrix() [1/2]

const std::map< string, Matrix > & transitionMatrix ( ) const

Definition at line 49 of file creditsimulationparameters.hpp.

49{ return transitionMatrix_; }
std::map< string, Matrix > transitionMatrix_
\Equality Operators
+ Here is the caller graph for this function:

◆ entities() [1/2]

const std::vector< string > & entities ( ) const

Definition at line 50 of file creditsimulationparameters.hpp.

◆ factorLoadings() [1/2]

const std::vector< Array > & factorLoadings ( ) const

Definition at line 51 of file creditsimulationparameters.hpp.

◆ transitionMatrices() [1/2]

const std::vector< string > & transitionMatrices ( ) const

Definition at line 52 of file creditsimulationparameters.hpp.

◆ initialStates() [1/2]

const std::vector< Size > & initialStates ( ) const

Definition at line 53 of file creditsimulationparameters.hpp.

◆ marketRisk() [1/2]

bool marketRisk ( ) const

◆ creditRisk() [1/2]

bool creditRisk ( ) const

◆ zeroMarketPnl() [1/2]

bool zeroMarketPnl ( ) const

◆ evaluation() [1/2]

const string & evaluation ( ) const

◆ doubleDefault() [1/2]

bool doubleDefault ( ) const

◆ seed() [1/2]

Size seed ( ) const

◆ paths() [1/2]

Size paths ( ) const

◆ creditMode() [1/2]

const std::string & creditMode ( ) const

◆ loanExposureMode() [1/2]

const std::string & loanExposureMode ( ) const

◆ nettingSetIds() [1/2]

const std::vector< string > & nettingSetIds ( ) const

Definition at line 63 of file creditsimulationparameters.hpp.

◆ transitionMatrix() [2/2]

std::map< string, Matrix > & transitionMatrix ( )

Definition at line 68 of file creditsimulationparameters.hpp.

68{ return transitionMatrix_; }

◆ entities() [2/2]

std::vector< string > & entities ( )

Definition at line 69 of file creditsimulationparameters.hpp.

69{ return entities_; }

◆ factorLoadings() [2/2]

std::vector< Array > & factorLoadings ( )

Definition at line 70 of file creditsimulationparameters.hpp.

70{ return factorLoadings_; }

◆ transitionMatrices() [2/2]

std::vector< string > & transitionMatrices ( )

Definition at line 71 of file creditsimulationparameters.hpp.

71{ return transitionMatrices_; }

◆ initialStates() [2/2]

std::vector< Size > & initialStates ( )

Definition at line 72 of file creditsimulationparameters.hpp.

72{ return initialStates_; }

◆ marketRisk() [2/2]

bool & marketRisk ( )

Definition at line 73 of file creditsimulationparameters.hpp.

73{ return marketRisk_; }

◆ creditRisk() [2/2]

bool & creditRisk ( )

Definition at line 74 of file creditsimulationparameters.hpp.

74{ return creditRisk_; }

◆ zeroMarketPnl() [2/2]

bool & zeroMarketPnl ( )

Definition at line 75 of file creditsimulationparameters.hpp.

75{ return zeroMarketPnl_; }

◆ evaluation() [2/2]

string & evaluation ( )

Definition at line 76 of file creditsimulationparameters.hpp.

76{ return evaluation_; }

◆ doubleDefault() [2/2]

bool & doubleDefault ( )

Definition at line 77 of file creditsimulationparameters.hpp.

77{ return doubleDefault_; }

◆ seed() [2/2]

Size & seed ( )

Definition at line 78 of file creditsimulationparameters.hpp.

78{ return seed_; }

◆ paths() [2/2]

Size & paths ( )

Definition at line 79 of file creditsimulationparameters.hpp.

79{ return paths_; }

◆ creditMode() [2/2]

std::string & creditMode ( )

Definition at line 80 of file creditsimulationparameters.hpp.

80{ return creditMode_; }

◆ loanExposureMode() [2/2]

std::string & loanExposureMode ( )

Definition at line 81 of file creditsimulationparameters.hpp.

81{ return loanExposureMode_; }

◆ nettingSetIds() [2/2]

std::vector< string > & nettingSetIds ( )

Definition at line 82 of file creditsimulationparameters.hpp.

82{ return nettingSetIds_; }

◆ fromXML()

void fromXML ( XMLNode node)
virtual

Implements XMLSerializable.

Definition at line 32 of file creditsimulationparameters.cpp.

32 {
33 XMLNode* sim = XMLUtils::locateNode(root, "CreditSimulation");
34 XMLNode* node = XMLUtils::getChildNode(sim, "TransitionMatrices");
35 QL_REQUIRE(node != nullptr, "CreditSimulationParameters: Node TransitionMatrices not found.");
36
37 node = XMLUtils::getChildNode(node, "TransitionMatrix");
38 while (node != nullptr) {
39 string name = XMLUtils::getChildValue(node, "Name", true);
40 std::vector<Real> data = XMLUtils::getChildrenValuesAsDoublesCompact(node, "Data", true);
41 Size n = static_cast<Size>(std::sqrt(data.size()));
42 QL_REQUIRE(data.size() == n * n, "CreditSimulationParameters: Square matrix required, found " << data.size()
43 << " elements");
44 Matrix m(n, n, 0.0);
45 for (Size i = 0; i < n; ++i) {
46 for (Size j = 0; j < n; ++j) {
47 m[i][j] = data[i * n + j];
48 }
49 }
51 node = XMLUtils::getNextSibling(node, "TransitionMatrix");
52 }
53
54 node = XMLUtils::getChildNode(sim, "Entities");
55 QL_REQUIRE(node != nullptr, "CreditSimulationparameters: Node Entities not found.");
56 node = XMLUtils::getChildNode(node, "Entity");
57 while (node != nullptr) {
58 string name = XMLUtils::getChildValue(node, "Name", true);
59 std::vector<Real> tmp = XMLUtils::getChildrenValuesAsDoublesCompact(node, "FactorLoadings", true);
60 Array loadings(tmp.begin(), tmp.end());
61 string transitionMatrix = XMLUtils::getChildValue(node, "TransitionMatrix", true);
62 Size initialState = XMLUtils::getChildValueAsInt(node, "InitialState", true);
63 entities_.push_back(name);
64 factorLoadings_.push_back(loadings);
66 initialStates_.push_back(initialState);
67 node = XMLUtils::getNextSibling(node, "Entity");
68 }
69
70 node = XMLUtils::getChildNode(sim, "Risk");
71 QL_REQUIRE(node != nullptr, "CreditSimulationParameters: Node Risk not found.");
72 marketRisk_ = XMLUtils::getChildValueAsBool(node, "Market", true);
73 creditRisk_ = XMLUtils::getChildValueAsBool(node, "Credit", true);
74 zeroMarketPnl_ = XMLUtils::getChildValueAsBool(node, "ZeroMarketPnl", true);
75 evaluation_ = XMLUtils::getChildValue(node, "Evaluation", true);
76 doubleDefault_ = XMLUtils::getChildValueAsBool(node, "DoubleDefault", true);
77 seed_ = XMLUtils::getChildValueAsInt(node, "Seed", true);
78 paths_ = XMLUtils::getChildValueAsInt(node, "Paths", true);
79 creditMode_ = XMLUtils::getChildValue(node, "CreditMode", true);
80 loanExposureMode_ = XMLUtils::getChildValue(node, "LoanExposureMode", true);
81
82 nettingSetIds_ = parseListOfValues(XMLUtils::getChildValue(sim, "NettingSetIds", true));
83}
const std::map< string, Matrix > & transitionMatrix() const
static XMLNode * locateNode(XMLNode *n, const string &name="")
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
static bool getChildValueAsBool(XMLNode *node, const string &name, bool mandatory=false, bool defaultValue=true)
static XMLNode * getChildNode(XMLNode *n, const string &name="")
static int getChildValueAsInt(XMLNode *node, const string &name, bool mandatory=false, int defaultValue=0)
static XMLNode * getNextSibling(XMLNode *node, const string &name="")
static vector< Real > getChildrenValuesAsDoublesCompact(XMLNode *node, const string &name, bool mandatory=false)
data
std::vector< string > parseListOfValues(string s, const char escape, const char delim, const char quote)
string name
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
virtual

Implements XMLSerializable.

Definition at line 85 of file creditsimulationparameters.cpp.

85 {
86 QL_FAIL("CreditSimulationParameters::toXML() not implemented");
87}

Member Data Documentation

◆ transitionMatrix_

std::map<string, Matrix> transitionMatrix_
private

\Equality Operators

Definition at line 98 of file creditsimulationparameters.hpp.

◆ entities_

std::vector<string> entities_
private

Definition at line 99 of file creditsimulationparameters.hpp.

◆ factorLoadings_

std::vector<Array> factorLoadings_
private

Definition at line 100 of file creditsimulationparameters.hpp.

◆ transitionMatrices_

std::vector<string> transitionMatrices_
private

Definition at line 101 of file creditsimulationparameters.hpp.

◆ initialStates_

std::vector<Size> initialStates_
private

Definition at line 102 of file creditsimulationparameters.hpp.

◆ marketRisk_

bool marketRisk_
private

Definition at line 103 of file creditsimulationparameters.hpp.

◆ creditRisk_

bool creditRisk_
private

Definition at line 104 of file creditsimulationparameters.hpp.

◆ zeroMarketPnl_

bool zeroMarketPnl_
private

Definition at line 105 of file creditsimulationparameters.hpp.

◆ evaluation_

string evaluation_
private

Definition at line 106 of file creditsimulationparameters.hpp.

◆ doubleDefault_

bool doubleDefault_
private

Definition at line 107 of file creditsimulationparameters.hpp.

◆ seed_

Size seed_
private

Definition at line 108 of file creditsimulationparameters.hpp.

◆ paths_

Size paths_
private

Definition at line 108 of file creditsimulationparameters.hpp.

◆ creditMode_

string creditMode_
private

Definition at line 109 of file creditsimulationparameters.hpp.

◆ loanExposureMode_

string loanExposureMode_
private

Definition at line 110 of file creditsimulationparameters.hpp.

◆ nettingSetIds_

std::vector<string> nettingSetIds_
private

Definition at line 111 of file creditsimulationparameters.hpp.