private void run() {
    FileSystem.setAssnId(MAIN_ASSN_ID);

    // load the necessary graphs
    loadGraphs();
    statMax = new TreeMap<String, Pair<String, Double>>();

    // test the policy graph against the ground truth
    File policyDir = new File(FileSystem.getAssnDir(), "policies");
    for (File policyFile : FileSystem.listFiles(policyDir)) {
      String ext = FileSystem.getExtension(policyFile.getName());
      if (!ext.equals("txt")) continue;
      String name = policyFile.getName();
      Map<String, String> policy = FileSystem.getFileMapString(policyFile);
      generateStats(name, policy);
    }

    System.out.println("");
    System.out.println("Best:");
    for (String test : statMax.keySet()) {
      System.out.println(test + ": " + statMax.get(test).getFirst());
    }
  }
Ejemplo n.º 2
0
  private void run() {
    FileSystem.setAssnId(MAIN_ASSN_ID);
    DirectedGraph<String> p1 = GraphLoader.loadPolicy("nodeRank.txt");
    DirectedGraph<String> p2 = GraphLoader.loadPolicy("nodeRank6.txt");

    Set<String> verticies = new HashSet<String>();
    verticies.addAll(p1.vertexSet());
    verticies.addAll(p2.vertexSet());
    ArrayList<Integer> idSet = new ArrayList<Integer>();
    for (String s : verticies) {
      int id = Integer.parseInt(s);
      idSet.add(id);
    }
    Collections.sort(idSet);
    List<String> sortedList = new ArrayList<String>();
    for (int s : idSet) {
      sortedList.add("" + s);
    }

    for (String v : sortedList) {
      if (Integer.parseInt(v) > 100) continue;

      if (!p1.containsVertex(v)) {
        System.out.println("p1 missing: " + v);
      }
      if (!p2.containsVertex(v)) {
        System.out.println("p2 missing: " + v);
      }

      String n1 = getNext(p1, v);
      String n2 = getNext(p2, v);

      if (!n1.equals(n2)) {
        System.out.println("diff " + v + ":\t" + n1 + "\t" + n2);
      }
    }
  }
 public static void main(String[] args) {
   FileSystem.setAssnId(MAIN_ASSN_ID);
   new IndependentProbablePath().run();
 }