public bool Equals(ISequencingLayer other) { if (ReferenceEquals(other, null)) { return(false); } bool result = ReferenceEquals(this, other) || (this.SequenceEqual(other) && GraphLayer.Equals(other.GraphLayer)); return(result); }
public static void Check( Problem problem, ISolution solution, IGraphLayer graphLayer, ISequencingLayer sequencingLayer) { if (!Switch.On) { return; } Asserts.Assert(Switch, graphLayer.Count == problem.OperationCount); IGraph newGraph = new Graph(graphLayer.Count); foreach (Route route in problem.Select(j => solution.GetRoute(j, canBeNull: true)).Where(r => r != null)) { foreach (var(op0, op1) in route.Pairwise()) { newGraph.AddArc(op0.Id, op1.Id, -1, op0.Runtime); } } foreach (IJobSequence permutation in sequencingLayer) { foreach (var(mOcc0, mOcc1) in permutation.Pairwise()) { newGraph.AddArc( mOcc0.LastOperation + 1, mOcc1.FirstOperation, mOcc0.MachineId, solution.GetMachineReleaseTime(mOcc0, mOcc1)); } } Asserts.Assert(Switch, newGraph.Equals(graphLayer), "1 = graphLayer, 2 = implicit graph\n" + graphLayer.DifferencesToString(newGraph)); }
public static string ReportDifference( this ISequencingLayer first, ISequencingLayer second, StringBuilder builder = null) { if (builder == null) { builder = new StringBuilder(); } if (first.Count != second.Count) { throw new Exception(); } builder.AppendLine("Difference between sequencing layers:"); for (int i = 0; i < first.Count; i++) { ReportDifference(first[i], second[i], builder); } builder.AppendLine("End of difference."); return(builder.ToString()); }
public ClosureLayer(ISequencingLayer sequencingLayer) { SequencingLayer = sequencingLayer; }