RsBundle  Diff

Differences From Artifact [7aad005306]:

  • File src/solver.rs — part of check-in [7749770720] at 2019-07-15 12:29:50 on branch trunk — Solver: call `init` from `solve` not from `solve_iter`. `solve_iter` is supposed to be called several times. Hence the solver must not be reinitialized each time the function is called. (user: fifr size: 36492)

To Artifact [00b1b4283a]:

  • File src/solver.rs — part of check-in [2314de719c] at 2019-07-15 12:32:57 on branch trunk — Solver: add `solve_with_limit` (user: fifr size: 36800)

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
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
607
608







-
+
+
+


+
-
+
+
+
+



-
+


-
+







        self.nxt_mods.init0(m);

        self.start_time = Instant::now();

        Ok(())
    }

    /// Solve the problem.
    /// Solve the problem with at most 10_000 iterations.
    ///
    /// Use `solve_with_limit` for an explicit iteration limit.
    pub fn solve(&mut self) -> Result<(), SolverError<P::Err>> {
        const LIMIT: usize = 10_000;
        self.solve_with_limit(LIMIT)

    }

    /// Solve the problem with explicit iteration limit.
    pub fn solve_with_limit(&mut self, iter_limit: usize) -> Result<(), SolverError<P::Err>> {
        // First initialize the internal data structures.
        self.init()?;

        if self.solve_iter(LIMIT)? {
        if self.solve_iter(iter_limit)? {
            Ok(())
        } else {
            Err(SolverError::IterationLimit { limit: LIMIT })
            Err(SolverError::IterationLimit { limit: iter_limit })
        }
    }

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