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

Scenario generator that generates an entire path. More...

#include <orea/scenario/scenariogenerator.hpp>

+ Inheritance diagram for ScenarioPathGenerator:
+ Collaboration diagram for ScenarioPathGenerator:

Public Member Functions

 ScenarioPathGenerator (Date today, const vector< Date > &dates, TimeGrid timeGrid)
 Constructor. More...
 
virtual QuantLib::ext::shared_ptr< Scenarionext (const Date &d) override
 Return the next scenario for the given date. More...
 
- Public Member Functions inherited from ScenarioGenerator
virtual ~ScenarioGenerator ()
 Default destructor. More...
 
virtual QuantLib::ext::shared_ptr< Scenarionext (const Date &d)=0
 Return the next scenario for the given date. More...
 
virtual void reset ()=0
 Reset the generator so calls to next() return the first scenario. More...
 

Protected Member Functions

virtual std::vector< QuantLib::ext::shared_ptr< Scenario > > nextPath ()=0
 

Protected Attributes

Date today_
 
vector< Date > dates_
 
Size pathStep_
 
TimeGrid timeGrid_
 
std::vector< QuantLib::ext::shared_ptr< Scenario > > path_
 

Detailed Description

Scenario generator that generates an entire path.

Definition at line 58 of file scenariogenerator.hpp.

Constructor & Destructor Documentation

◆ ScenarioPathGenerator()

ScenarioPathGenerator ( Date  today,
const vector< Date > &  dates,
TimeGrid  timeGrid 
)

Constructor.

Parameters
todayToday's date
datesFuture evaluation dates
timeGridAssociated time grid

Definition at line 62 of file scenariogenerator.hpp.

68 : today_(today), dates_(dates), timeGrid_(timeGrid) { // dayCounter_(dayCounter) {
69 QL_REQUIRE(dates.size() > 0, "empty date vector passed");
70 QL_REQUIRE(dates.front() > today, "date grid must start in the future");
71 }

Member Function Documentation

◆ next()

virtual QuantLib::ext::shared_ptr< Scenario > next ( const Date &  d)
overridevirtual

Return the next scenario for the given date.

Implements ScenarioGenerator.

Definition at line 73 of file scenariogenerator.hpp.

73 {
74 if (d == dates_.front()) { // new path
75 path_ = nextPath();
76 pathStep_ = 0;
77 }
78 QL_REQUIRE(pathStep_ < dates_.size(), "step mismatch");
79 if(d == dates_[pathStep_]){
80 return path_[pathStep_++]; // post increment
81 } else{
82 auto it = std::find(dates_.begin(), dates_.end(), d);
83 QL_REQUIRE(it != dates_.end(), "invalid date " << d);
84 return path_[std::distance(dates_.begin(), it)];
85 }
86 }
virtual std::vector< QuantLib::ext::shared_ptr< Scenario > > nextPath()=0
std::vector< QuantLib::ext::shared_ptr< Scenario > > path_
+ Here is the call graph for this function:

◆ nextPath()

virtual std::vector< QuantLib::ext::shared_ptr< Scenario > > nextPath ( )
protectedpure virtual

Implemented in CrossAssetModelScenarioGenerator, and LgmScenarioGenerator.

+ Here is the caller graph for this function:

Member Data Documentation

◆ today_

Date today_
protected

Definition at line 91 of file scenariogenerator.hpp.

◆ dates_

vector<Date> dates_
protected

Definition at line 92 of file scenariogenerator.hpp.

◆ pathStep_

Size pathStep_
protected

Definition at line 93 of file scenariogenerator.hpp.

◆ timeGrid_

TimeGrid timeGrid_
protected

Definition at line 95 of file scenariogenerator.hpp.

◆ path_

std::vector<QuantLib::ext::shared_ptr<Scenario> > path_
protected

Definition at line 96 of file scenariogenerator.hpp.