autopilot/interface+prefattach: scale node scores to range [0.0, 1.0]

To prepare for combinning scores from multiple heuristics, we require the
scores returned from the NodeSores API to be in the range [0.0, 1.0].

The prefAttach heuristic is altered to scale the returned scores such
that the most connected node in the grpah is given a score of 1.0.
This commit is contained in:
Johan T. Halseth
2019-01-09 09:14:45 +01:00
parent 4537c63dbd
commit 592ce92c72
3 changed files with 24 additions and 17 deletions

View File

@ -249,8 +249,8 @@ func TestPrefAttachmentSelectTwoVertexes(t *testing.T) {
// Since each of the nodes has 1 channel, out
// of only one channel in the graph, we expect
// their score to be 0.5.
expScore := float64(0.5)
// their score to be 1.0.
expScore := float64(1.0)
if candidate.Score != expScore {
t1.Fatalf("expected candidate score "+
"to be %v, instead was %v",