File: ContinuationValueBase.h

package info (click to toggle)
stopt 6.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,264 kB
  • sloc: cpp: 75,778; python: 6,012; makefile: 72; sh: 57
file content (63 lines) | stat: -rw-r--r-- 2,208 bytes parent folder | download | duplicates (3)
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
// Copyright (C) 2023 EDF
// All Rights Reserved
// This code is published under the GNU Lesser General Public License (GNU LGPL)
#ifndef CONTINUATIONVALUEBASE_H
#define CONTINUATIONVALUEBASE_H
#include <iostream>
#include <Eigen/Dense>
#include "StOpt/core/grids/SpaceGrid.h"

/** \file ContinuationValueBase.h
 *  \brief Base object for  continuation values objects  both deterministic and stochastic
 *  \author Xavier Warin
 */

namespace StOpt
{
///  \class ContinuationValueBase ContinuationValue.h
/// Base class for continuation object
class ContinuationValueBase
{
protected :
    std::shared_ptr< SpaceGrid >    m_grid ; ///< grid used to define stock points

public :
    /// \brief Default constructor
    ContinuationValueBase() {}

    /// \brief Constructor
    /// \param p_grid   grid for stocks
    ContinuationValueBase(const  std::shared_ptr< SpaceGrid >   &p_grid) :
        m_grid(p_grid)
    {}

    /// \brief Get all simulations conditional expectation
    /// \param p_ptOfStock   grid point for interpolation
    /// \return the continuation value associated to each simulation used in optimization
    virtual Eigen::ArrayXd getAllSimulations(const Eigen::ArrayXd &p_ptOfStock) const = 0;

    /// \brief Same as before but use an interpolator
    virtual Eigen::ArrayXd getAllSimulations(const Interpolator   &p_interpol) const = 0;

    /// \brief Get continuation vale  for a simulation
    /// \param p_isim    simulation number
    /// \param  p_ptOfStock     stock points
    /// \return the continuation value associated to the given simulation used in optimization
    virtual double  getASimulation(const int &p_isim, const Eigen::ArrayXd &p_ptOfStock) const = 0;


    /// \brief Same as before but use an interpolator
    /// \param p_isim         simulation number
    /// \param p_interpol     interpolator
    /// \return the continuation value associated to the given simulation used in optimization
    virtual double  getASimulation(const int &p_isim, const Interpolator   &p_interpol) const = 0;

    virtual std::shared_ptr< SpaceGrid > getGrid() const = 0;

    virtual inline int getNbSimul() const = 0;
    ///@}

};
}
#endif  /* CONTINUATIONVALUEBASE_H */