File: FinalValueFictitiousFunction.py

package info (click to toggle)
stopt 5.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,772 kB
  • sloc: cpp: 70,373; python: 5,942; makefile: 67; sh: 57
file content (24 lines) | stat: -rw-r--r-- 737 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
# Copyright (C) 2016 EDF
# All Rights Reserved
# This code is published under the GNU Lesser General Public License (GNU LGPL)
# Final value function for swings in multidimensionnal case


# final function payoff for a fictitious swing
class FinalValueFictitiousFunction:
    
    # Constructor
    def __init__(self, p_pay, p_nExerc):
        
        self.m_pay = p_pay
        self.m_nExerc = p_nExerc
        
    # final function
    # p_ireg   regime number
    # p_stock  position in the stock
    # p_state  position in the stochastic state
    def set(self, ireg, p_stock, p_state):
        
        idec = len(p_stock) * self.m_nExerc - p_stock.sum()
        
        return min(idec, len(p_stock)) * self.m_pay.apply(p_state)