Skip to content
Snippets Groups Projects
Commit faf71a08 authored by Yannik's avatar Yannik
Browse files

final params?

parent 17a0b061
No related branches found
No related tags found
1 merge request!10final params?
Pipeline #150102 passed
This commit is part of merge request !10. Comments created here will be created in the context of that merge request.
...@@ -97,17 +97,10 @@ public abstract class GoogleSolveHelper { ...@@ -97,17 +97,10 @@ public abstract class GoogleSolveHelper {
@SneakyThrows @SneakyThrows
public void solve() { public void solve() {
try { final long time = System.currentTimeMillis();
final long time = System.currentTimeMillis(); createSolver();
createSolver(); mpSolver.suppressOutput();
solve(time, false, null); solve(time, false, null);
} catch (Exception e) {
if (e instanceof InterruptedException) {
ConsoleHelper.print("OrTools recived an interrupt");
mpSolver.interruptSolve();
throw new InterruptedException();
}
}
} }
public void solve(EdgeModification<UndirectedEdge> changes) { public void solve(EdgeModification<UndirectedEdge> changes) {
......
...@@ -31,15 +31,11 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -31,15 +31,11 @@ import java.util.concurrent.atomic.AtomicInteger;
public class FruchtemanLpOrIlpSolver extends Solver { public class FruchtemanLpOrIlpSolver extends Solver {
private static int maxIlpEdges = 12000; private static int maxIlpEdges = 4965;
private static int minIlpP3s = 930; private static int maxLpEdges = 76652;
private static int maxLPP3s = 140000; //not tested atm with smac private static int maxIlpP3s = 72410;
private static int maxLPP3s = 720000;
private static boolean and = false; private static boolean and = false;
private static double maxP3sRatioLP = 0.05;
private static double maxP3sRatioILP = 0.005;
private static double edgesVerticiesRatioILP = 0.02;
private double p3Ratio;
public FruchtemanLpOrIlpSolver(final ProblemInstance graph) { public FruchtemanLpOrIlpSolver(final ProblemInstance graph) {
super(graph); super(graph);
...@@ -111,13 +107,8 @@ public class FruchtemanLpOrIlpSolver extends Solver { ...@@ -111,13 +107,8 @@ public class FruchtemanLpOrIlpSolver extends Solver {
return; return;
} }
p3Ratio = p3Helper.getSizeEdgeDisjointP3s() / (double) p3s;
ConsoleHelper.print("P3s found: " + p3s); ConsoleHelper.print("P3s found: " + p3s);
ConsoleHelper.print("P3-Ratio: " + p3Ratio); if (doIlp(p3s, instance)) {
if (p3s < minIlpP3s) {
bb(instance, p3Helper);
} else if (doIlp(p3s, instance)) {
ilp(instance); ilp(instance);
} else { } else {
bb(instance, p3Helper); bb(instance, p3Helper);
...@@ -126,10 +117,8 @@ public class FruchtemanLpOrIlpSolver extends Solver { ...@@ -126,10 +117,8 @@ public class FruchtemanLpOrIlpSolver extends Solver {
} }
private boolean doIlp(int p3s, ProblemInstance instance) { private boolean doIlp(int p3s, ProblemInstance instance) {
return !and && (instance.getEdges().size() < maxIlpEdges || p3Ratio < maxP3sRatioILP return !and && (instance.getEdges().size() < maxIlpEdges || maxIlpP3s < p3s)
|| (instance.getVertices().size() / (double) instance.getVertices().size() < edgesVerticiesRatioILP)) || and && (instance.getEdges().size() < maxIlpEdges && maxIlpP3s < p3s);
|| and && (instance.getEdges().size() < maxIlpEdges && p3Ratio < maxP3sRatioILP
&& (instance.getVertices().size() / (double) instance.getVertices().size() < edgesVerticiesRatioILP));
} }
private void ilp(final ProblemInstance instance) { private void ilp(final ProblemInstance instance) {
...@@ -202,8 +191,8 @@ public class FruchtemanLpOrIlpSolver extends Solver { ...@@ -202,8 +191,8 @@ public class FruchtemanLpOrIlpSolver extends Solver {
} }
private boolean doLP(ProblemInstance instance, P3Helper<ProblemInstance> p3Helper) { private boolean doLP(ProblemInstance instance, P3Helper<ProblemInstance> p3Helper) {
return (!and && (p3Helper.getSizeAllP3s() < maxLPP3s || p3Ratio < maxP3sRatioLP)) return (!and && (instance.getEdges().size() < maxLpEdges || p3Helper.getSizeAllP3s() < maxLPP3s))
|| (and && (p3Helper.getSizeAllP3s() < maxLPP3s && p3Ratio < maxP3sRatioLP)); || (and && (instance.getEdges().size() < maxLpEdges && p3Helper.getSizeAllP3s() < maxLPP3s));
} }
@Override @Override
......
...@@ -8,7 +8,7 @@ import de.uni.bremen.cluster.editing.utilities.common.api.algorithm.Solver; ...@@ -8,7 +8,7 @@ import de.uni.bremen.cluster.editing.utilities.common.api.algorithm.Solver;
public class TestMain { public class TestMain {
public static void main(final String... args) { public static void main(final String... args) {
final String path = "../test-cases/exact/exact061.gr"; final String path = "../test-cases/exact/exact199.gr";
Solver.TRACKING = true; Solver.TRACKING = true;
Solver solver = new GraphSplitterSolver(path); Solver solver = new GraphSplitterSolver(path);
solver.solve(); solver.solve();
......
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