hi there,
i have this problem:
i need to sort an array of objects so that an overall quality of the array to be maximum.
-the quality of the array depends on the order the points are in the array.
- the arrays i am supposed to sort are small (3-7 members)
for example: a={A B C D E} is the array and f(a) is the quality function.
Code:
f(a)=f(A)*f(A,B)*f(A,B,C)*f(B,C,D)*f(C,D,E)*f(E)
is there a way i can use the STL sorting algorithms to do the sorting? or at least some of it?
I will appreciate even a hint about the right direction to be followed
Right now, i am generating all possible combinations and checking them all, so it "must" be a better way to do it than this. reducing the amount of computation to be done by chosing the A so that f(A) is best does not work, as there are cases with better f(a) which have a worse-than-optimal f(A).
thank you