* To check the precision, increase the NB_INTEGRATION to 50 (slower but more precise).
*/
public void approximationNumericalIntegrationGrid() {
final G2ppPiecewiseConstantParameters parametersG2pp = TestsDataSetG2pp.createG2ppParameters3();
final G2ppProviderDiscount bundleG2pp = new G2ppProviderDiscount(MULTICURVES, parametersG2pp, CUR);
final GeneratorSwapFixedIbor generator = GENERATOR_SWAP_MASTER.getGenerator("EUR1YEURIBOR6M", CALENDAR);
final Period[] expiry = new Period[] {Period.ofMonths(6), Period.ofYears(1), Period.ofYears(2), Period.ofYears(5), Period.ofYears(10), Period.ofYears(25)};
final int nbExpiry = expiry.length;
final Period[] tenor = new Period[] {Period.ofYears(2), Period.ofYears(5), Period.ofYears(10), Period.ofYears(25)};
final int nbTenor = tenor.length;
final double[] fixedRate = new double[] {0.01, 0.02, 0.025, 0.03, 0.04};
final int nbStrike = fixedRate.length;
final SwaptionPhysicalFixedIbor[][][] swaption = new SwaptionPhysicalFixedIbor[nbExpiry][nbTenor][nbStrike];
final ZonedDateTime[] expiryDate = new ZonedDateTime[nbExpiry];
final ZonedDateTime[] settleDate = new ZonedDateTime[nbExpiry];
for (int loopexp = 0; loopexp < nbExpiry; loopexp++) {
expiryDate[loopexp] = ScheduleCalculator.getAdjustedDate(REFERENCE_DATE, expiry[loopexp], generator.getIborIndex(), CALENDAR);
settleDate[loopexp] = ScheduleCalculator.getAdjustedDate(expiryDate[loopexp], generator.getSpotLag(), CALENDAR);
for (int loopten = 0; loopten < nbTenor; loopten++) {
for (int loopstrike = 0; loopstrike < nbStrike; loopstrike++) {
final SwapFixedIborDefinition swapDefinition = SwapFixedIborDefinition.from(settleDate[loopexp], tenor[loopten], generator, 10000.0, fixedRate[loopstrike], true);
final SwaptionPhysicalFixedIborDefinition swaptionDefinition = SwaptionPhysicalFixedIborDefinition.from(expiryDate[loopexp], swapDefinition, true);
swaption[loopexp][loopten][loopstrike] = swaptionDefinition.toDerivative(REFERENCE_DATE);