From 81e9a4970cdafd078e7498187e0d63461b0990a7 Mon Sep 17 00:00:00 2001 From: Alex Birkett Date: Mon, 1 Feb 2016 21:24:31 +0100 Subject: [PATCH] Remove deep copy method Copy constructor does the same thing --- src/main/java/no/birkett/kiwi/Row.java | 10 ---------- src/main/java/no/birkett/kiwi/Solver.java | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/main/java/no/birkett/kiwi/Row.java b/src/main/java/no/birkett/kiwi/Row.java index 5de55a9..3444a57 100644 --- a/src/main/java/no/birkett/kiwi/Row.java +++ b/src/main/java/no/birkett/kiwi/Row.java @@ -27,16 +27,6 @@ public class Row { this.constant = other.constant; } - public Row deepCopy(){ - Row result = new Row(); - result.constant = this.constant; - result.cells = new LinkedHashMap<>(); - for(Symbol s: this.cells.keySet()){ - result.cells.put(s, this.cells.get(s)); - } - return result; - } - public double getConstant() { return constant; } diff --git a/src/main/java/no/birkett/kiwi/Solver.java b/src/main/java/no/birkett/kiwi/Solver.java index 97bb3d2..7cfc098 100644 --- a/src/main/java/no/birkett/kiwi/Solver.java +++ b/src/main/java/no/birkett/kiwi/Solver.java @@ -405,9 +405,9 @@ public class Solver { // Create and add the artificial variable to the tableau Symbol art = new Symbol(Symbol.Type.SLACK, idTick++); - rows.put(art, row.deepCopy()); + rows.put(art, new Row(row)); - this.artificial = row.deepCopy(); + this.artificial = new Row(row); // Optimize the artificial objective. This is successful // only if the artificial objective is optimized to zero.