I have the following selection problem:
Given a population of N items, each item having a +ve cost(C_i) and given a user input k and total cost S. Find the optimal k items from the population of N items such that abs(S-sum(C_i)) is minimum.
Will appreciate any help on this
Do you have a bound on N or S? If N is small, you can try all subsets. If S is small you can solve it with knapsack (look for min sum(C_i)>=S and max sum(C_i)<=S)