Struct satoxid::constraints::Expr [−][src]
pub struct Expr<V> { /* fields omitted */ }
Expand description
Tseytin Encoding of propositional logic formulas.
Allows encoding of arbitrary boolean formulas.
It implements the BitAnd
, BitOr
and Not
traits, which should be used for
the construction of boolean formulas.
Example
let expr = !(Expr::new("a") | "b") & "c"; // encoding the formula !(a | b) & c encoder.add_constraint(expr); if let Some(model) = encoder.solve() { assert!(model.lit(Lit::Neg("a")).unwrap()); assert!(model.lit(Lit::Neg("b")).unwrap()); assert!(model.lit(Lit::Pos("c")).unwrap()); }
NOTE: If you just want to ‘and’ or ‘or’ a bunch of literals use And
or Or
for more efficient encodings.
Implementations
impl<V: SatVar> Expr<V>
[src]
impl<V: SatVar> Expr<V>
[src]pub fn from_constraint<C>(constraint: C) -> Self where
C: ConstraintRepr<V> + 'static,
[src]
pub fn from_constraint<C>(constraint: C) -> Self where
C: ConstraintRepr<V> + 'static,
[src]Create new Expr
from given constraint.
Trait Implementations
impl<V: SatVar> Constraint<V> for Expr<V>
[src]
impl<V: SatVar> Constraint<V> for Expr<V>
[src]impl<V: SatVar> ConstraintRepr<V> for Expr<V>
[src]
impl<V: SatVar> ConstraintRepr<V> for Expr<V>
[src]fn encode_constraint_implies_repr<B: Backend>(
self,
repr: Option<i32>,
backend: &mut B,
varmap: &mut VarMap<V>
) -> i32
[src]
fn encode_constraint_implies_repr<B: Backend>(
self,
repr: Option<i32>,
backend: &mut B,
varmap: &mut VarMap<V>
) -> i32
[src]Encode if Self
is satisified, that repr
is true.
Otherwise repr
is not constrained and can be true or false. Read more
fn encode_constraint_equals_repr<B: Backend>(
self,
repr: Option<i32>,
backend: &mut B,
varmap: &mut VarMap<V>
) -> i32
[src]
fn encode_constraint_equals_repr<B: Backend>(
self,
repr: Option<i32>,
backend: &mut B,
varmap: &mut VarMap<V>
) -> i32
[src]Encode if and only if Self
is satisified, that repr
is true.
fn encode_constraint_repr_cheap<B: Backend>(
self,
repr: Option<i32>,
backend: &mut B,
varmap: &mut VarMap<V>
) -> i32
[src]
fn encode_constraint_repr_cheap<B: Backend>(
self,
repr: Option<i32>,
backend: &mut B,
varmap: &mut VarMap<V>
) -> i32
[src]Encode that repr is true if the constraint is satisfied.
The implementation can decide if it has the semantics of
encode_constraint_implies_repr
or encode_constraint_equals_repr
,
depending on what is cheaper to encode. Read more
Auto Trait Implementations
impl<V> !RefUnwindSafe for Expr<V>
impl<V> !Send for Expr<V>
impl<V> !Sync for Expr<V>
impl<V> Unpin for Expr<V> where
V: Unpin,
V: Unpin,
impl<V> !UnwindSafe for Expr<V>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more