-
Notifications
You must be signed in to change notification settings - Fork 5
/
PruningRulesBuilder.cs
40 lines (35 loc) · 1.41 KB
/
PruningRulesBuilder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PalCalc.Solver.ResultPruning
{
public class PruningRulesBuilder
{
public Func<CancellationToken, IEnumerable<IResultPruning>> Build { get; }
public Func<CancellationToken, IResultPruning> BuildAggregate => t => new AggregatePruning(t, Build(t));
public PruningRulesBuilder(Func<CancellationToken, IEnumerable<IResultPruning>> build)
{
Build = build;
}
public PruningRulesBuilder WithRule(Func<CancellationToken, IResultPruning> ruleBuilder) =>
new PruningRulesBuilder(
t => Build(t).Append(ruleBuilder(t))
);
public static readonly PruningRulesBuilder Default = new PruningRulesBuilder(
token =>
new List<IResultPruning>()
{
new MinimumEffortPruning(token),
new MinimumBreedingStepsPruning(token),
new PreferredLocationPruning(token),
new MinimumReusePruning(token),
new MinimumWildPalsPruning(token),
new MinimumReferencedPlayersPruning(token),
new VariedResultsPruning(token, maxSimilarityPercent: 0.1f),
new ResultLimitPruning(token, maxResults: 3),
}
);
}
}