pub enum Expression {
Show 25 variants
Bubble(Metadata, Box<Expression>, Box<Expression>),
FactorE(Metadata, Factor),
Sum(Metadata, Vec<Expression>),
Min(Metadata, Vec<Expression>),
Max(Metadata, Vec<Expression>),
Not(Metadata, Box<Expression>),
Or(Metadata, Vec<Expression>),
And(Metadata, Vec<Expression>),
Eq(Metadata, Box<Expression>, Box<Expression>),
Neq(Metadata, Box<Expression>, Box<Expression>),
Geq(Metadata, Box<Expression>, Box<Expression>),
Leq(Metadata, Box<Expression>, Box<Expression>),
Gt(Metadata, Box<Expression>, Box<Expression>),
Lt(Metadata, Box<Expression>, Box<Expression>),
SafeDiv(Metadata, Box<Expression>, Box<Expression>),
UnsafeDiv(Metadata, Box<Expression>, Box<Expression>),
SumEq(Metadata, Vec<Expression>, Box<Expression>),
SumGeq(Metadata, Vec<Expression>, Box<Expression>),
SumLeq(Metadata, Vec<Expression>, Box<Expression>),
DivEq(Metadata, Box<Expression>, Box<Expression>, Box<Expression>),
Ineq(Metadata, Box<Expression>, Box<Expression>, Box<Expression>),
AllDiff(Metadata, Vec<Expression>),
WatchedLiteral(Metadata, Name, Literal),
Reify(Metadata, Box<Expression>, Box<Expression>),
AuxDeclaration(Metadata, Name, Box<Expression>),
}
Expand description
Variants§
Bubble(Metadata, Box<Expression>, Box<Expression>)
An expression representing “A is valid as long as B is true” Turns into a conjunction when it reaches a boolean context
FactorE(Metadata, Factor)
Sum(Metadata, Vec<Expression>)
Supported by: Minion, JsonInput.
Min(Metadata, Vec<Expression>)
Supported by: JsonInput.
Max(Metadata, Vec<Expression>)
Supported by: JsonInput.
Not(Metadata, Box<Expression>)
Supported by: JsonInput, SAT.
Or(Metadata, Vec<Expression>)
Supported by: JsonInput, SAT.
And(Metadata, Vec<Expression>)
Supported by: JsonInput, SAT.
Eq(Metadata, Box<Expression>, Box<Expression>)
Supported by: JsonInput.
Neq(Metadata, Box<Expression>, Box<Expression>)
Supported by: JsonInput.
Geq(Metadata, Box<Expression>, Box<Expression>)
Supported by: JsonInput.
Leq(Metadata, Box<Expression>, Box<Expression>)
Supported by: JsonInput.
Gt(Metadata, Box<Expression>, Box<Expression>)
Supported by: JsonInput.
Lt(Metadata, Box<Expression>, Box<Expression>)
Supported by: JsonInput.
SafeDiv(Metadata, Box<Expression>, Box<Expression>)
Division after preventing division by zero, usually with a bubble
UnsafeDiv(Metadata, Box<Expression>, Box<Expression>)
Division with a possibly undefined value (division by 0) Supported by: JsonInput.
SumEq(Metadata, Vec<Expression>, Box<Expression>)
SumGeq(Metadata, Vec<Expression>, Box<Expression>)
Supported by: Minion.
SumLeq(Metadata, Vec<Expression>, Box<Expression>)
Supported by: Minion.
DivEq(Metadata, Box<Expression>, Box<Expression>, Box<Expression>)
Supported by: Minion.
Ineq(Metadata, Box<Expression>, Box<Expression>, Box<Expression>)
Supported by: Minion.
AllDiff(Metadata, Vec<Expression>)
Supported by: Minion.
WatchedLiteral(Metadata, Name, Literal)
w-literal(x,k) is SAT iff x == k, where x is a variable and k a constant.
This is a low-level Minion constraint and you should (probably) use Eq instead. The main use of w-literal is to convert boolean variables to constraints so that they can be used inside watched-and and watched-or.
See rules::minion::boolean_literal_to_wliteral
.
Supported by: Minion.
Reify(Metadata, Box<Expression>, Box<Expression>)
Supported by: Minion.
AuxDeclaration(Metadata, Name, Box<Expression>)
Declaration of an auxiliary variable.
As with Savile Row, we semantically distinguish this from Eq
.
Supported by: Minion.
Implementations§
Source§impl Expression
impl Expression
Sourcepub fn domain_of(
&self,
vars: &HashMap<Name, DecisionVariable>,
) -> Option<Domain>
pub fn domain_of( &self, vars: &HashMap<Name, DecisionVariable>, ) -> Option<Domain>
Returns the possible values of the expression, recursing to leaf expressions
pub fn get_meta(&self) -> Metadata
pub fn set_meta(&self, meta: Metadata)
pub fn can_be_undefined(&self) -> bool
pub fn return_type(&self) -> Option<ReturnType>
pub fn is_clean(&self) -> bool
pub fn set_clean(&mut self, bool_value: bool)
pub fn as_factor(&self) -> Option<Factor>
Trait Implementations§
Source§impl Biplate<Expression> for Expression
impl Biplate<Expression> for Expression
Source§fn biplate(
&self,
) -> (Tree<Expression>, Box<dyn Fn(Tree<Expression>) -> Expression>)
fn biplate( &self, ) -> (Tree<Expression>, Box<dyn Fn(Tree<Expression>) -> Expression>)
§fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
fn universe_bi(&self) -> Vector<To>
§fn children_bi(&self) -> Vector<To>
fn children_bi(&self) -> Vector<To>
fn transform_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
Source§impl Biplate<Expression> for Factor
impl Biplate<Expression> for Factor
Source§fn biplate(&self) -> (Tree<Expression>, Box<dyn Fn(Tree<Expression>) -> Factor>)
fn biplate(&self) -> (Tree<Expression>, Box<dyn Fn(Tree<Expression>) -> Factor>)
§fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
fn universe_bi(&self) -> Vector<To>
§fn children_bi(&self) -> Vector<To>
fn children_bi(&self) -> Vector<To>
fn transform_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
Source§impl Biplate<Factor> for Expression
impl Biplate<Factor> for Expression
Source§fn biplate(&self) -> (Tree<Factor>, Box<dyn Fn(Tree<Factor>) -> Expression>)
fn biplate(&self) -> (Tree<Factor>, Box<dyn Fn(Tree<Factor>) -> Expression>)
§fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
fn universe_bi(&self) -> Vector<To>
§fn children_bi(&self) -> Vector<To>
fn children_bi(&self) -> Vector<To>
fn transform_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
Source§impl Biplate<Literal> for Expression
impl Biplate<Literal> for Expression
Source§fn biplate(&self) -> (Tree<Literal>, Box<dyn Fn(Tree<Literal>) -> Expression>)
fn biplate(&self) -> (Tree<Literal>, Box<dyn Fn(Tree<Literal>) -> Expression>)
§fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
fn universe_bi(&self) -> Vector<To>
§fn children_bi(&self) -> Vector<To>
fn children_bi(&self) -> Vector<To>
fn transform_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
Source§impl Biplate<Metadata> for Expression
impl Biplate<Metadata> for Expression
Source§fn biplate(&self) -> (Tree<Metadata>, Box<dyn Fn(Tree<Metadata>) -> Expression>)
fn biplate(&self) -> (Tree<Metadata>, Box<dyn Fn(Tree<Metadata>) -> Expression>)
§fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
fn universe_bi(&self) -> Vector<To>
§fn children_bi(&self) -> Vector<To>
fn children_bi(&self) -> Vector<To>
fn transform_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
Source§impl Biplate<Name> for Expression
impl Biplate<Name> for Expression
Source§fn biplate(&self) -> (Tree<Name>, Box<dyn Fn(Tree<Name>) -> Expression>)
fn biplate(&self) -> (Tree<Name>, Box<dyn Fn(Tree<Name>) -> Expression>)
§fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
fn universe_bi(&self) -> Vector<To>
§fn children_bi(&self) -> Vector<To>
fn children_bi(&self) -> Vector<To>
fn transform_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Expression
impl Debug for Expression
Source§impl<'de> Deserialize<'de> for Expression
impl<'de> Deserialize<'de> for Expression
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Expression, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Expression, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for Expression
impl Display for Expression
Source§impl From<Factor> for Expression
impl From<Factor> for Expression
Source§fn from(value: Factor) -> Expression
fn from(value: Factor) -> Expression
Source§impl From<bool> for Expression
impl From<bool> for Expression
Source§fn from(b: bool) -> Expression
fn from(b: bool) -> Expression
Source§impl From<i32> for Expression
impl From<i32> for Expression
Source§fn from(i: i32) -> Expression
fn from(i: i32) -> Expression
Source§impl PartialEq for Expression
impl PartialEq for Expression
Source§impl Serialize for Expression
impl Serialize for Expression
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl Uniplate for Expression
impl Uniplate for Expression
fn uniplate( &self, ) -> (Tree<Expression>, Box<dyn Fn(Tree<Expression>) -> Expression>)
fn descend(&self, op: Arc<dyn Fn(Self) -> Self>) -> Self
§fn with_children(&self, children: Vector<Self>) -> Self
fn with_children(&self, children: Vector<Self>) -> Self
§fn transform(&self, f: Arc<dyn Fn(Self) -> Self>) -> Self
fn transform(&self, f: Arc<dyn Fn(Self) -> Self>) -> Self
impl Eq for Expression
impl StructuralPartialEq for Expression
Auto Trait Implementations§
impl Freeze for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more