Skip to content

Commit

Permalink
MLMC example problem
Browse files Browse the repository at this point in the history
  • Loading branch information
piers-hinds committed May 2, 2023
1 parent ce6ab46 commit b907976
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions sde_mc/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ def default_params(cls, steps, device):
return LevyRainbow(1, 1, 0.5, 2, 0.02, 0.3, 0.2, 0.001, 2, 1, 1, 3, steps, device)


class LevyRainbowMLMC(Problem):
def __init__(self, c_minus, c_plus, alpha, mu, r, sigma, f, epsilon, dim, spot, strike, maturity, steps, device):
if not torch.is_tensor(spot):
spot = torch.ones(dim) * spot
exptest = ExpExampleLevy(c_minus, c_plus, alpha, mu, r, sigma, f, epsilon, dim)
expsde = LevySde(exptest, spot, device=device)
solver = JumpEulerSolver(expsde, maturity, steps, device=device, exact_jumps=True)
csr = ConstantShortRate(r)
option = Rainbow(strike)
super().__init__(solver, csr, option)

@classmethod
def default_params(cls, steps, device):
return LevyRainbow(1, 1, 0.5, 2, 0.02, 0.3, 0.2, 0.001, 2, 1, 1, 3, steps, device)


class LevyCall(Problem):
def __init__(self, c_minus, c_plus, alpha, mu, r, sigma, f, epsilon, spot, strike, maturity, steps, device):
chol_corr = torch.tensor([[1.]], device=device)
Expand Down

0 comments on commit b907976

Please sign in to comment.