Skip to content

Commit 947896d

Browse files
feat: Adding lower-bounding search to the solver (#132)
Currently, we only support upper-bounding search (LSU) in the solver; however, it makes sense to also support lower-bounding search (LUS) in the solver. This PR aims to implement lower-bounding search using assumptions. --------- Co-authored-by: Maarten Flippo <[email protected]>
1 parent 07bc835 commit 947896d

File tree

13 files changed

+596
-379
lines changed

13 files changed

+596
-379
lines changed

pumpkin-solver/src/api/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
mod outputs;
2+
23
pub(crate) mod solver;
34

45
pub mod results {
@@ -14,7 +15,6 @@ pub mod results {
1415
//! right state for these operations. For example,
1516
//! [`SatisfactionResultUnderAssumptions::UnsatisfiableUnderAssumptions`] allows you to extract
1617
//! a core consisting of the assumptions using [`UnsatisfiableUnderAssumptions::extract_core`].
17-
pub use crate::api::outputs::solution_callback_arguments::SolutionCallbackArguments;
1818
pub use crate::api::outputs::solution_iterator;
1919
pub use crate::api::outputs::unsatisfiable;
2020
pub use crate::api::outputs::OptimisationResult;
@@ -94,7 +94,7 @@ pub mod termination {
9494
}
9595

9696
pub mod predicates {
97-
//! Containts structures which represent certain [predicates](https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)).
97+
//! Contains structures which represent certain [predicates](https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)).
9898
//!
9999
//! The solver only utilizes the following types of predicates:
100100
//! - A [`Predicate::LowerBound`] of the form `[x >= v]`

pumpkin-solver/src/api/outputs/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use self::unsatisfiable::UnsatisfiableUnderAssumptions;
22
pub use crate::basic_types::ProblemSolution;
33
use crate::basic_types::Solution;
44
pub use crate::basic_types::SolutionReference;
5-
pub(crate) mod solution_callback_arguments;
65
pub mod solution_iterator;
76
pub mod unsatisfiable;
87
use crate::branching::Brancher;
@@ -47,7 +46,7 @@ pub enum SatisfactionResultUnderAssumptions<'solver, 'brancher, B: Brancher> {
4746
Unknown,
4847
}
4948

50-
/// The result of a call to [`Solver::maximise`] or [`Solver::minimise`].
49+
/// The result of a call to [`Solver::optimise`].
5150
#[derive(Debug)]
5251
pub enum OptimisationResult {
5352
/// Indicates that an optimal solution has been found and proven to be optimal. It provides an

pumpkin-solver/src/api/outputs/solution_callback_arguments.rs

Lines changed: 0 additions & 43 deletions
This file was deleted.

pumpkin-solver/src/api/outputs/solution_iterator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<'solver, 'brancher, 'termination, B: Brancher, T: TerminationCondition>
5353
Satisfiable(solution) => {
5454
self.has_solution = true;
5555
self.next_blocking_clause = Some(get_blocking_clause(&solution));
56-
IteratedSolution::Solution(solution)
56+
IteratedSolution::Solution(solution, self.solver)
5757
}
5858
Unsatisfiable => {
5959
if self.has_solution {
@@ -84,9 +84,9 @@ fn get_blocking_clause(solution: &Solution) -> Vec<Predicate> {
8484
reason = "these will not be stored in bulk, so this is not an issue"
8585
)]
8686
#[derive(Debug)]
87-
pub enum IteratedSolution {
87+
pub enum IteratedSolution<'a> {
8888
/// A new solution was identified.
89-
Solution(Solution),
89+
Solution(Solution, &'a Solver),
9090

9191
/// No more solutions exist.
9292
Finished,

0 commit comments

Comments
 (0)