Go with `BestSumStrategy` name.
MODIFY
WalletWasabi.Tests/UnitTests/Blockchain/TransactionBuilding/BranchAndBoundTests.cs
WalletWasabi.Tests/UnitTests/Blockchain/TransactionBuilding/BranchAndBoundTests.cs
@@ -104,12 +104,12 @@ public class BranchAndBoundTests
long target = 27; // Target that we cannot get as a sum of input values.
BranchAndBound algorithm = new(inputValues);
- PruneByBestStrategy strategy = new(target);
+ BestSumStrategy strategy = new(target);
bool wasSuccessful = algorithm.TryGetMatch(strategy, out List<long>? selectedCoins);
Assert.False(wasSuccessful);
Assert.Null(selectedCoins);
- Assert.Equal(new long[] { 11, 7, 5, 3, 2 }, strategy.GetBestSolution());
+ Assert.Equal(new long[] { 11, 7, 5, 3, 2 }, strategy.GetBestSumFound());
}
private List<long> GenerateListOfRandomValues(int count = 1000)

RENAME
WalletWasabi/Blockchain/TransactionBuilding/BnB/PruneByBestStrategy.cs
WalletWasabi/Blockchain/TransactionBuilding/BnB/BestSumStrategy.cs
@@ -3,15 +3,15 @@ using System.Linq;
namespace WalletWasabi.Blockchain.TransactionBuilding.BnB;
/// <summary>
-/// Strategy that stores the best solution found along the way and prunes
+/// Strategy that stores the best sum of values found along the way and prunes
/// search space where we would find worse solutions that we already have.
/// </summary>
-public class PruneByBestStrategy : ISearchStrategy
+public class BestSumStrategy : ISearchStrategy
{
private long _bestTargetSoFar = long.MaxValue;
private long[]? _bestSolutionSoFar;
- public PruneByBestStrategy(long target)
+ public BestSumStrategy(long target)
{
Target = target;
}
@@ -19,7 +19,8 @@ public class PruneByBestStrategy : ISearchStrategy
/// <inheritdoc/>
public long Target { get; }
- public long[]? GetBestSolution() => _bestSolutionSoFar?.Where(x => x > 0).ToArray();
+ /// <summary>Gives lowest found value selection whose sum is larger than or equal to <see cref="Target"/>.</summary>
+ public long[]? GetBestSumFound() => _bestSolutionSoFar?.Where(x => x > 0).ToArray();
/// <inheritdoc/>
public EvaluationResult Evaluate(long[] solution, int depth, long effValue)

MODIFY
WalletWasabi/Blockchain/TransactionBuilding/ChangelessTransactionCoinSelector.cs
WalletWasabi/Blockchain/TransactionBuilding/ChangelessTransactionCoinSelector.cs
@@ -32,11 +32,11 @@ public static class ChangelessTransactionCoinSelector
// Pass smart coins' effective values in descending order.
BranchAndBound branchAndBound = new(inputs.Values.ToList());
- PruneByBestStrategy strategy = new(target);
+ BestSumStrategy strategy = new(target);
_ = branchAndBound.TryGetMatch(strategy, out List<long>? solution, cancellationToken);
- if (solution is null && strategy.GetBestSolution() is long[] bestSolution)
+ if (solution is null && strategy.GetBestSumFound() is long[] bestSolution)
{
solution = bestSolution.ToList();
}

Go with `BestSumStrategy` name.