public static void logPerformances(Policy policy, boolean logBadTrajectories) {
    float[] performance = performance(policy, logBadTrajectories);

    PrintWriter performanceLog = null;
    try {
      performanceLog = new PrintWriter(new FileWriter("performance.log", true));
    } catch (IOException e) {
      e.printStackTrace();
    }

    String line;
    if (policy.getClass() == DirectPolicySearch.class) {
      DirectPolicySearch dps = (DirectPolicySearch) policy;
      float totalComputationTime = (float) dps.getTotalComputationTime() / 1000f / 60f;

      line =
          dps.getName()
              + ";"
              + dps.getTotalNbOfIterations()
              + ";"
              + totalComputationTime
              + ";"
              + performance[0]
              + ";"
              + performance[1];
    } else if (policy.getClass() == Qiteration.class) {
      Qiteration qit = (Qiteration) policy;
      float totalComputationTime = (float) qit.getTotalComputationTime() / 1000f / 60f;

      line =
          qit.getName()
              + ";"
              + qit.getDiscountFactor()
              + ";"
              + qit.getTotalNbOfIterations()
              + ";"
              + totalComputationTime
              + ";"
              + performance[0]
              + ";"
              + performance[1];
    } else {
      line = policy.getName() + ";" + performance[0] + ";" + performance[1];
    }
    performanceLog.println(line);

    performanceLog.close();
  }