Ascending Order of the Sums of the Elements of the Sub(multi)set of MultiSet

  • Context: Graduate 
  • Thread starter Thread starter Moni
  • Start date Start date
  • Tags Tags
    Elements Sums
Click For Summary
SUMMARY

The discussion focuses on generating subsets of a multiset in ascending order based on the sums of their elements. The example provided is the multiset S = {1, 2, 2, 3, 4, 5, 5}, where the desired output is a sequence of subsets such as {1}, {2}, {2}, {1,2}, and so forth, leading to a sorted sum sequence. Participants suggest that while traditional sorting algorithms can be employed, they require generating all combinations first, which is computationally expensive. The goal is to find an efficient algorithm that can generate these subsets in the required order without exhaustive computation.

PREREQUISITES
  • Understanding of multisets and their properties
  • Familiarity with subset generation algorithms
  • Knowledge of sorting algorithms and their complexities
  • Basic algorithm optimization techniques
NEXT STEPS
  • Research efficient algorithms for generating subsets of multisets
  • Explore combinatorial generation techniques to minimize computational costs
  • Learn about the properties of the powerset in relation to multiset operations
  • Investigate hybrid approaches combining generation and sorting for optimal performance
USEFUL FOR

Mathematicians, computer scientists, and software developers interested in combinatorial algorithms, particularly those working with multisets and optimization of subset generation processes.

Moni
Messages
178
Reaction score
1
TL;DR
Generating Subsets of a Multiset in Ascending Order of the Sums of the Elements of the Sub(multi)set
Summary: Generating Subsets of a Multiset in Ascending Order of the Sums of the Elements of the Sub(multi)set

I am trying to come up with an algorithm where you can generate combination from a set in a order such that their sums are in increasing order. This set has to be a multiset i.e. repetition allowed.
For example you have a set S = {1,2,2,3,4,5,5}
So, rather than generating all the combinations based on number of items (say start with 1 and 2 items and finally all 7) I want to figure them out in this order:
{1}, {2}, {2}, {1,2}, {1,2}, {3}, {1,3}, {2,2}, {4}.....{1,2,2,3,4,5,5}
Why this order: Well taking sum of these subsets we can see:
{1}, {2}, {2}, {3}, {3}, {3}, {4}, {4}, {4}.....{22}
Do you know any algorithm which can do it efficiently?
 
Physics news on Phys.org
I'm not sure how you arrived at the copies of those singlets, i.e. how you distinguish the elements in ##S## if they have the same name? That's nothing the ##\{\,\,\}## notation allows.

Anyway, why don't you use one of the usual sort algorithms?
 
Hi, yes sorting algorithms can be used, but then you need to generate all of the combinations and then sort it. But the project I am working on, there the result might be available in the first 25% of the numbers (80% of the time) that means if you have say, 100 submultisets (powerset) and if you can generate that sequence (their sums ascending ordering) then you might get the desired combination (submultiset) within first 25 generated ones. Generating all of them in those cases is computationally expensive!
 
You can sort them right after generation, which is cheap. That leaves us with the question,whether generation has to be done or not. However, they occur in your final list, so they will have to be produced at some stage. Hence generation is the only and unavoidable cost.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 57 ·
2
Replies
57
Views
7K