Buggy code:
public class BOBYQAOptimizerTest { static final int DIM = 13 ; @ Test ( expected = NumberIsTooLargeException . class ) public void testInitOutOfBounds ( ) { } @ Test ( expected = DimensionMismatchException . class ) public void testBoundariesDimensionMismatch ( ) { } @ Test ( expected = NumberIsTooSmallException . class ) public void testProblemDimensionTooSmall ( ) { } @ Test ( expected = TooManyEvaluationsException . class ) public void testMaxEvaluations ( ) { } @ Test public void testRosen ( ) { } @ Test public void testMaximize ( ) { } @ Test public void testEllipse ( ) { } @ Test public void testElliRotated ( ) { } @ Test public void testCigar ( ) { } @ Test public void testTwoAxes ( ) { } @ Test public void testCigTab ( ) { } @ Test public void testSphere ( ) { } @ Test public void testTablet ( ) { } @ Test public void testDiffPow ( ) { } @ Test public void testSsDiffPow ( ) { } @ Test public void testAckley ( ) { } @ Test public void testRastrigin ( ) { } @ Test public void testConstrainedRosen ( ) { } private void doTest ( MultivariateRealFunction func , double [ ] startPoint , double [ ] [ ] boundaries , GoalType goal , double fTol , double pointTol , int maxEvaluations , RealPointValuePair expected ) { System . out . println ( ( ( func . getClass ( ) . getName ( ) ) + "<seq2seq4repair_space>BEGIN" ) ) ; int dim = startPoint . length ; final double [ ] lB = ( boundaries == null ) ? null : boundaries [ 0 ] ; final double [ ] uB = ( boundaries == null ) ? null : boundaries [ 1 ] ; <START_BUG> MultivariateRealOptimizer optim = new BOBYQAOptimizer ( ( ( 2 * dim ) + 1 ) ) ; <END_BUG> RealPointValuePair result = optim . optimize ( maxEvaluations , func , goal , startPoint , lB , uB ) ; Assert . assertEquals ( expected . getValue ( ) , result . getValue ( ) , fTol ) ; for ( int i = 0 ; i < dim ; i ++ ) { Assert . assertEquals ( expected . getPoint ( ) [ i ] , result . getPoint ( ) [ i ] , pointTol ) ; } System . out . println ( ( ( func . getClass ( ) . getName ( ) ) + "<seq2seq4repair_space>END" ) ) ; } private static double [ ] point ( int n , double value ) { } private static double [ ] [ ] boundaries ( int dim , double lower , double upper ) { } private static class Sphere implements MultivariateRealFunction { public double value ( double [ ] x ) { } } private static class Cigar implements MultivariateRealFunction { private double factor ; Cigar ( ) { } Cigar ( double axisratio ) { } public double value ( double [ ] x ) { } } private static class Tablet implements MultivariateRealFunction { private double factor ; Tablet ( ) { } Tablet ( double axisratio ) { } public double value ( double [ ] x ) { } } private static class CigTab implements MultivariateRealFunction { private double factor ; CigTab ( ) { } CigTab ( double axisratio ) { } public double value ( double [ ] x ) { } } private static class TwoAxes implements MultivariateRealFunction { private double factor ; TwoAxes ( ) { } TwoAxes ( double axisratio ) { } public double value ( double [ ] x ) { } } private static class ElliRotated implements MultivariateRealFunction { private BOBYQAOptimizerTest . Basis B = new BOBYQAOptimizerTest . Basis ( ) ; private double factor ; ElliRotated ( ) { } ElliRotated ( double axisratio ) { } public double value ( double [ ] x ) { } } private static class Elli implements MultivariateRealFunction { private double factor ; Elli ( ) { } Elli ( double axisratio ) { } public double value ( double [ ] x ) { } } private static class MinusElli implements MultivariateRealFunction { private final BOBYQAOptimizerTest . Elli elli = new BOBYQAOptimizerTest . Elli ( ) ; public double value ( double [ ] x ) { } } private static class DiffPow implements MultivariateRealFunction { public double value ( double [ ] x ) { } } private static class SsDiffPow implements MultivariateRealFunction { public double value ( double [ ] x ) { } } private static class Rosen implements MultivariateRealFunction { public double value ( double [ ] x ) { } } private static class Ackley implements MultivariateRealFunction { private double axisratio ; Ackley ( double axra ) { } public Ackley ( ) { } public double value ( double [ ] x ) { } } private static class Rastrigin implements MultivariateRealFunction { private double axisratio ; private double amplitude ; Rastrigin ( ) { } Rastrigin ( double axisratio , double amplitude ) { } public double value ( double [ ] x ) { } } private static class Basis { double [ ] [ ] basis ; Random rand = new Random ( 2 ) ; double [ ] Rotate ( double [ ] x ) { } void GenBasis ( int DIM ) { } } }

Fix:
BOBYQAOptimizer optim = new BOBYQAOptimizer ( ( ( 2 * dim ) + 1 ) ) ;