From bf7f638e4a9e152c98fa73279fbcf69b07595651 Mon Sep 17 00:00:00 2001 From: sam Date: Mon, 1 Feb 2016 18:55:20 +0000 Subject: [PATCH 1/2] Add missing dualOptimize calls. Kiwi C++ implementation uses a scope guard to guarantee it gets called. --- src/main/java/no/birkett/kiwi/Solver.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/no/birkett/kiwi/Solver.java b/src/main/java/no/birkett/kiwi/Solver.java index 560f2ae..c5b0231 100644 --- a/src/main/java/no/birkett/kiwi/Solver.java +++ b/src/main/java/no/birkett/kiwi/Solver.java @@ -246,6 +246,7 @@ public class Solver { if(row.add(-delta) < 0.0){ infeasibleRows.add(info.tag.marker); } + dualOptimize(); return; } @@ -254,6 +255,7 @@ public class Solver { if(row.add(delta) < 0.0){ infeasibleRows.add(info.tag.other); } + dualOptimize(); return; } From 2b23f2e5622ecca0a3418af08a84ea5fdd04f84a Mon Sep 17 00:00:00 2001 From: sam Date: Mon, 1 Feb 2016 19:03:24 +0000 Subject: [PATCH 2/2] Erase the leaving symbols, not the entering symbols in dualOptimize. Matches the Kiwi C++ implementation: https://github.com/nucleic/kiwi/blob/0989ff015fdea5c59c90b1fd87383dfe6f733257/kiwi/solverimpl.h#L615 --- src/main/java/no/birkett/kiwi/Solver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/no/birkett/kiwi/Solver.java b/src/main/java/no/birkett/kiwi/Solver.java index c5b0231..97bb3d2 100644 --- a/src/main/java/no/birkett/kiwi/Solver.java +++ b/src/main/java/no/birkett/kiwi/Solver.java @@ -530,7 +530,7 @@ public class Solver { if(entering.getType() == Symbol.Type.INVALID){ throw new InternalSolverError("internal solver error"); } - rows.remove(entering); + rows.remove(leaving); row.solveFor(leaving, entering); substitute(entering, row); rows.put(entering, row);