
public class demo {
	
	public static void MY_OPTIMIZER(JNIproblem problem, ArrayList<double> lower_bounds, ArrayList<double> upper_bounds, double budget) {
		int n = 
		
	}
	
	public static void MY_OPTIMIZER(JNIfgeneric fgeneric, int dim, double maxfunevals, Random rand) {

        double[] x = new double[dim];

        /* Obtain the target function value, which only use is termination */
        double ftarget = fgeneric.getFtarget();
        double f;

        if (maxfunevals > 1e9 * dim) {
             maxfunevals = 1e9 * dim;
        }

        for (double iter = 0.; iter < maxfunevals; iter++) {
            /* Generate individual */
            for (int i = 0; i < dim; i++) {
                x[i] = 10. * rand.nextDouble() - 5.;
            }

            /* evaluate X on the objective function */
            f = fgeneric.evaluate(x);

            if (f < ftarget) {
                break;
            }
        }
    }
	
	
	
	
	
	
	

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}

@@ -1,8 +1,134 @@
+import java.util.ArrayList;%0Aimport java.util.Random;%0Aimport coco.Benchmark;%0A%0A/* Draft: determine native methods to declare */%0A
 %0Apublic 
@@ -140,19 +140,20 @@
  demo %7B%0A
-%09%0A%09
+    
 public s
@@ -167,25 +167,22 @@
 oid 
-MY_OPTIMIZER(JNIp
+my_optimizer(P
 robl
@@ -193,33 +193,24 @@
 roblem, 
-ArrayList%3C
 double
-%3E
+%5B%5D
  lower_b
@@ -220,25 +220,16 @@
 ds, 
-ArrayList%3C
 double
-%3E
+%5B%5D
  upp
@@ -260,174 +260,100 @@
 ) %7B%0A
-%09%09int n = %0A%09%09%0A%09%7D%0A%09%0A%09public static void MY_OPTIMIZER(JNIfgeneric fgeneric, int dim, double maxfunevals, Random rand) %7B%0A%0A        double%5B%5D x = new double%5Bdim%5D
+        System.out.println(%22In optimizer...%22);%0A        int n = lower_bounds.length
 ;%0A
-%0A
         
 /* O
@@ -352,144 +352,53 @@
     
-/* Obtain the target function value, which only use is termination */%0A        double ftarget = fgeneric.getFtarget();%0A       
+int i, j;%0A        double%5B%5D x = new
  double
- f;%0A
+%5Bn%5D;
 %0A   
@@ -406,147 +406,54 @@
     
-if (maxfunevals %3E 1e9 * dim) %7B%0A             maxfunevals = 1e9 * dim;%0A        %7D%0A%0A        for (double iter
+double y;%0A        for (i
  = 0
-.
 ; i
-ter %3C maxfunevals; iter
+ %3C budget; i
 ++)
- 
 %7B%0A  
@@ -466,33 +466,32 @@
     
-/* Generate individual */
+Random r = new Random();
 %0A   
@@ -508,33 +508,26 @@
 or (
-int i
+j
  = 0; 
-i %3C dim; i
+j %3C n; j
 ++)
- 
 %7B%0A  
@@ -546,23 +546,70 @@
   x%5B
-i
+j
 %5D = 
-10. * rand
+lower_bounds%5Bj%5D + (upper_bounds%5Bj%5D - lower_bounds%5Bj%5D) * r
 .nex
@@ -621,13 +621,8 @@
 le()
- - 5.
 ;%0A  
@@ -633,17 +633,16 @@
       %7D%0A
-%0A
         
@@ -649,98 +649,55 @@
     
-/* evaluate X on the objective function */%0A            f = fgeneric.evaluate
+y = problem.coco_evaluate_function
 (x);%0A
-%0A
         
     
@@ -696,30 +696,18 @@
     
+%7D%0A
     
-if (f %3C ftarget) %7B
+    
 %0A   
@@ -711,24 +711,25 @@
         
+%0A
         
 break;%0A 
@@ -724,14 +724,8 @@
     
-break;
 %0A   
@@ -721,32 +721,33 @@
        %0A        
+%0A
     %7D%0A        %7D%0A
@@ -744,36 +744,13 @@
     
-    %7D
 %0A    
-%7D%0A%09%0A%09%0A%09%0A%09%0A%09%0A%09%0A%09%0A%0A%09
 publ
@@ -790,10 +790,16 @@
 ) %7B%0A
-%09%09
+        
 // T
@@ -833,11 +833,393 @@
 tub%0A
-%0A%09%7D%0A%0A%7D%0A
+        Benchmark my_benchmark = new Benchmark(%22bbob2009%22, %22bbob_observer%22, %22random_search%22); // parameters to be defined%0A        while(true)%7B%0A            problem = my_benchmark.nextProblem();%0A            System.out.println(%22Optimizing %22 + problem.toString());%0A            my_optimizer(problem, problem.lowerBounds(), problem.upperBounds(), 10000);%0A        %7D%0A        %0A        %0A    %7D%0A    %0A%7D

add the right java file