Skip to content

Commit

Permalink
Merge pull request #19 from TiloW/first-segment
Browse files Browse the repository at this point in the history
Reintroduce Fist Segment Constraints
  • Loading branch information
TiloW committed Jun 2, 2015
2 parents c8d6b20 + b3218f2 commit 738a7a6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/proof/solver/LinearProgramGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,27 @@ public String createLinearProgram(Map<CrossingIndex, Boolean> fixedVariables, JS
}
}

result.append("\n\\ First Segment Constraints");

// first segment constraints are generated for fully expanded edges only
// note that an edge will cross with at most every non-adjacent edge once
for (int e = 0; e < graph.getNumberOfEdges(); e++) {
int maxExpansions = graph.getNumberOfEdges();

for (int f = 0; f < graph.getNumberOfEdges(); f++) {
if (graph.areEdgesAdjacent(e, f)) {
maxExpansions--;
}
}

maxExpansions = Math.min(maxExpansions, graph.getClaimedLowerBound() - 2);

if (maxExpansions > 0 && expansions[e] == maxExpansions) {
result.append("\n" + sumVariables(e, expansions[e]) + sumVariables(e, 0, true) + " >= 0");
stats.increase("first segment constraints");
}
}

for (int i = 0; i < jsonConstraints.length(); i++) {
result.append("\n\\ Kuratowski Constraint " + i + "\n");
result.append(generateKuratowski(jsonConstraints.getJSONObject(i)));
Expand Down

0 comments on commit 738a7a6

Please sign in to comment.