Minimize the standard deviation of the total values of groups of items (optimization?) in r I am a total novice, but I think what I'm looking for is help with an optimization problem. 
I have a set of about 26 items, each with a certain value. I want to distribute these items into 8 groups as equally as possible, having granted that a perfectly equal distribution is not possible because of the individual item values.  I think, one way of measuring how equally the items have been divided into groups is by taking the standard deviation of the sums of the values of the items in each group.
Is there a package in R that could help me to minimize the standard deviation of these sums by altering the allotment of items to groups?
FWIW, this is an 'estate division' problem, in which each item has a known value, and no bidding/auctioning can take place.
 A: There are a variety of measures of evenness of the sums (group-values). For example, one alternative is to try to minimize the difference between the biggest and smallest sum.
Minimizing the standard deviation is the same as minimizing the variance.
However, the mean of the sums is fixed, so minimizing the variance is the same as minimizing the sum of squares of the group-values.
This is getting a bit closer to a 'standard' optimization problem.
It's somewhat related to the Job-shop scheduling problem and a number of other problems.
There are various job-scheduling programs, some of which might be able to work on your problem, but they usually tend to focus on minimizing the maximum completion time (that would correspond to minimizing the largest set, which may not give you a good solution).
From a quick glance it looks like the partitions package in R can generate partitions for you - but unfortunately the number of possible partitions is going to be huge in your case, so you may have to settle for some approximate algorithm (in a similar fashion to some of the bin-packing problems, for example). [Approximate algorithms can often generate very good solutions.]
There may be some value in this:
http://www.colorado.edu/education/DMP/fair_division.html
but it does seem to look mostly at bidding-solutions.
If you have a mixed problem (that is, one which includes divisible assets like cash), your job should be easier.
There might be something to be said for starting with some reasonable solution and using say tabu-search or simulated annealing or something to try to improve it.
If this is a one-off problem can you post the some numbers proportional to the values (it won't affect anything to multiply them by some arbitrary constant like 1.375) - it might help to have something concrete to think about.
A: This is known as the 'partition problem' and is preferably solved by a dynamic programming approach. You can read about it in Chapter 8.5 of "The Algorithm Design Manual" by Steven Skiena. And you can find an R implementation for minimizing the variance in the thread "optimization challenge" of R-help in January 2010.
EDIT: I'm sorry, I somehow misread the task, assuming the sequence of values would play a role. As a kind of compensation I will show how I would solve this as a multiple knapsack problem, reducing knapsack capacities until no solution is found. 
library(adagio)                     # contains a multiple knapsack solver
set.seed(7531)
w <- sample(1:100, 26)              # 26 items used as weights (integers)
p <- rep(1, 26)                     # with equal profits all

t <- 200; k <- rep(t, 8)            # 8 knapsacks with equal capacities
sol <- mknapsack(p, w, k, bck = 1)  # starting with capacity 200
while (all(sol$ksack > 0)) {        # diminish capacity until not all
    t <- t-1; k <- rep(t, 8)        # items can be packed
    Sol <- sol                      # keep the last feasible solution
    sol <- mknapsack(p, w, k, bck = -1)
}                                   # will take a few seconds to minutes

y <- numeric(8)                     # find weight in each knapsack
for (i in 1:8) y[i] <- sum(w[Sol$ksack == i])
y                                   # 161 161 160 161 161 161 159 161

This will not in all cases lead to a solution of smallest variance, but come very close to it.
A: I would argue that one solution (I cannot prove it is optimal) for such a problem is arranging the items from smallest to largest and then going from there.
In such an arrangement the items next to each other will always give the least possible contribution to the overall SD.
I had a similar problem and solved it this way. I did however have the benefit of a constant group size.
The method for your problem would still have to evaluate all the possible groups..
