final int nbPath = 12500;
final AnnuityCouponIborRatchetDefinition annuityRatchetIbor20Definition = AnnuityCouponIborRatchetDefinition.withFirstCouponIborGearing(SETTLEMENT_DATE, Period.ofYears(5), NOTIONAL, IBOR_INDEX,
IS_PAYER, MAIN_COEF, FLOOR_COEF, CAP_COEF, TARGET);
final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 8, 18);
final AnnuityCouponIborRatchet annuityRatchetIbor20 = annuityRatchetIbor20Definition.toDerivative(referenceDate, FIXING_TS, CURVES_NAMES);
HullWhiteMonteCarloMethod methodMC;
methodMC = new HullWhiteMonteCarloMethod(new NormalRandomNumberGenerator(0.0, 1.0, new MersenneTwister()), nbPath);
final CurrencyAmount[] pvMC = new CurrencyAmount[nbTest];
final InterestRateCurveSensitivity[] pvcsMC = new InterestRateCurveSensitivity[nbTest];
startTime = System.currentTimeMillis();
for (int looptest = 0; looptest < nbTest; looptest++) {
pvMC[looptest] = methodMC.presentValue(annuityRatchetIbor20, CUR, CURVES_NAMES[0], BUNDLE_HW);
}
endTime = System.currentTimeMillis();
System.out.println(nbTest + " pv Ratchet Ibor Hull-White MC method: " + (endTime - startTime) + " ms");
// Performance note: HW MC price (12500 paths): 9-Sep-11: On Mac Pro 3.2 GHz Quad-Core Intel Xeon: 490 ms for 10 Ratchet (20 coupons each).
startTime = System.currentTimeMillis();
for (int looptest = 0; looptest < nbTest; looptest++) {
pvcsMC[looptest] = methodMC.presentValueCurveSensitivity(annuityRatchetIbor20, CURVES_NAMES[0], BUNDLE_HW);
}
endTime = System.currentTimeMillis();
System.out.println(nbTest + " delta Ratchet Ibor Hull-White MC method: " + (endTime - startTime) + " ms");
// Performance note: HW MC delta (40 deltas - 12500 paths): 24-Oct-11: On Mac Pro 3.2 GHz Quad-Core Intel Xeon: 1325 ms for 10 Ratchet (20 coupons each).
startTime = System.currentTimeMillis();
for (int looptest = 0; looptest < nbTest; looptest++) {
pvMC[looptest] = methodMC.presentValue(annuityRatchetIbor20, CUR, CURVES_NAMES[0], BUNDLE_HW);
pvcsMC[looptest] = methodMC.presentValueCurveSensitivity(annuityRatchetIbor20, CURVES_NAMES[0], BUNDLE_HW);
}
endTime = System.currentTimeMillis();
System.out.println(nbTest + " pv/delta Ratchet Ibor Hull-White MC method: " + (endTime - startTime) + " ms");
// Performance note: HW MC price (12500 paths) - pv/delta: 31-Oct-11: On Mac Pro 3.2 GHz Quad-Core Intel Xeon: 1800 ms for 10 Ratchet (20 coupons each).
}