Remove deep copy method

Copy constructor does the same thing
This commit is contained in:
Alex Birkett 2016-02-01 21:24:31 +01:00
parent 9419220186
commit 81e9a4970c
2 changed files with 2 additions and 12 deletions

View File

@ -27,16 +27,6 @@ public class Row {
this.constant = other.constant; 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() { public double getConstant() {
return constant; return constant;
} }

View File

@ -405,9 +405,9 @@ public class Solver {
// Create and add the artificial variable to the tableau // Create and add the artificial variable to the tableau
Symbol art = new Symbol(Symbol.Type.SLACK, idTick++); 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 // Optimize the artificial objective. This is successful
// only if the artificial objective is optimized to zero. // only if the artificial objective is optimized to zero.