pub trait PseudoBooleanFunction: Function {
type Number: NumberBase;
Show 18 methods
// Required methods
fn constant_edge<'id>(
manager: &Self::Manager<'id>,
value: Self::Number,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
fn var_edge<'id>(
manager: &Self::Manager<'id>,
var: VarNo,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
fn add_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
fn sub_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
fn mul_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
fn div_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
fn min_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
fn max_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
fn eval_edge<'id>(
manager: &Self::Manager<'id>,
edge: &EdgeOfFunc<'id, Self>,
args: impl IntoIterator<Item = (VarNo, bool)>,
) -> Self::Number;
// Provided methods
fn constant<'id>(
manager: &Self::Manager<'id>,
value: Self::Number,
) -> AllocResult<Self> { ... }
fn var<'id>(manager: &Self::Manager<'id>, var: VarNo) -> AllocResult<Self> { ... }
fn add(&self, rhs: &Self) -> AllocResult<Self> { ... }
fn sub(&self, rhs: &Self) -> AllocResult<Self> { ... }
fn mul(&self, rhs: &Self) -> AllocResult<Self> { ... }
fn div(&self, rhs: &Self) -> AllocResult<Self> { ... }
fn min(&self, rhs: &Self) -> AllocResult<Self> { ... }
fn max(&self, rhs: &Self) -> AllocResult<Self> { ... }
fn eval(
&self,
args: impl IntoIterator<Item = (VarNo, bool)>,
) -> Self::Number { ... }
}Expand description
Pseudo-Boolean function đšâż â â
Required Associated Types§
Sourcetype Number: NumberBase
type Number: NumberBase
The number type used for the functionsâ target set.
Required Methods§
Sourcefn constant_edge<'id>(
manager: &Self::Manager<'id>,
value: Self::Number,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn constant_edge<'id>( manager: &Self::Manager<'id>, value: Self::Number, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Edge version of Self::constant()
Sourcefn var_edge<'id>(
manager: &Self::Manager<'id>,
var: VarNo,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn var_edge<'id>( manager: &Self::Manager<'id>, var: VarNo, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Edge version of Self::var()
Sourcefn add_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn add_edge<'id>( manager: &Self::Manager<'id>, lhs: &EdgeOfFunc<'id, Self>, rhs: &EdgeOfFunc<'id, Self>, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Edge version of Self::add()
Sourcefn sub_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn sub_edge<'id>( manager: &Self::Manager<'id>, lhs: &EdgeOfFunc<'id, Self>, rhs: &EdgeOfFunc<'id, Self>, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Edge version of Self::sub()
Sourcefn mul_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn mul_edge<'id>( manager: &Self::Manager<'id>, lhs: &EdgeOfFunc<'id, Self>, rhs: &EdgeOfFunc<'id, Self>, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Edge version of Self::mul()
Sourcefn div_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn div_edge<'id>( manager: &Self::Manager<'id>, lhs: &EdgeOfFunc<'id, Self>, rhs: &EdgeOfFunc<'id, Self>, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Edge version of Self::div()
Sourcefn min_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn min_edge<'id>( manager: &Self::Manager<'id>, lhs: &EdgeOfFunc<'id, Self>, rhs: &EdgeOfFunc<'id, Self>, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Edge version of Self::min()
Sourcefn max_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn max_edge<'id>( manager: &Self::Manager<'id>, lhs: &EdgeOfFunc<'id, Self>, rhs: &EdgeOfFunc<'id, Self>, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Edge version of Self::max()
Sourcefn eval_edge<'id>(
manager: &Self::Manager<'id>,
edge: &EdgeOfFunc<'id, Self>,
args: impl IntoIterator<Item = (VarNo, bool)>,
) -> Self::Number
fn eval_edge<'id>( manager: &Self::Manager<'id>, edge: &EdgeOfFunc<'id, Self>, args: impl IntoIterator<Item = (VarNo, bool)>, ) -> Self::Number
Edge version of Self::eval()
Provided Methods§
Sourcefn constant<'id>(
manager: &Self::Manager<'id>,
value: Self::Number,
) -> AllocResult<Self>
fn constant<'id>( manager: &Self::Manager<'id>, value: Self::Number, ) -> AllocResult<Self>
Get the constant value
Sourcefn var<'id>(manager: &Self::Manager<'id>, var: VarNo) -> AllocResult<Self>
fn var<'id>(manager: &Self::Manager<'id>, var: VarNo) -> AllocResult<Self>
Get the function that is 1 if the variable is true and 0 otherwise.
Panics if var is greater or equal to the number of variables in
manager.
Sourcefn add(&self, rhs: &Self) -> AllocResult<Self>
fn add(&self, rhs: &Self) -> AllocResult<Self>
Point-wise addition self + rhs
Locking behavior: acquires a shared manager lock
Panics if self and rhs do not belong to the same manager.
Sourcefn sub(&self, rhs: &Self) -> AllocResult<Self>
fn sub(&self, rhs: &Self) -> AllocResult<Self>
Point-wise subtraction self - rhs
Locking behavior: acquires a shared manager lock
Panics if self and rhs do not belong to the same manager.
Sourcefn mul(&self, rhs: &Self) -> AllocResult<Self>
fn mul(&self, rhs: &Self) -> AllocResult<Self>
Point-wise multiplication self * rhs
Locking behavior: acquires a shared manager lock
Panics if self and rhs do not belong to the same manager.
Sourcefn div(&self, rhs: &Self) -> AllocResult<Self>
fn div(&self, rhs: &Self) -> AllocResult<Self>
Point-wise division self / rhs
Locking behavior: acquires a shared manager lock
Panics if self and rhs do not belong to the same manager.
Sourcefn min(&self, rhs: &Self) -> AllocResult<Self>
fn min(&self, rhs: &Self) -> AllocResult<Self>
Point-wise minimum min(self, rhs)
Locking behavior: acquires a shared manager lock
Panics if self and rhs do not belong to the same manager.
Sourcefn max(&self, rhs: &Self) -> AllocResult<Self>
fn max(&self, rhs: &Self) -> AllocResult<Self>
Point-wise maximum max(self, rhs)
Locking behavior: acquires a shared manager lock
Panics if self and rhs do not belong to the same manager.
Sourcefn eval(&self, args: impl IntoIterator<Item = (VarNo, bool)>) -> Self::Number
fn eval(&self, args: impl IntoIterator<Item = (VarNo, bool)>) -> Self::Number
Evaluate this function
args consists of pairs (variable, value) and determines the
valuation for all variables in the functionâs domain. The order is
irrelevant (except that if the valuation for a variable is given
multiple times, the last value counts).
Should there be a decision node for a variable not part of the domain,
then unknown is used as the decision value.
Locking behavior: acquires the managerâs lock for shared access.
Panics if any variable number in args is larger that the number of
variables in the containing manager.
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.