autopilot/combinedattach: trace log scoring process from sub heuristics
This commit is contained in:
parent
b2560b4ad2
commit
d5ab95546e
@ -78,6 +78,8 @@ func (c *WeightedCombAttachment) NodeScores(g ChannelGraph, chans []Channel,
|
|||||||
// nodes for the given channel size.
|
// nodes for the given channel size.
|
||||||
var subScores []map[NodeID]*NodeScore
|
var subScores []map[NodeID]*NodeScore
|
||||||
for _, h := range c.heuristics {
|
for _, h := range c.heuristics {
|
||||||
|
log.Tracef("Getting scores from sub heuristic %v", h.Name())
|
||||||
|
|
||||||
s, err := h.NodeScores(
|
s, err := h.NodeScores(
|
||||||
g, chans, chanSize, nodes,
|
g, chans, chanSize, nodes,
|
||||||
)
|
)
|
||||||
@ -102,14 +104,24 @@ func (c *WeightedCombAttachment) NodeScores(g ChannelGraph, chans []Channel,
|
|||||||
for i, h := range c.heuristics {
|
for i, h := range c.heuristics {
|
||||||
sub, ok := subScores[i][nID]
|
sub, ok := subScores[i][nID]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
log.Tracef("No score given to node %x by sub "+
|
||||||
|
"heuristic %v", nID[:], h.Name())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Use the heuristic's weight factor to determine of
|
// Use the heuristic's weight factor to determine of
|
||||||
// how much weight we should give to this particular
|
// how much weight we should give to this particular
|
||||||
// score.
|
// score.
|
||||||
score.Score += h.Weight * sub.Score
|
subScore := h.Weight * sub.Score
|
||||||
|
log.Tracef("Giving node %x a sub score of %v "+
|
||||||
|
"(%v * %v) from sub heuristic %v", nID[:],
|
||||||
|
subScore, h.Weight, sub.Score, h.Name())
|
||||||
|
|
||||||
|
score.Score += subScore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Tracef("Node %x got final combined score %v", nID[:],
|
||||||
|
score.Score)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
// Instead of adding a node with score 0 to the returned set,
|
// Instead of adding a node with score 0 to the returned set,
|
||||||
// we just skip it.
|
// we just skip it.
|
||||||
|
Loading…
Reference in New Issue
Block a user