Struct satoxid::Encoder[][src]

pub struct Encoder<V, S> {
    pub backend: S,
    pub varmap: VarMap<V>,
    pub debug: bool,
}
Expand description

The Encoder type contains all data used for the encoding.

Fields

backend: Svarmap: VarMap<V>debug: bool

Implementations

impl<V: SatVar, S: Default> Encoder<V, S>[src]

pub fn new() -> Self[src]

Creates a new encoder.

pub fn with_debug() -> Self[src]

Creates a new encoder and will print out every encoded constraint.

impl<V, B> Encoder<V, B> where
    V: SatVar,
    B: Backend
[src]

pub fn with_backend(backend: B) -> Self[src]

Create a new Encoder using backend as the Backend.

pub fn add_constraint<C: Constraint<V>>(&mut self, constraint: C)[src]

Encode a constraint.

pub fn add_constraint_implies_repr<C: ConstraintRepr<V>>(
    &mut self,
    constraint: C
) -> VarType<V>
[src]

Encode a constraint such that a variable represents it. If the constraint in the solved model is true, the return variable (repr) will also be true. Otherwise there it doesn’t constrain repr which can either be true or false.

pub fn add_constraint_equals_repr<C: ConstraintRepr<V>>(
    &mut self,
    constraint: C
) -> VarType<V>
[src]

Encode a constraint such that a variable represents it. Like add_constraint_implies_repr but the value of repr will equal the constraint satisfied. So if constraint wasn’t satisfied, repr will be false.

impl<V: SatVar, S: Solver> Encoder<V, S>[src]

pub fn solve(&mut self) -> Option<Model<V>>[src]

Solve the encoded problem. If problem is unsat then None is returned. Otherwise a model of the problem is returned.

Auto Trait Implementations

impl<V, S> RefUnwindSafe for Encoder<V, S> where
    S: RefUnwindSafe,
    V: RefUnwindSafe

impl<V, S> Send for Encoder<V, S> where
    S: Send,
    V: Send

impl<V, S> Sync for Encoder<V, S> where
    S: Sync,
    V: Sync

impl<V, S> Unpin for Encoder<V, S> where
    S: Unpin,
    V: Unpin

impl<V, S> UnwindSafe for Encoder<V, S> where
    S: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.