RsBundle  Check-in [10b0be88b8]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:solver: add `solver_iter` method.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 10b0be88b8500d01c926d645a5a81a164a99ee19
User & Date: fifr 2017-04-18 12:59:15.373
Context
2017-04-18
13:04
Solver::solve returns `Error::IterationLimit` if limit has been reached. check-in: 9bbb1b8836 user: fifr tags: trunk
12:59
solver: add `solver_iter` method. check-in: 10b0be88b8 user: fifr tags: trunk
2017-04-04
06:57
Update dependencies to cplex-sys. check-in: 8b2fc81132 user: fifr tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/solver.rs.
571
572
573
574
575
576
577






















578
579
580
581
582
583
584
            self.show_info(term);
            if term == Step::Term {
                break;
            }
        }
        Ok(())
    }























    /// 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 = {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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 = {