minor updates
This commit is contained in:
parent
92d8c7dcbe
commit
2bef3f6866
@ -278,10 +278,14 @@ BpSolver::calculateFactor2VariableMsg (SpLink* link)
|
|||||||
const SpLinkSet& links = ninf(src)->getLinks();
|
const SpLinkSet& links = ninf(src)->getLinks();
|
||||||
// calculate the product of messages that were sent
|
// calculate the product of messages that were sent
|
||||||
// to factor `src', except from var `dst'
|
// to factor `src', except from var `dst'
|
||||||
unsigned msgSize = 1;
|
Params::size_type msgSize = 1;
|
||||||
for (unsigned i = 0; i < links.size(); i++) {
|
for (unsigned i = 0; i < links.size(); i++) {
|
||||||
msgSize *= links[i]->getVariable()->range();
|
msgSize *= links[i]->getVariable()->range();
|
||||||
}
|
}
|
||||||
|
if (msgSize > Util::maxUnsigned()) {
|
||||||
|
cout << "error: an overflow occurred when sending bp message" << endl;
|
||||||
|
abort();
|
||||||
|
}
|
||||||
unsigned repetitions = 1;
|
unsigned repetitions = 1;
|
||||||
Params msgProduct (msgSize, LogAware::multIdenty());
|
Params msgProduct (msgSize, LogAware::multIdenty());
|
||||||
if (Globals::logDomain) {
|
if (Globals::logDomain) {
|
||||||
|
@ -84,7 +84,7 @@ SumOutOperator::getLogCost (void)
|
|||||||
++ pfIter;
|
++ pfIter;
|
||||||
}
|
}
|
||||||
if (nrProdFactors == 1) {
|
if (nrProdFactors == 1) {
|
||||||
return std::log (1.0); // best possible case
|
return std::log (0.0); // best possible case
|
||||||
}
|
}
|
||||||
double cost = 1.0;
|
double cost = 1.0;
|
||||||
for (unsigned i = 0; i < groupSet.size(); i++) {
|
for (unsigned i = 0; i < groupSet.size(); i++) {
|
||||||
|
Reference in New Issue
Block a user