pub trait IntegerVariable:
Clone
+ PredicateConstructor<Value = i32>
+ TransformableVariable<Self::AffineView> {
type AffineView: IntegerVariable;
// Required methods
fn lower_bound(&self, assignment: &AssignmentsInteger) -> i32;
fn upper_bound(&self, assignment: &AssignmentsInteger) -> i32;
fn contains(&self, assignment: &AssignmentsInteger, value: i32) -> bool;
fn describe_domain(&self, assignment: &AssignmentsInteger) -> Vec<Predicate>;
fn remove(
&self,
assignment: &mut AssignmentsInteger,
value: i32,
reason: Option<ReasonRef>,
) -> Result<(), EmptyDomain>;
fn set_lower_bound(
&self,
assignment: &mut AssignmentsInteger,
value: i32,
reason: Option<ReasonRef>,
) -> Result<(), EmptyDomain>;
fn set_upper_bound(
&self,
assignment: &mut AssignmentsInteger,
value: i32,
reason: Option<ReasonRef>,
) -> Result<(), EmptyDomain>;
fn watch_all(
&self,
watchers: &mut Watchers<'_>,
events: EnumSet<IntDomainEvent>,
);
fn watch_all_backtrack(
&self,
watchers: &mut Watchers<'_>,
events: EnumSet<IntDomainEvent>,
);
fn unpack_event(&self, event: OpaqueDomainEvent) -> IntDomainEvent;
}Expand description
A trait specifying the required behaviour of an integer variable such as retrieving a
lower-bound (IntegerVariable::lower_bound) or adjusting the bounds
(IntegerVariable::set_lower_bound).
Required Associated Types§
Required Methods§
sourcefn lower_bound(&self, assignment: &AssignmentsInteger) -> i32
fn lower_bound(&self, assignment: &AssignmentsInteger) -> i32
Get the lower bound of the variable.
sourcefn upper_bound(&self, assignment: &AssignmentsInteger) -> i32
fn upper_bound(&self, assignment: &AssignmentsInteger) -> i32
Get the upper bound of the variable.
sourcefn contains(&self, assignment: &AssignmentsInteger, value: i32) -> bool
fn contains(&self, assignment: &AssignmentsInteger, value: i32) -> bool
Determine whether the value is in the domain of this variable.
sourcefn describe_domain(&self, assignment: &AssignmentsInteger) -> Vec<Predicate>
fn describe_domain(&self, assignment: &AssignmentsInteger) -> Vec<Predicate>
Get a predicate description (bounds + holes) of the domain of this variable. N.B. can be very expensive with large domains, and very large with holey domains
This should not be used to explicitly check for holes in the domain, but only to build explanations. If views change the observed domain, they will not change this description, because it should be a description of the domain in the solver.
sourcefn remove(
&self,
assignment: &mut AssignmentsInteger,
value: i32,
reason: Option<ReasonRef>,
) -> Result<(), EmptyDomain>
fn remove( &self, assignment: &mut AssignmentsInteger, value: i32, reason: Option<ReasonRef>, ) -> Result<(), EmptyDomain>
Remove a value from the domain of this variable.
sourcefn set_lower_bound(
&self,
assignment: &mut AssignmentsInteger,
value: i32,
reason: Option<ReasonRef>,
) -> Result<(), EmptyDomain>
fn set_lower_bound( &self, assignment: &mut AssignmentsInteger, value: i32, reason: Option<ReasonRef>, ) -> Result<(), EmptyDomain>
Tighten the lower bound of the domain of this variable.
sourcefn set_upper_bound(
&self,
assignment: &mut AssignmentsInteger,
value: i32,
reason: Option<ReasonRef>,
) -> Result<(), EmptyDomain>
fn set_upper_bound( &self, assignment: &mut AssignmentsInteger, value: i32, reason: Option<ReasonRef>, ) -> Result<(), EmptyDomain>
Tighten the upper bound of the domain of this variable.
sourcefn watch_all(
&self,
watchers: &mut Watchers<'_>,
events: EnumSet<IntDomainEvent>,
)
fn watch_all( &self, watchers: &mut Watchers<'_>, events: EnumSet<IntDomainEvent>, )
Register a watch for this variable on the given domain events.
fn watch_all_backtrack( &self, watchers: &mut Watchers<'_>, events: EnumSet<IntDomainEvent>, )
sourcefn unpack_event(&self, event: OpaqueDomainEvent) -> IntDomainEvent
fn unpack_event(&self, event: OpaqueDomainEvent) -> IntDomainEvent
Decode a domain event for this variable.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.