Skip to content

Commit

Permalink
feat: weighted sum approach 3
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandreps1123 committed Apr 8, 2024
1 parent 1aa40f3 commit 38ee863
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion fuzz/distance_coverage_orderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import (
"github.com/dogefuzz/dogefuzz/pkg/dto"
)

const WEIGHT_1 = 2
const WEIGHT_2 = 4
const WEIGHT_3 = 4

type distanceCoverageBasedOrderer struct {
contract *dto.ContractDTO
}
Expand All @@ -22,7 +26,10 @@ func (o *distanceCoverageBasedOrderer) OrderTransactions(transactions []*dto.Tra
}

func (o *distanceCoverageBasedOrderer) computeScore(transaction *dto.TransactionDTO) float64 {
return math.Max(o.computeCriticalInstructionsHits(transaction), math.Max(o.computeCoverage(transaction), o.computeDistance(transaction)))
// 2, 4, 4
return WEIGHT_1*o.computeCriticalInstructionsHits(transaction) +
WEIGHT_2*o.computeDistance(transaction) +
WEIGHT_3*o.computeCoverage(transaction)
}

func (o *distanceCoverageBasedOrderer) computeCoverage(transaction *dto.TransactionDTO) float64 {
Expand Down

0 comments on commit 38ee863

Please sign in to comment.