int setFactorsParams (void) { return TRUE; // TODO FactorGraph* fg = (FactorGraph*) YAP_IntOfTerm (YAP_ARG1); YAP_Term distList = YAP_ARG2; unordered_map<unsigned, Params> paramsMap; while (distList != YAP_TermNil()) { YAP_Term dist = YAP_HeadOfTerm (distList); unsigned distId = (unsigned) YAP_IntOfTerm (YAP_ArgOfTerm (1, dist)); assert (Util::contains (paramsMap, distId) == false); paramsMap[distId] = readParameters (YAP_ArgOfTerm (2, dist)); distList = YAP_TailOfTerm (distList); } const FacNodes& facNodes = fg->facNodes(); for (size_t i = 0; i < facNodes.size(); i++) { unsigned distId = facNodes[i]->factor().distId(); assert (Util::contains (paramsMap, distId)); facNodes[i]->factor().setParams (paramsMap[distId]); } return TRUE; }
CFactorGraph::CFactorGraph (const FactorGraph& fg) { groundFg_ = &fg; freeColor_ = 0; const VarNodes& varNodes = fg.varNodes(); varSignatures_.reserve (varNodes.size()); for (unsigned i = 0; i < varNodes.size(); i++) { unsigned c = (varNodes[i]->neighbors().size() * 2) + 1; varSignatures_.push_back (Signature (c)); } const FacNodes& facNodes = fg.facNodes(); facSignatures_.reserve (facNodes.size()); for (unsigned i = 0; i < facNodes.size(); i++) { unsigned c = facNodes[i]->neighbors().size() + 1; facSignatures_.push_back (Signature (c)); } varColors_.resize (varNodes.size()); facColors_.resize (facNodes.size()); setInitialColors(); createGroups(); }