ULSAlgorithms 1.1.0-g3e5595996d
High-performance exact and heuristic algorithms for uncapacitated lot sizing
Loading...
Searching...
No Matches
CutIterationReport.cs
Go to the documentation of this file.
2
3/// <summary>
4/// Traceability report for one cutting-plane iteration.
5/// </summary>
6public sealed class CutIterationReport
7{
8 private readonly CutRecord[] _cuts;
9
10 /// <summary>Initializes an iteration report.</summary>
12 int iteration,
13 IEnumerable<CutRecord> cuts,
14 TimeSpan separationTime)
15 {
16 if (iteration < 0)
17 {
18 throw new ArgumentOutOfRangeException(nameof(iteration));
19 }
20
21 ArgumentNullException.ThrowIfNull(cuts);
22
23 if (separationTime < TimeSpan.Zero)
24 {
25 throw new ArgumentOutOfRangeException(nameof(separationTime));
26 }
27
28 _cuts = cuts.ToArray();
29
30 if (_cuts.Any(cut => cut.Iteration != iteration))
31 {
32 throw new ArgumentException(
33 "Every cut in an iteration report must have the same iteration.",
34 nameof(cuts));
35 }
36
37 Iteration = iteration;
38 SeparationTime = separationTime;
39 MaximumViolation = _cuts.Length == 0
40 ? 0.0
41 : _cuts.Max(static cut => cut.Violation);
42 }
43
44 /// <summary>Gets the iteration index.</summary>
45 public int Iteration { get; }
46
47 /// <summary>Gets all generated cuts, including rejected and duplicate cuts.</summary>
48 public IReadOnlyList<CutRecord> Cuts => _cuts;
49
50 /// <summary>Gets the number of generated cuts.</summary>
51 public int GeneratedCount => _cuts.Length;
52
53 /// <summary>Gets the number of cuts actually added to the model.</summary>
54 public int AddedCount => _cuts.Count(static cut => cut.WasAdded);
55
56 /// <summary>Gets the number of generated cuts not added to the model.</summary>
58
59 /// <summary>Gets the maximum measured violation in this iteration.</summary>
60 public double MaximumViolation { get; }
61
62 /// <summary>Gets time spent in separation for this iteration.</summary>
63 public TimeSpan SeparationTime { get; }
64}
CutIterationReport(int iteration, IEnumerable< CutRecord > cuts, TimeSpan separationTime)
Initializes an iteration report.
int GeneratedCount
Gets the number of generated cuts.
int AddedCount
Gets the number of cuts actually added to the model.
IReadOnlyList< CutRecord > Cuts
Gets all generated cuts, including rejected and duplicate cuts.
double MaximumViolation
Gets the maximum measured violation in this iteration.
TimeSpan SeparationTime
Gets time spent in separation for this iteration.
int NotAddedCount
Gets the number of generated cuts not added to the model.
Trace record for one generated cutting-plane constraint.
Definition CutRecord.cs:7