pub struct Weighted {
pub var: VarId,
pub weights: Vec<Weight>,
pub measure: Measure,
}Expand description
A variable drawn by weight instead of uniformly (a dist selector, C6):
code c is chosen with probability proportional to
weights[c] * measure(c) among the codes that are still feasible; a code
with weight 0, or beyond weights.len(), is never chosen.
With Measure::Distinct this is exact for LRM 18.5.3: the selector’s
code is an item of the dist, its weight the item’s per-value weight, and
the measure the number of values of the subject that are both in the item
and still feasible, so the probability of a feasible value is proportional
to the sum of the per-value weights of the items that contain it, however
the items overlap or the other constraints exclude values.
Fields§
§var: VarIdThe variable.
weights: Vec<Weight>The weight of each value of the variable, indexed by value.
measure: MeasureWhat a code stands for.
Trait Implementations§
impl Eq for Weighted
impl StructuralPartialEq for Weighted
Auto Trait Implementations§
impl Freeze for Weighted
impl RefUnwindSafe for Weighted
impl Send for Weighted
impl Sync for Weighted
impl Unpin for Weighted
impl UnsafeUnpin for Weighted
impl UnwindSafe for Weighted
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.