Skip to content

Commit

Permalink
Fixed problem of rows being removed during optimization, which can le…
Browse files Browse the repository at this point in the history
…ad to InternalSolverErrors.

The optimizer was removing rows from the solver entirely when it should only be removing them from the list of infeasible_rows to pivot on.
Seems to be just a mistranslation from kiwi, behavior now matches kiwi.
  • Loading branch information
christolliday committed Sep 12, 2017
1 parent 3216bb5 commit c7f57f8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/solver_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,8 @@ impl Solver {
fn dual_optimise(&mut self) -> Result<(), InternalSolverError> {
while !self.infeasible_rows.is_empty() {
let leaving = self.infeasible_rows.pop().unwrap();
if let Some(mut row) = self.rows.remove(&leaving)
.and_then(|row| if row.constant < 0.0 { Some(row) } else { None })
{
if self.rows.get(&leaving).map_or(false, |row| row.constant < 0.0) {
let mut row = self.rows.remove(&leaving).unwrap();
let entering = self.get_dual_entering_symbol(&row);
if entering.type_() == SymbolType::Invalid {
return Err(InternalSolverError("Dual optimise failed."));
Expand Down

0 comments on commit c7f57f8

Please sign in to comment.