private void DestroyContainerExploitedVolumeBased(COSolution solution, double relativeContainerIndex) { // Remove all pieces from the container with the index matching the given relative position when ordered by exploited relative volume IEnumerable <Container> usedContainers = Instance.Containers.Where(c => solution.ExploitedVolumeOfContainers[c.VolatileID] > 0); int containerIndex = (int)(relativeContainerIndex * usedContainers.Count()); Container containerToDestroy = usedContainers.OrderByDescending(c => solution.ExploitedVolumeOfContainers[c.VolatileID] / c.Mesh.Volume).ElementAt(containerIndex); solution.RemoveContainer(containerToDestroy); }
private void ALNSDestroyRandomContainer(COSolution solution) { // Remove all pieces from a random container solution.RemoveContainer(Instance.Containers.OrderBy(c => Randomizer.Next(Instance.Containers.Count)).First()); }