Changeset 15838 for branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ExtremePointCreation
- Timestamp:
- 03/12/18 14:19:06 (7 years ago)
- Location:
- branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ExtremePointCreation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ExtremePointCreation/ExtremePointCreator.cs
r15617 r15838 232 232 /// <returns></returns> 233 233 protected bool IsWithinResidualSpaceOfAnotherExtremePoint(BinPacking3D binPacking, Vector3D pos, IEnumerable<ResidualSpace> residualSpaces) { 234 foreach (var residualSpace in residualSpaces) { 235 if (IsWithinResidualSpaceOfAnotherExtremePoint(binPacking, pos, residualSpace)) { 236 return true; 237 } 238 } 239 return false; 234 return residualSpaces.Any(x => IsWithinResidualSpaceOfAnotherExtremePoint(binPacking, pos, x)); 240 235 } 241 236 … … 262 257 /// <returns></returns> 263 258 protected virtual bool IsWithinResidualSpaceOfAnotherExtremePoint(Vector3D pos, ResidualSpace rsPos, PackingPosition ep, ResidualSpace rsEp) { 264 /*old implementation265 return rsEp.Width >= pos.X - ep.X + rsPos.Width266 && rsEp.Height >= pos.Y - ep.Y + rsPos.Height267 && rsEp.Depth >= pos.Z - ep.Z + rsPos.Depth;*/268 269 259 var x = pos.X >= ep.X && pos.X + rsPos.Width <= ep.X + rsEp.Width; 270 260 var y = pos.Y >= ep.Y && pos.Y + rsPos.Height <= ep.Y + rsEp.Height; … … 294 284 .Select(x => x.Intersect(line)) 295 285 .Where(x => x != null && x.Z <= pos.Z); 296 if (m. Where(x => x != null).Any()) {297 return m.MaxItems(x => x. Y).First();286 if (m.Any(x => x != null)) { 287 return m.MaxItems(x => x.Z).FirstOrDefault(); 298 288 } 299 289 return null; … … 307 297 .Select(x => x.Intersect(line)) 308 298 .Where(x => x != null && x.X <= pos.X); 309 if (m. Where(x => x != null).Any()) {310 return m.MaxItems(x => x. Y).First();299 if (m.Any(x => x != null)) { 300 return m.MaxItems(x => x.X).FirstOrDefault(); 311 301 } 312 302 return null; … … 320 310 .Select(x => x.Intersect(line)) 321 311 .Where(x => x != null && x.Y <= pos.Y); 322 if (m. Where(x => x != null).Any()) {323 return m.MaxItems(x => x.Y).First ();312 if (m.Any(x => x != null)) { 313 return m.MaxItems(x => x.Y).FirstOrDefault(); 324 314 } 325 315 return null; … … 333 323 .Select(x => x.Intersect(line)) 334 324 .Where(x => x != null && x.Z >= pos.Z); 335 if (m. Where(x => x != null).Any()) {336 return m.M axItems(x => x.Y).First();325 if (m.Any(x => x != null)) { 326 return m.MinItems(x => x.Z).FirstOrDefault(); 337 327 } 338 328 return null; … … 346 336 .Select(x => x.Intersect(line)) 347 337 .Where(x => x != null && x.X >= pos.X); 348 if (m. Where(x => x != null).Any()) {349 return m.M axItems(x => x.Y).First();338 if (m.Any(x => x != null)) { 339 return m.MinItems(x => x.X).FirstOrDefault(); 350 340 } 351 341 return null; … … 359 349 .Select(x => x.Intersect(line)) 360 350 .Where(x => x != null && x.Y >= pos.Y); 361 if (m. Where(x => x != null).Any()) {362 return m.M axItems(x => x.Y).First();351 if (m.Any(x => x != null)) { 352 return m.MinItems(x => x.Y).FirstOrDefault(); 363 353 } 364 354 return null; -
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ExtremePointCreation/ExtremePointCreatorFactory.cs
r15617 r15838 28 28 namespace HeuristicLab.Problems.BinPacking3D.ExtremePointCreation { 29 29 public static class ExtremePointCreatorFactory { 30 public static IExtremePointCreator CreateExtremePointCreator(ExtremePointCreationMethod epGenerationMethod, bool useStackingConstraints) { 31 if (epGenerationMethod == ExtremePointCreationMethod.PointProjection) { 30 31 /// <summary> 32 /// Returns an extreme point creator depending on the given creation method. 33 /// </summary> 34 /// <param name="epCreationMethod"></param> 35 /// <param name="useStackingConstraints"></param> 36 /// <returns></returns> 37 public static IExtremePointCreator CreateExtremePointCreator(ExtremePointCreationMethod epCreationMethod, bool useStackingConstraints) { 38 if (epCreationMethod == ExtremePointCreationMethod.PointProjection) { 32 39 return new PointProjectionBasedEPCreator(); 33 } else if (ep GenerationMethod == ExtremePointCreationMethod.LineProjection) {40 } else if (epCreationMethod == ExtremePointCreationMethod.LineProjection) { 34 41 return new LineProjectionBasedEPCreator(); 35 42 } -
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ExtremePointCreation/PointProjectionBasedEPCreator.cs
r15822 r15838 56 56 GenerateNewExtremePointsForItem(binPacking, it, pos); 57 57 }); 58 58 59 59 // remove not needed extreme points. 60 60 foreach (var extremePoint in binPacking.ExtremePoints.ToList()) {
Note: See TracChangeset
for help on using the changeset viewer.