本文整理汇总了C++中StateType::weight方法的典型用法代码示例。如果您正苦于以下问题:C++ StateType::weight方法的具体用法?C++ StateType::weight怎么用?C++ StateType::weight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StateType
的用法示例。
在下文中一共展示了StateType::weight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_plus
static void handle_plus(StateType& state, typename StateType::clause_type clause, typename StateType::variable_type flip)
{
if(state.num_true_literals(clause) == 0)
{
state.inc_breakcount(flip, state.weight(clause));
state.watcher1(clause, flip);
}
else if(state.num_true_literals(clause) == 1)
{
state.dec_breakcount(state.watcher1(clause), state.weight(clause));
state.watcher2(clause, flip);
}
state.inc_num_true_literals(clause);
}
示例2: handle_minus
static void handle_minus(StateType& state, typename StateType::clause_type clause, typename StateType::variable_type flip)
{
if(state.num_true_literals(clause) == 1)
{
for(auto literal : clause)
state.inc_makecount(literal.variable(), state.weight(clause));
state.dec_breakcount(flip, state.weight(clause));
}
else if(state.num_true_literals(clause) == 2)
{
if(flip == state.watcher1(clause))
state.watcher1(clause, state.watcher2(clause));
state.inc_breakcount(state.watcher1(clause), state.weight(clause));
}
else
{
if(flip == state.watcher1(clause))
{
for(auto literal : clause)
if(state.is_sat(literal) &&
literal.variable() != flip &&
literal.variable() != state.watcher2(clause))
{
state.watcher1(clause, literal.variable());
break;
}
}
else if(flip == state.watcher2(clause))
for(auto literal : clause)
if(state.is_sat(literal) &&
literal.variable() != flip &&
literal.variable() != state.watcher1(clause))
{
state.watcher2(clause, literal.variable());
break;
}
}
state.dec_num_true_literals(clause);
}