/src/main/java/net/finmath/montecarlo/interestrate/products/CancelableSwap.java
values = valueIfExcercised.add( payoff) ;
values = values.add ( payoff ) ;
final double swaprate = swaprates[period]; final RandomVariable libor = model.getForwardRate(fixingDate, fixingDate, fixingDate+periodLength); final RandomVariable numeraire = model.getNumeraire(paymentDate); final RandomVariable monteCarloProbabilities = model.getMonteCarloWeights(paymentDate); RandomVariable payoff = libor.sub(swaprate).mult(periodLength).mult(notional); payoff = payoff.div(numeraire).mult(monteCarloProbabilities); <extra_id_0> if(isPeriodStartDateExerciseDate[period]) { final ConditionalExpectationEstimator condExpEstimator = getConditionalExpectationEstimator(period, model); final RandomVariable valueIfExcercised = condExpEstimator.getConditionalExpectation(values); values = valueIfExcercised.choose(values, new Scalar(0.0)); } }