[#167] netmap: Fix reverse min agregator
The higher the price, the lower reverse min weight should be.
Previously nodes with 0 price had 0 weight which is a bit misleading.
Introduced in d71a0e0755
.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
670619d242
commit
20d325e307
2 changed files with 5 additions and 9 deletions
|
@ -156,11 +156,7 @@ func (a *meanIQRAgg) Compute() float64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *reverseMinNorm) Normalize(w float64) float64 {
|
func (r *reverseMinNorm) Normalize(w float64) float64 {
|
||||||
if w == 0 {
|
return (r.min + 1) / (w + 1)
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.min / w
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *sigmoidNorm) Normalize(w float64) float64 {
|
func (r *sigmoidNorm) Normalize(w float64) float64 {
|
||||||
|
|
|
@ -146,19 +146,19 @@
|
||||||
"select 3 nodes in 3 distinct countries, same placement": {
|
"select 3 nodes in 3 distinct countries, same placement": {
|
||||||
"policy": {"replicas":[{"count":1,"selector":"Main"}],"containerBackupFactor":1,"selectors":[{"name":"Main","count":3,"clause":"DISTINCT","attribute":"Country","filter":"*"}],"filters":[]},
|
"policy": {"replicas":[{"count":1,"selector":"Main"}],"containerBackupFactor":1,"selectors":[{"name":"Main","count":3,"clause":"DISTINCT","attribute":"Country","filter":"*"}],"filters":[]},
|
||||||
"pivot": "Y29udGFpbmVySUQ=",
|
"pivot": "Y29udGFpbmVySUQ=",
|
||||||
"result": [[0, 2, 3]],
|
"result": [ [ 5, 0, 7 ] ],
|
||||||
"placement": {
|
"placement": {
|
||||||
"pivot": "b2JqZWN0SUQ=",
|
"pivot": "b2JqZWN0SUQ=",
|
||||||
"result": [[0, 2, 3]]
|
"result": [ [ 5, 0, 7 ] ]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"select 6 nodes in 3 distinct countries, different placement": {
|
"select 6 nodes in 3 distinct countries, different placement": {
|
||||||
"policy": {"replicas":[{"count":1,"selector":"Main"}],"containerBackupFactor":2,"selectors":[{"name":"Main","count":3,"clause":"DISTINCT","attribute":"Country","filter":"*"}],"filters":[]},
|
"policy": {"replicas":[{"count":1,"selector":"Main"}],"containerBackupFactor":2,"selectors":[{"name":"Main","count":3,"clause":"DISTINCT","attribute":"Country","filter":"*"}],"filters":[]},
|
||||||
"pivot": "Y29udGFpbmVySUQ=",
|
"pivot": "Y29udGFpbmVySUQ=",
|
||||||
"result": [[0, 1, 2, 6, 3, 4]],
|
"result": [ [ 5, 4, 0, 1, 7, 2 ] ],
|
||||||
"placement": {
|
"placement": {
|
||||||
"pivot": "b2JqZWN0SUQ=",
|
"pivot": "b2JqZWN0SUQ=",
|
||||||
"result": [[0, 1, 2, 6, 3, 4]]
|
"result": [ [ 5, 4, 0, 7, 2, 1 ] ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue