uint32 ClingoPropagatorInit::init(uint32 lastStep, Potassco::AbstractSolver& s) { POTASSCO_REQUIRE(s.id() < 64, "Invalid solver id"); int16 sId = static_cast<int16>(s.id()); if (history_ && (step_ - lastStep) > 1) { for (History::const_iterator it = history_->begin(), end = history_->end(); it != end; ++it) { if (test_bit(it->second, sId)) { Change(it->first, AddWatch, sId).apply(s); } } } ChangeList changesForSolver; for (ChangeList::const_iterator it = changes_.begin(), end = changes_.end(); it != end; ++it) { if (it->sId < 0 || it->sId == sId) { changesForSolver.push_back(*it); } } std::stable_sort(changesForSolver.begin(), changesForSolver.end()); for (ChangeList::const_iterator it = changesForSolver.begin(), end = changesForSolver.end(); it != end; ++it) { Lit_t lit = it->lit; // skip all but the last change for a given literal while ((it + 1) != end && (it + 1)->lit == lit) { ++it; } it->apply(s); } return step_; }
void Game::unloadTalkTables(ChangeList &changes) { for (std::list<Common::ChangeID>::iterator t = changes.begin(); t != changes.end(); ++t) TalkMan.removeTable(*t); changes.clear(); }