Forming groups as nearly equal in sums as possible

  • Context: MHB 
  • Thread starter Thread starter treesloth
  • Start date Start date
  • Tags Tags
    Groups Sums
Click For Summary
SUMMARY

The discussion centers on solving the subset sum problem, specifically forming groups of numbers with nearly equal sums. The user is working with a dataset generated in R using the command x <- as.integer(runif(100, 250, 500)). The optimal approach involves utilizing the subsetsum function from the adagio library in R to iteratively achieve the closest possible group sums. This method allows for effective partitioning of the dataset into four groups with minimal variance in their sums.

PREREQUISITES
  • Understanding of R programming language
  • Familiarity with the concept of the subset sum problem
  • Knowledge of the adagio library in R
  • Basic principles of iterative algorithms
NEXT STEPS
  • Explore the adagio library documentation for advanced functions
  • Learn about dynamic programming techniques for solving the subset sum problem
  • Investigate alternative algorithms for partitioning problems in R
  • Study performance optimization techniques for large datasets in R
USEFUL FOR

Data scientists, R programmers, and anyone interested in solving partitioning problems or optimizing group sums in numerical datasets.

treesloth
Messages
2
Reaction score
0
Hello. I'm not sure what type of problem this is that I'm trying to solve. Any pointers would be greatly appreciated.

Suppose you have a list of numbers and you want to form them into, say, 4 groups such that the sum of each group is, as nearly as possible, equal to the sums of each of the other groups; basically, making groups with equal sums without regard to the number of elements in each. Is there a way to do that with certainty that the groups are as close as possible given the elements available? If not, is there a way to iteratively approach an optimal grouping? I'm just using a made-up dataset in R generated via:

Code:
x <- as.integer(runif(100, 250, 500))

Thanks in advance.
 
Physics news on Phys.org
After some more research, this is a subset sum problem, or, in some cases, partitioning. It can be addressed using iterations of the R subsetsum function in the adagio library.
 

Similar threads

  • · Replies 26 ·
Replies
26
Views
956
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
3K
  • · Replies 29 ·
Replies
29
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
2
Views
2K