Interface FiniteDifferenceInternalStateConstraint
- All Known Subinterfaces:
FiniteDifferenceConstrainedProduct
- All Known Implementing Classes:
BarrierOption, DigitalBarrierOption, DoubleBarrierBinaryOption, DoubleBarrierOption, TouchOption
public interface FiniteDifferenceInternalStateConstraint
Optional product-side internal state constraint for finite-difference
solvers.
This interface is intended for products whose value is constrained not only at the outer PDE boundaries, but also on an internal subset of the state space. Typical examples are barrier options, where nodes beyond the barrier are knocked out and must be assigned a prescribed value.
The solver may query this interface at each grid node and time step:
isConstraintActive(double, double...)tells whether the node is constrained,getConstrainedValue(double, double...)provides the value to impose there.
Time is given in running time, consistently with the boundary framework.
- Author:
- Alessandro Gnoatto
-
Method Summary
Modifier and TypeMethodDescriptiondoublegetConstrainedValue(double time, double... stateVariables) Returns the value to impose at a constrained node.booleanisConstraintActive(double time, double... stateVariables) Returns true if the internal constraint is active at the given node and time.
-
Method Details
-
isConstraintActive
boolean isConstraintActive(double time, double... stateVariables) Returns true if the internal constraint is active at the given node and time.- Parameters:
time- Running time.stateVariables- State variables at the grid node.- Returns:
- True if the node is constrained.
-
getConstrainedValue
double getConstrainedValue(double time, double... stateVariables) Returns the value to impose at a constrained node.This method is called only if
isConstraintActive(double, double...)returns true.- Parameters:
time- Running time.stateVariables- State variables at the grid node.- Returns:
- The constrained value.
-