Skip to content
Snippets Groups Projects
Commit 4dd253a2 authored by Jona Dirks's avatar Jona Dirks
Browse files

Merge branch 'description-dependencies' into 'main'

Allow loading different problems

See merge request !37
parents 5722a7fd cf32b39c
No related branches found
No related tags found
1 merge request!37Allow loading different problems
Pipeline #238546 passed
......@@ -32,6 +32,24 @@ public class BasicUndirectedGraphImporterExporter
implements Exporter<BasicUndirectedGraph>,
Importer<BasicUndirectedGraph> {
private String problem;
/**
* Creates an importer for the cluster editing problem.
*/
public BasicUndirectedGraphImporterExporter() {
this("cep");
}
/**
* Specifies which problem to look for.
*
* @param problem name of the problem
*/
public BasicUndirectedGraphImporterExporter(String problem) {
this.problem = problem;
}
@Override
public void exportToFile(final BasicUndirectedGraph graph, final String path) throws IOException {
export(graph, new FileWriter(path));
......@@ -89,8 +107,8 @@ public class BasicUndirectedGraphImporterExporter
if (nextLine.startsWith("p")) { //Pace Problem importtype
//block needed for pace
String[] arguments = nextLine.split(" ");
if (!(arguments[1].equals("cep") || arguments[1].equals("td"))) {
System.err.println("Wrong problem see pace 2021 documentation");
if (!(arguments[1].equals(problem))) {
System.err.println("Wrong problem for this solver");
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment