Free cookie consent management tool by TermsFeed Policy Generator

# Changeset 15838

Ignore:
Timestamp:
03/12/18 14:19:06 (6 years ago)
Message:
• Fixed a bug at creating the extreme points with the point projection based method.
Location:
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D
Files:
10 edited

Unmodified
Removed
• ## branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Algorithms/ExtremePointAlgorithm.cs

 r15731 } var x = Problem.SolutionEvaluator.Evaluate1(solution); /* if (double.IsNaN(result.Item2) || double.IsInfinity(result.Item2)) { continue; } if (double.IsNaN(best) || Problem.Maximization && result.Item2 > best || !Problem.Maximization && result.Item2 < best) { bestSolution = result.Item1; best = result.Item2; bestSorting = sort; bestFitting = fit; bestEPCreation = epCreation; } return true;*/ if (token.IsCancellationRequested) { return Tuple.Create(bestSolution, best, bestSorting, bestFitting, bestEPCreation); /// /// Returns a tuple with the solution and the packing ratio depending on the given parameters /// Returns a solution depending on the given parameters /// /// var sol = parameters.Decoder.Decode(parameters.SortedItems, parameters.Bin, parameters.Items, parameters.StackingConstraints); //var fit = parameters.Evaluator.Evaluate(sol); return sol; //Tuple.Create(sol, fit); return sol; } public ExtremePointCreationMethod ExtremePointGeneration { get; set; } } /// /// Returns a new permutation of the given items depending on the sorting method
• ## branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Encoding/ExtremePointPermutationDecoder.cs

 r15652 : base(original, cloner) { fittingMethodParameter = cloner.Clone(original.fittingMethodParameter); //_binPacker = cloner.Clone(original._binPacker); } public ExtremePointPermutationDecoder() { return new ExtremePointPermutationDecoder(this, cloner); } /*[Storable] BinPacker _binPacker; */ /// /// Creates a solution for displaying it on the HEAL gui } return solution; } Permutation AddOffset(Permutation p, int offset) { var s = p.ToArray(); for (int i = 0; i < s.Length; i++) { s[i] += offset; } return new Permutation(PermutationTypes.Absolute, s); } } } }
• ## branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Evaluators/BinUtilizationEvaluator.cs

 r15731 } public Tuple Evaluate1(Solution solution) { public Tuple EvaluateBinPacking(Solution solution) {
• ## branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Evaluators/IEvaluator.cs

 r15731 /// /// Tuple Evaluate1(Solution solution); Tuple EvaluateBinPacking(Solution solution); } }
• ## branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Evaluators/PackingRatioEvaluator.cs

 r15731 } public Tuple Evaluate1(Solution solution) { public Tuple EvaluateBinPacking(Solution solution) {
• ## branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ExtremePointCreation/ExtremePointCreator.cs

 r15617 /// protected bool IsWithinResidualSpaceOfAnotherExtremePoint(BinPacking3D binPacking, Vector3D pos, IEnumerable residualSpaces) { foreach (var residualSpace in residualSpaces) { if (IsWithinResidualSpaceOfAnotherExtremePoint(binPacking, pos, residualSpace)) { return true; } } return false; return residualSpaces.Any(x => IsWithinResidualSpaceOfAnotherExtremePoint(binPacking, pos, x)); } /// protected virtual bool IsWithinResidualSpaceOfAnotherExtremePoint(Vector3D pos, ResidualSpace rsPos, PackingPosition ep, ResidualSpace rsEp) { /*old implementation return rsEp.Width >= pos.X - ep.X + rsPos.Width && rsEp.Height >= pos.Y - ep.Y + rsPos.Height && rsEp.Depth >= pos.Z - ep.Z + rsPos.Depth;*/ var x = pos.X >= ep.X && pos.X + rsPos.Width <= ep.X + rsEp.Width; var y = pos.Y >= ep.Y && pos.Y + rsPos.Height <= ep.Y + rsEp.Height; .Select(x => x.Intersect(line)) .Where(x => x != null && x.Z <= pos.Z); if (m.Where(x => x != null).Any()) { return m.MaxItems(x => x.Y).First(); if (m.Any(x => x != null)) { return m.MaxItems(x => x.Z).FirstOrDefault(); } return null; .Select(x => x.Intersect(line)) .Where(x => x != null && x.X <= pos.X); if (m.Where(x => x != null).Any()) { return m.MaxItems(x => x.Y).First(); if (m.Any(x => x != null)) { return m.MaxItems(x => x.X).FirstOrDefault(); } return null; .Select(x => x.Intersect(line)) .Where(x => x != null && x.Y <= pos.Y); if (m.Where(x => x != null).Any()) { return m.MaxItems(x => x.Y).First(); if (m.Any(x => x != null)) { return m.MaxItems(x => x.Y).FirstOrDefault(); } return null; .Select(x => x.Intersect(line)) .Where(x => x != null && x.Z >= pos.Z); if (m.Where(x => x != null).Any()) { return m.MaxItems(x => x.Y).First(); if (m.Any(x => x != null)) { return m.MinItems(x => x.Z).FirstOrDefault(); } return null; .Select(x => x.Intersect(line)) .Where(x => x != null && x.X >= pos.X); if (m.Where(x => x != null).Any()) { return m.MaxItems(x => x.Y).First(); if (m.Any(x => x != null)) { return m.MinItems(x => x.X).FirstOrDefault(); } return null; .Select(x => x.Intersect(line)) .Where(x => x != null && x.Y >= pos.Y); if (m.Where(x => x != null).Any()) { return m.MaxItems(x => x.Y).First(); if (m.Any(x => x != null)) { return m.MinItems(x => x.Y).FirstOrDefault(); } return null;
• ## branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ExtremePointCreation/ExtremePointCreatorFactory.cs

 r15617 namespace HeuristicLab.Problems.BinPacking3D.ExtremePointCreation { public static class ExtremePointCreatorFactory { public static IExtremePointCreator CreateExtremePointCreator(ExtremePointCreationMethod epGenerationMethod, bool useStackingConstraints) { if (epGenerationMethod == ExtremePointCreationMethod.PointProjection) { /// /// Returns an extreme point creator depending on the given creation method. /// /// /// /// public static IExtremePointCreator CreateExtremePointCreator(ExtremePointCreationMethod epCreationMethod, bool useStackingConstraints) { if (epCreationMethod == ExtremePointCreationMethod.PointProjection) { return new PointProjectionBasedEPCreator(); } else if (epGenerationMethod == ExtremePointCreationMethod.LineProjection) { } else if (epCreationMethod == ExtremePointCreationMethod.LineProjection) { return new LineProjectionBasedEPCreator(); }
• ## branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ExtremePointCreation/PointProjectionBasedEPCreator.cs

 r15822 GenerateNewExtremePointsForItem(binPacking, it, pos); }); // remove not needed extreme points. foreach (var extremePoint in binPacking.ExtremePoints.ToList()) {
• ## branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerMinRSLeft.cs

 r15822 packingItem.Rotated = rsd.Item.Rotated; packingItem.Tilted = rsd.Item.Tilted; return rsd.Position; } \$"Item: ({packingItem.Width} {packingItem.Depth} {packingItem.Height})"); } var rsd = CalculateResidalSpaceDifferences(packingBin, packingItem, useStackingConstraints).Where(x => x != null).FirstOrDefault(); var rsds = CalculateResidalSpaceDifferences(packingBin, packingItem, useStackingConstraints).Where(x => x != null); var rsd = rsds.FirstOrDefault(); if (rsd == null) { packingItem.Rotated = rsd.Item.Rotated; packingItem.Tilted = rsd.Item.Tilted; return rsd.Position; }
• ## branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Solution.cs

 r15731 public bool IsBetterThan(Solution other, IEvaluator evaluator, bool problemMaximization = true) { var evaluatedThis = evaluator.Evaluate1(this); var evaluatedThis = evaluator.EvaluateBinPacking(this); if (double.IsInfinity(evaluatedThis.Item2) || double.IsNaN(evaluatedThis.Item2)) { } var evaluatedOther = evaluator.Evaluate1(other); var evaluatedOther = evaluator.EvaluateBinPacking(other); if (evaluatedThis.Item1 < evaluatedOther.Item1) { return true;
Note: See TracChangeset for help on using the changeset viewer.