Commit 2bed3908 authored by Jaime Arias's avatar Jaime Arias
Browse files

fix output format for the minimal scheduling algorithm

parent ac5791dd
...@@ -101,49 +101,35 @@ public class MinimalScheduling extends BinaryService { ...@@ -101,49 +101,35 @@ public class MinimalScheduling extends BinaryService {
String line = ""; String line = "";
String match; String match;
FileWriter fw = null;
try { try {
File fileOutput = new File(baseDirectory().getAbsolutePath() + "/" + modelFile.getName() + ".log"); File fileOutput = new File(baseDirectory().getAbsolutePath() + "/" + modelFile.getName() + ".log");
fr = new FileReader(fileOutput); fr = new FileReader(fileOutput);
br = new BufferedReader(fr); br = new BufferedReader(fr);
fw = new FileWriter(modelFile.getParent() + "/debug.out");
fw.write("writing output: \n");
line = br.readLine(); line = br.readLine();
if (line != null) { if (line != null) {
match = line.substring(line.indexOf(":") + 1).trim(); match = line.substring(line.indexOf(":") + 1).trim();
this.nGraphs = Integer.parseInt(match); this.nGraphs = Integer.parseInt(match);
fw.append("n graphs: " + match + "\n");
} }
while (this.nGraphs > 0 && (line = br.readLine()) != null) { while (this.nGraphs > 0 && (line = br.readLine()) != null) {
// find a graph info // find a graph info
if (line.startsWith("Graph #")) { if (line.startsWith("Graph #")) {
if (s.length() != 0) { s.append("\n"); }
s.append(line + " => "); s.append(line + " => ");
} else if (line.startsWith("# Agents:")) { } else if (line.startsWith("# Agents:")) {
s.append(line + " - "); s.append(line + " - ");
} else if (line.startsWith("# Slots:")) { } else if (line.startsWith("# Slots:")) {
s.append(line); s.append(line);
} }
// new graph
if (line == "" && s.length() != 0) {
s.append("\n");
} }
}
fw.append("data:\n" + s + "\n");
} catch (Exception e) { } catch (Exception e) {
fw.append("error: " + e.getMessage() + "\n");
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (br != null) if (br != null)
br.close(); br.close();
if (fr != null) if (fr != null)
fr.close(); fr.close();
if (fw != null)
fw.close();
} }
return s.toString(); return s.toString();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment