We can view the source "list" as a vector for some dimension (equal to the length of the list). With duplicates removed, we can view the differences as a set . So the question has to do with recovering from . Our first observation kills any chance of recovering the original list with certainty:
If produces difference set , then for any the vector produces the same set of differences.Translating all components of by a constant amount has no effect on the differences. So there will be an infinite number of solutions for a given difference set . A reasonable approach (proposed by Håkan in his question) is to look for the shortest possible list, i.e., minimize .
Next, observe that if and only if two components of are identical. If , we can assume that all components of are distinct. If , we can solve the problem for and then duplicate any one component of the resulting vector to get a minimum dimension solution to the original problem.
Combining the assumption that and the observation about adding a constant having no effect, we can assume that the minimum element of is 1. That in turn implies that the maximum element of is where .
From there, Håkan went on to solve a test problem using constraint programming (CP). Although I'm inclined to suspect that CP will be more efficient in general than an integer programming (IP) model, I went ahead and solved his test problem via an IP model (coded in Java and solved using CPLEX 12.10). CPLEX's solution pool feature found the same four solutions to Håkan's example that he did, in under 100 ms. How well the IP method scales is an open question, but it certainly works for modest size problems.
The IP model uses binary variables to decide which of the integers are included in the solution . It also uses variables for all such that . The intent is that if both and are included in the solution, and otherwise. We could declare the to be binary, but we do not need to; constraints will force them to be or .
The full IP model is as follows:
The objective (1) minimizes the number of integers used. Constraints (2) through (4) enforce the rule that if and only if both and are (i.e., if and only if both and are included in the solution). Constraint (5) precludes the inclusion of any pair whose difference is not in , while constraint (6) says that for each difference we must include at least one pair for that produces that difference (). Finally, since we assumed that our solution starts with minimum value , constraint (7) ensures that is in the solution. (This constraint is redundant, but appears to help the solver a little, although I can't be sure given the short run times.)
My Java code is available from my repository (bring your own CPLEX).