[#1316] lint: Fix warnings
All checks were successful
DCO / DCO (pull_request) Successful in 39s
Tests and linters / Tests (1.22) (pull_request) Successful in 51s
Tests and linters / Tests (1.23) (pull_request) Successful in 53s
Tests and linters / Lint (pull_request) Successful in 1m18s

Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
Ekaterina Lebedeva 2024-08-21 16:43:53 +03:00
parent cf225be0df
commit 9115d3f281
3 changed files with 11 additions and 10 deletions

View file

@ -12,7 +12,8 @@ run:
# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: tab
formats:
- format: tab
# all available settings of specific linters
linters-settings:

View file

@ -73,8 +73,8 @@ func newMinAgg() aggregator {
// newReverseMinNorm returns a normalizer which
// normalize values in range of 0.0 to 1.0 to a minimum value.
func newReverseMinNorm(min float64) normalizer {
return &reverseMinNorm{min: min}
func newReverseMinNorm(minV float64) normalizer {
return &reverseMinNorm{min: minV}
}
// newSigmoidNorm returns a normalizer which
@ -125,22 +125,22 @@ func (a *meanIQRAgg) Compute() float64 {
slices.Sort(a.arr)
var min, max float64
var minV, maxV float64
const minLn = 4
if l < minLn {
min, max = a.arr[0], a.arr[l-1]
minV, maxV = a.arr[0], a.arr[l-1]
} else {
start, end := l/minLn, l*3/minLn-1
min, max = a.arr[start], a.arr[end]
minV, maxV = a.arr[start], a.arr[end]
}
count := 0
sum := float64(0)
for _, e := range a.arr {
if e >= min && e <= max {
if e >= minV && e <= maxV {
sum += e
count++
}

View file

@ -94,14 +94,14 @@ func (c *context) addUsedNodes(ns ...NodeInfo) {
func defaultWeightFunc(ns nodes) weightFunc {
mean := newMeanAgg()
min := newMinAgg()
minV := newMinAgg()
for i := range ns {
mean.Add(float64(ns[i].capacity()))
min.Add(float64(ns[i].Price()))
minV.Add(float64(ns[i].Price()))
}
return newWeightFunc(
newSigmoidNorm(mean.Compute()),
newReverseMinNorm(min.Compute()))
newReverseMinNorm(minV.Compute()))
}