Commit b5741ea7 authored by Robert Ricci's avatar Robert Ricci
Browse files

Add support for 'additive features' - rather than 'cancelling' each

other, if both the feature and matching desire are found, their scores
are added together.

Additive feature names start with a '+'.
parent 042c8988
......@@ -1443,6 +1443,18 @@ double fd_score(tb_vnode *vnode,tb_pnode *pnode,int &fd_violated)
if (value >= FD_VIOLATION_WEIGHT) {
fd_violated++;
}
} else {
// Features/desires with a '+' at the front are additive - rather than
// 'cancelling out' if both have it, they add together, possibly
// resulting in a violation
if (((*desire_it).first)[0] == '+') {
value = (*desire_it).second + (*feature_it).second;
SDEBUG(cerr << " additive - total " << value << endl);
fd_score += SCORE_DESIRE*value;
if (value >= FD_VIOLATION_WEIGHT) {
fd_violated++;
}
}
}
}
}
......@@ -1467,7 +1479,7 @@ double fd_score(tb_vnode *vnode,tb_pnode *pnode,int &fd_violated)
}
}
SDEBUG(cerr << " Total feature score: " << fd_score << endl;)
SDEBUG(cerr << " Total feature score: " << fd_score << endl);
return fd_score;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment