Skip to main content

ActivityTable

Struct ActivityTable 

Source
pub struct ActivityTable {
    pq: KeyedPriorityQueue<usize, OrderedFloat<f64>>,
    activities: Vec<f64>,
    var_inc: f64,
    var_decay: f64,
}
Expand description

VSIDS 的变量活跃度表。

启发式目标:

  • 冲突相关变量会被 bump,分数上升;
  • var_inc 随冲突递增并经衰减控制,强调近期冲突;
  • 通过优先队列选取当前分数最高的未赋值变量。

例:设初始 var_inc = 1.0var_decay = 0.8

  • 第 1 次冲突命中变量 vactivity[v] += 1.0
  • 调用 decay_inc() 后:var_inc = 1.25
  • 第 2 次冲突再次命中 vactivity[v] += 1.25

因而近期冲突对分数贡献更大,变量选择会更偏向“最近导致冲突”的区域。

Fields§

§pq: KeyedPriorityQueue<usize, OrderedFloat<f64>>§activities: Vec<f64>§var_inc: f64§var_decay: f64

Implementations§

Source§

impl ActivityTable

Source

pub fn new(max_vars: usize) -> Self

初始化活跃度表并把所有变量放入优先队列。

Source

pub fn bump_var_score(&mut self, var_id: usize)

提升变量活跃度(通常在冲突分析中调用)。

若变量已在堆中,更新其优先级; 若暂不在堆中,按当前活跃度重新插入。

Source

pub fn decay_inc(&mut self)

增大“本轮 bump 的权重”,体现 EVSIDS 的近期偏好。

Source

pub fn bump_decay_factor(&mut self)

调整衰减系数,逐步降低历史冲突的影响。

Source

pub fn next_variable<F>(&mut self, not_assigned: &F) -> Option<usize>
where F: Fn(usize) -> bool,

选取下一个未赋值变量。

not_assigned 由调用方提供,用于过滤当前已赋值变量。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more