I tried this question over in the algorithms section of stackoverflow and never really got a handle on the problem. I know it concerns non-linear mixed integer programming.

[In the following, 1...n and k are subscripts. n will be relatively small - like say 5-20, or something like that. No more than a second or two to solve computationally, but I can cut it off after some time limit.]

Say you have C1...Cn, and some some positive integer M. (C1...Cn are positive constants and need not be integers. M will incidentally always be 127.) Can you find a postive scaling factor s and a group of integers t1...tn each less than or equal to M (and greater than 0) such that the following objective function is minimized:

summation[for k=1 to n] of (abs(tk*s - Ck)).

Sort of akin to some variant of the knapsack problem or something else maybe? I don't know. Haven't really done non-linear programming before.