Beispiel #1
0
  //
  // DeleteArguments
  //
  // Deletes command line arguments
  //
  void CmdParse::DeleteArguments()
  {
    VarPathIdent argPath;

    // Delete all existing arguments
    Utils::Sprintf(argPath.str, VARSYS_MAXVARPATH, "console.stack%d", StackLevel());
    VarSys::DeleteItem(argPath.str);
  }
Beispiel #2
0
void Solver::decideLiteral() {
	// establish another decision stack level
	stack_.push_back(
			StackLevel(stack_.top().currentRemainingComponent(),
					literal_stack_.size(),
					component_analyzer_.component_stack_size()));
	float score;
	float max_score_remembered = -1;
	float max_score_forgotten = -1;
	unsigned max_score_var = 0;
	unsigned max_score_var_remembered = 0;
	unsigned max_score_var_forgotten = 0;
	for (auto it =
			component_analyzer_.superComponentOf(stack_.top()).varsBegin();
			*it != varsSENTINEL; it++) {
		score = scoreOf(*it);
		if (rememberedVarNums.find(*it) != rememberedVarNums.end()) {
			if (score > max_score_remembered) {
				max_score_remembered = score;
				max_score_var_remembered = *it;
			}
		} else {
			if (score > max_score_forgotten) {
				max_score_forgotten = score;
				max_score_var_forgotten = *it;
			}
		}

	}

	if (max_score_var_remembered != 0 ) {
		max_score_var = max_score_var_remembered;
	} else if (max_score_var_forgotten != 0 ) {
		max_score_var = max_score_var_forgotten;
	} else assert(0);

	// this assert should always hold,
	// if not then there is a bug in the logic of countSAT();
	assert(max_score_var != 0);

	LiteralID theLit(max_score_var,
			literal(LiteralID(max_score_var, true)).activity_score_
					> literal(LiteralID(max_score_var, false)).activity_score_);

	setLiteralIfFree(theLit);
	statistics_.num_decisions_++;

	if (statistics_.num_decisions_ % 128 == 0)
		decayActivities();

	assert(
			stack_.top().remaining_components_ofs() <= component_analyzer_.component_stack_size());
}