1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
// Copyright (C) 2019 EDF
// All Rights Reserved
// This code is published under the GNU Lesser General Public License (GNU LGPL)
#ifndef STATETREESTOCKS_H
#define STATETREESTOCKS_H
#include<Eigen/Dense>
/** \file StateWithStocks.h
* \brief Permits to define a state containing
* - a stock position
* - a realisation of the non controlled stochastic state defined on a tree and identified by the index of the node in tree
*/
namespace StOpt
{
/// \class StateTreeStocks StateTreeStocks.h
/// State class dealing with regime, stock and uncertainty
class StateTreeStocks
{
private :
Eigen::ArrayXd m_ptStock ; ///< Stock point (on the grid)
int m_stochasticRealisation ; ///< uncertainty realization (index in tree)
int m_regime ; ///<regime number
public :
/// \brief Default Constructor
StateTreeStocks() {}
/// \brief main constructor
StateTreeStocks(const int &p_regime, const Eigen::ArrayXd &p_ptStock, const int &p_stochasticRealisation):
m_ptStock(p_ptStock), m_stochasticRealisation(p_stochasticRealisation), m_regime(p_regime) {}
/// \brief accessor
///@{
inline const Eigen::ArrayXd &getPtStock() const
{
return m_ptStock;
}
inline double getPtOneStock(const int &p_iStock) const
{
return m_ptStock(p_iStock);
}
inline int getStockSize() const
{
return m_ptStock.size();
}
inline const int &getStochasticRealization() const
{
return m_stochasticRealisation;
}
inline int getRegime() const
{
return m_regime;
}
inline void setPtStock(const Eigen::ArrayXd &p_ptStock)
{
m_ptStock = p_ptStock;
}
inline void setPtOneStock(const int &p_istock, const double &p_ptStockValue)
{
m_ptStock(p_istock) = p_ptStockValue;
}
inline void addToOneStock(const int &p_istock, const double &p_ptStockValue)
{
m_ptStock(p_istock) += p_ptStockValue;
}
inline void setStochasticRealization(const int &p_stochasticRealisation)
{
m_stochasticRealisation = p_stochasticRealisation;
}
inline void setRegime(const int &p_regime)
{
m_regime = p_regime;
}
///@}
};
}
#endif /* STATETREESTOCKS_H */
|