pumpkin_core/api/
mod.rs

1mod outputs;
2
3pub(crate) mod solver;
4
5pub mod results {
6    //! Contains the outputs of solving using the [`Solver`].
7    //!
8    //! We differentiate between 3 different types of results:
9    //! - For a **satisfaction** problem ([`SatisfactionResult`])
10    //! - For a **satisfaction** problem using **assumptions**
11    //!   ([`SatisfactionResultUnderAssumptions`])
12    //! - For an **optimisation** problem ([`OptimisationResult`])
13    //!
14    //! On these results, different methods can be called which ensure that the solver is in the
15    //! right state for these operations. For example,
16    //! [`SatisfactionResultUnderAssumptions::UnsatisfiableUnderAssumptions`] allows you to extract
17    //! a core consisting of the assumptions using [`UnsatisfiableUnderAssumptions::extract_core`].
18    pub use crate::api::outputs::solution_iterator;
19    pub use crate::api::outputs::unsatisfiable;
20    pub use crate::api::outputs::OptimisationResult;
21    pub use crate::api::outputs::ProblemSolution;
22    pub use crate::api::outputs::SatisfactionResult;
23    pub use crate::api::outputs::SatisfactionResultUnderAssumptions;
24    pub use crate::api::outputs::Satisfiable;
25    pub use crate::api::outputs::SolutionReference;
26    pub use crate::basic_types::Solution;
27    #[cfg(doc)]
28    use crate::results::unsatisfiable::UnsatisfiableUnderAssumptions;
29    #[cfg(doc)]
30    use crate::Solver;
31}
32
33pub mod variables {
34    //! Contains the variables which are used by the [`Solver`].
35    //!
36    //! A variable, in the context of the solver, is a view onto a domain. It may forward domain
37    //! information unaltered, or apply transformations which can be performed without the need of
38    //! constraints.
39    //!
40    //! We define 2 types of variables:
41    //! - Integer Variables ([`IntegerVariable`]) - These are represented by [`DomainId`]s when
42    //!   interacting with the [`Solver`]. These variables can be created using
43    //!   [`Solver::new_bounded_integer`] when creating a variable with the domain between a
44    //!   lower-bound and an upper-bound or using [`Solver::new_sparse_integer`] when creating a
45    //!   variable with holes in the domain. These variables can be transformed (according to the
46    //!   trait [`TransformableVariable`]) to create an [`AffineView`].
47    //! - Literals ([`Literal`]) - These specify booleans that can be used when interacting with the
48    //!   [`Solver`]. A [`Literal`] can be created using [`Solver::new_literal`].
49    pub use crate::engine::variables::AffineView;
50    pub use crate::engine::variables::DomainId;
51    pub use crate::engine::variables::IntegerVariable;
52    pub use crate::engine::variables::Literal;
53    pub use crate::engine::variables::TransformableVariable;
54    #[cfg(doc)]
55    use crate::Solver;
56}
57
58pub mod constraint_arguments {
59    //! Contains inputs to constraints.
60
61    pub use crate::propagators::ArgDisjunctiveTask;
62    pub use crate::propagators::CumulativeExplanationType;
63    pub use crate::propagators::CumulativeOptions;
64    pub use crate::propagators::CumulativePropagationMethod;
65}
66
67pub mod options {
68    //! Contains the options which can be passed to the [`Solver`].
69    //!
70    //! These influence the following aspects:
71    //! - The restart strategy of the solver
72    //! - The learned clause database management approach
73    //! - The proof logging
74    pub use crate::basic_types::sequence_generators::SequenceGeneratorType;
75    pub use crate::engine::ConflictResolver;
76    pub use crate::engine::RestartOptions;
77    pub use crate::engine::SatisfactionSolverOptions as SolverOptions;
78    pub use crate::propagators::nogoods::LearningOptions;
79    #[cfg(doc)]
80    use crate::Solver;
81}
82
83pub mod termination {
84    //! Contains the conditions which are used to determine when the [`Solver`] should terminate
85    //! even when the state of the satisfaction/optimization problem is unknown.
86    //!
87    //! The main [`TerminationCondition`] is a condition which is polled by the [`Solver`] during
88    //! the search process. It indicates when the [`Solver`] should stop, even if no definitive
89    //! conclusions have been made.
90    //!
91    //! The most common example would be [`TimeBudget`], which terminates the [`Solver`] whenever
92    //! the time budget is exceeded.
93    pub use crate::engine::termination::combinator::*;
94    pub use crate::engine::termination::indefinite::*;
95    pub use crate::engine::termination::time_budget::*;
96    pub use crate::engine::termination::TerminationCondition;
97    #[cfg(doc)]
98    use crate::Solver;
99}
100
101pub mod predicates {
102    //! Contains structures which represent certain [predicates](https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)).
103    //!
104    //! The solver only utilizes the following types of predicates:
105    //! - A predicate of the form `[x >= v]`
106    //! - A predicate of the form `[x <= v]`
107    //! - A predicate of the form `[x = v]`
108    //! - A predicate of the form `[x != v]`
109    //!
110    //! In general, these [`Predicate`]s are used to represent propagations, explanations or
111    //! decisions.
112    pub use crate::basic_types::PropositionalConjunction;
113    pub use crate::engine::predicates::predicate::Predicate;
114    pub use crate::engine::predicates::predicate::PredicateType;
115    pub use crate::engine::predicates::predicate_constructor::PredicateConstructor;
116    #[cfg(doc)]
117    use crate::variables::Literal;
118}
119
120pub use crate::basic_types::Function;
121
122#[doc(hidden)]
123pub mod asserts {
124    pub use crate::pumpkin_assert_advanced;
125    pub use crate::pumpkin_assert_eq_simple;
126    pub use crate::pumpkin_assert_extreme;
127    pub use crate::pumpkin_assert_moderate;
128    pub use crate::pumpkin_assert_ne_moderate;
129    pub use crate::pumpkin_assert_ne_simple;
130    pub use crate::pumpkin_assert_simple;
131    pub use crate::pumpkin_asserts::PUMPKIN_ASSERT_ADVANCED;
132    pub use crate::pumpkin_asserts::PUMPKIN_ASSERT_EXTREME;
133    pub use crate::pumpkin_asserts::PUMPKIN_ASSERT_LEVEL_DEFINITION;
134    pub use crate::pumpkin_asserts::PUMPKIN_ASSERT_MODERATE;
135    pub use crate::pumpkin_asserts::PUMPKIN_ASSERT_SIMPLE;
136}