// initialise the RuleCube by creating the top-left corner item RuleCube::RuleCube(const ChartTranslationOptions &transOpt, const ChartCellCollection &allChartCells, ChartManager &manager) : m_transOpt(transOpt) { RuleCubeItem *item = new RuleCubeItem(transOpt, allChartCells); m_covered.insert(item); if (StaticData::Instance().GetCubePruningLazyScoring()) { item->EstimateScore(); } else { item->CreateHypothesis(transOpt, manager); } m_queue.push(item); }
void RuleCube::CreateNeighbor(const RuleCubeItem &item, int dimensionIndex, ChartManager &manager) { RuleCubeItem *newItem = new RuleCubeItem(item, dimensionIndex); std::pair<ItemSet::iterator, bool> result = m_covered.insert(newItem); if (!result.second) { delete newItem; // already seen it } else { if (StaticData::Instance().GetCubePruningLazyScoring()) { newItem->EstimateScore(); } else { newItem->CreateHypothesis(m_transOpt, manager); } m_queue.push(newItem); } }