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 options {
59 //! Contains the options which can be passed to the [`Solver`].
60 //!
61 //! These influence the following aspects:
62 //! - The restart strategy of the solver
63 //! - The learned clause database management approach
64 //! - The proof logging
65 pub use crate::basic_types::sequence_generators::SequenceGeneratorType;
66 pub use crate::engine::ConflictResolver;
67 pub use crate::engine::RestartOptions;
68 pub use crate::engine::SatisfactionSolverOptions as SolverOptions;
69 pub use crate::propagators::nogoods::LearningOptions;
70 pub use crate::propagators::CumulativeExplanationType;
71 pub use crate::propagators::CumulativeOptions;
72 pub use crate::propagators::CumulativePropagationMethod;
73 #[cfg(doc)]
74 use crate::Solver;
75}
76
77pub mod termination {
78 //! Contains the conditions which are used to determine when the [`Solver`] should terminate
79 //! even when the state of the satisfaction/optimization problem is unknown.
80 //!
81 //! The main [`TerminationCondition`] is a condition which is polled by the [`Solver`] during
82 //! the search process. It indicates when the [`Solver`] should stop, even if no definitive
83 //! conclusions have been made.
84 //!
85 //! The most common example would be [`TimeBudget`], which terminates the [`Solver`] whenever
86 //! the time budget is exceeded.
87 pub use crate::engine::termination::combinator::*;
88 pub use crate::engine::termination::indefinite::*;
89 pub use crate::engine::termination::time_budget::*;
90 pub use crate::engine::termination::TerminationCondition;
91 #[cfg(doc)]
92 use crate::Solver;
93}
94
95pub mod predicates {
96 //! Contains structures which represent certain [predicates](https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)).
97 //!
98 //! The solver only utilizes the following types of predicates:
99 //! - A predicate of the form `[x >= v]`
100 //! - A predicate of the form `[x <= v]`
101 //! - A predicate of the form `[x = v]`
102 //! - A predicate of the form `[x != v]`
103 //!
104 //! In general, these [`Predicate`]s are used to represent propagations, explanations or
105 //! decisions.
106 pub use crate::basic_types::PropositionalConjunction;
107 pub use crate::engine::predicates::predicate::Predicate;
108 pub use crate::engine::predicates::predicate::PredicateType;
109 pub use crate::engine::predicates::predicate_constructor::PredicateConstructor;
110 #[cfg(doc)]
111 use crate::variables::Literal;
112}
113
114pub use crate::basic_types::Function;
115
116#[doc(hidden)]
117pub mod asserts {
118 pub use crate::pumpkin_assert_advanced;
119 pub use crate::pumpkin_assert_eq_simple;
120 pub use crate::pumpkin_assert_extreme;
121 pub use crate::pumpkin_assert_moderate;
122 pub use crate::pumpkin_assert_ne_moderate;
123 pub use crate::pumpkin_assert_ne_simple;
124 pub use crate::pumpkin_assert_simple;
125 pub use crate::pumpkin_asserts::PUMPKIN_ASSERT_ADVANCED;
126 pub use crate::pumpkin_asserts::PUMPKIN_ASSERT_EXTREME;
127 pub use crate::pumpkin_asserts::PUMPKIN_ASSERT_LEVEL_DEFINITION;
128 pub use crate::pumpkin_asserts::PUMPKIN_ASSERT_MODERATE;
129 pub use crate::pumpkin_asserts::PUMPKIN_ASSERT_SIMPLE;
130}