RsBundle  Diff

Differences From Artifact [ebedc1def0]:

  • File src/solver.rs — part of check-in [34ecdf278f] at 2017-03-07 16:52:25 on branch trunk — solver: fix updating of `self.bounds` when adding new variables. (user: fifr size: 34832)

To Artifact [9f2e1d5fce]:

  • File src/solver.rs — part of check-in [10b0be88b8] at 2017-04-18 12:59:15 on branch trunk — solver: add `solver_iter` method. (user: fifr size: 35587)

571
572
573
574
575
576
577






















578
579
580
581
582
583
584
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







            self.show_info(term);
            if term == Step::Term {
                break;
            }
        }
        Ok(())
    }

    /// Solve the problem but stop after `niter` iterations.
    ///
    /// The function returns `Ok(true)` if the termination criterion
    /// has been satisfied. Otherwise it returns `Ok(false)` or an
    /// error code.
    pub fn solve_iter(&mut self, niter: usize) -> Result<bool> {
        try!(self.init());
        for _ in 0..niter {
            let mut term = try!(self.step());
            let changed = try!(self.update_problem(term));
            // do not stop if the problem has been changed
            if changed && term == Step::Term {
                term = Step::Null
            }
            self.show_info(term);
            if term == Step::Term {
                return Ok(true)
            }
        }
        Ok(false)
    }

    /// Called to update the problem.
    ///
    /// Calling this function typically triggers the problem to
    /// separate new constraints depending on the current solution.
    fn update_problem(&mut self, term: Step) -> Result<bool> {
        let updates = {