ULSAlgorithms 1.1.0-g3e5595996d
High-performance exact and heuristic algorithms for uncapacitated lot sizing
Loading...
Searching...
No Matches
LsCutSelector.cs
Go to the documentation of this file.
2
4
5internal static class LsCutSelector
6{
7 internal static HashSet<int> Select(
8 IReadOnlyList<LsSeparatedCut> candidates,
9 IReadOnlyCollection<int> eligibleIndices,
11 {
12 ArgumentNullException.ThrowIfNull(candidates);
13 ArgumentNullException.ThrowIfNull(eligibleIndices);
14 ArgumentNullException.ThrowIfNull(options);
15
16 options.EnsureValid();
17
18 IEnumerable<int> eligible =
19 eligibleIndices;
20
21 IEnumerable<int> selected =
22 options.SelectionPolicy switch
23 {
25 eligible,
26
28 eligible
29 .GroupBy(
30 index =>
31 candidates[index].Definition.L)
32 .Select(
33 group =>
34 group
35 .OrderByDescending(
36 index =>
37 candidates[index].Violation)
38 .ThenByDescending(
39 index =>
40 candidates[index].Efficacy)
41 .ThenBy(
42 static index =>
43 index)
44 .First()),
45
47 eligible
48 .OrderByDescending(
49 index =>
50 candidates[index].Violation)
51 .ThenByDescending(
52 index =>
53 candidates[index].Efficacy)
54 .ThenBy(
55 static index =>
56 index)
57 .Take(
59
61 eligible
62 .OrderByDescending(
63 index =>
64 candidates[index].Efficacy)
65 .ThenByDescending(
66 index =>
67 candidates[index].Violation)
68 .ThenBy(
69 static index =>
70 index)
71 .Take(
73
74 _ =>
75 throw new NotSupportedException(
76 $"Unsupported cut-selection policy " +
77 $"'{options.SelectionPolicy}'.")
78 };
79
80 return selected.ToHashSet();
81 }
82}
static HashSet< int > Select(IReadOnlyList< LsSeparatedCut > candidates, IReadOnlyCollection< int > eligibleIndices, LsCuttingPlaneOptions options)
Configures root LP (l,S) separation before the final exact MILP solve.
int MaximumCutsPerIteration
Gets or sets the maximum number of cuts selected per iteration when the policy is TopByViolation or T...
@ TopByEfficacy
Add the globally highest-efficacy candidates, limited by MaximumCutsPerIteration.
@ MostViolatedPerL
Add only the most violated candidate for each value of l.
@ TopByViolation
Add the globally most violated candidates, limited by MaximumCutsPerIteration.