Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Solver: add `solve_with_limit` |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
2314de719cee13242416bda3cf98417d |
| User & Date: | fifr 2019-07-15 12:32:57.564 |
Context
|
2019-07-15
| ||
| 12:39 | base.rs: typo check-in: 6353c84290 user: fifr tags: trunk | |
| 12:32 | Solver: add `solve_with_limit` check-in: 2314de719c user: fifr tags: trunk | |
| 12:29 | Solver: call `init` from `solve` not from `solve_iter`. check-in: 7749770720 user: fifr tags: trunk | |
Changes
Changes to src/solver.rs.
| ︙ | ︙ | |||
578 579 580 581 582 583 584 |
self.nxt_mods.init0(m);
self.start_time = Instant::now();
Ok(())
}
| | > > > | > > > | | | 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 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(iter_limit)? {
Ok(())
} else {
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
|
| ︙ | ︙ |