Advertisement
KillianMills

mapGenerator.java

Nov 24th, 2015
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.40 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. class mapGenerator
  4. {
  5.  
  6.     // used to change the link for dynamic results
  7.     public static double[] changeLink(double first, double second){
  8.  
  9.         double temp[] = new double[2];
  10.  
  11.         first = first + 0.2 ; // increment to 2
  12.         second = second +  0.1; // increment to 1
  13.  
  14.     first = Math.round(first * 100) / 100.0;
  15.     second = Math.round(second * 100) / 100.0;
  16.  
  17.         temp[0] = first;
  18.         temp[1] = second;
  19.  
  20.         return temp;
  21.  
  22.     }
  23.  
  24.     public static void main(String args[]) throws IOException
  25.     {
  26.  
  27.     double k, b;
  28.         k = 0.0;
  29.         b = 0.0;
  30.  
  31.     for(int j=0; j <10; j++){
  32.  
  33.         double tempArray[] = changeLink(k, b);
  34.  
  35.                 k = tempArray[0];
  36.                 b = tempArray[1];
  37.  
  38.         PrintWriter writer = new PrintWriter("MAPresults" + j+ ".csv");
  39.  
  40.         Process proc = Runtime.getRuntime().exec("/users/case4/ruitern2/Documents/ca4009/trec_eval.9.0/trec_eval /users/case4/ruitern2/Documents/ca4009/trec_eval.9.0/qrels.trec678.adhoc TREC_6_k_"+ k +"b_"+ b +"_results.csv");
  41.  
  42.         InputStream stdin = proc.getInputStream();
  43.         InputStreamReader isr = new InputStreamReader(stdin);
  44.         BufferedReader br = new BufferedReader(isr);
  45.  
  46.         String line = null;
  47.  
  48.         System.out.println(line);
  49.         while ( (line = br.readLine()) != null){
  50.             writer.println(line);
  51.             System.out.println(line);
  52.             writer.flush();
  53.         }
  54.  
  55.         writer.close();
  56.     }    
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement