If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Algorithm for finding subset of permutations with maximum value

Hello,
Can anyone help with suggestions for implementation of an efficient algorithm for the following issue:
Given a list of permutations with a score for each permutation, we need to find a subset of permutations with the highest summed score, given the condition that any one of permutation in the subset will not intersect or be contained with another permutation in the subset.
For example, given the following list of permutations, marked as |Index: start, end, score|, permutation A cannot be in the same subset with permutation B, since they intersect with each other. Permutation C cannot be in the same subset with permutation F, since permutation F is contained within permutation C.

Re: Algorithm for finding subset of permutations with maximum value

This is essentially a "knapsack" problem (see wikipedia), and is loosely in the same type of problems as the travelling salesman.
or in short, no actual algorithm exists for this.

for small datasets you can bruteforce an answer
for large datasets, you can only find a "good" answer within a certain amount of time but you can't guarantee "the best" answer in a reasonable amount of time.
A variety of different methods have been used to find solutions to this with various success and performance. such as ant farms, genetic algorithms, ...

Re: Algorithm for finding subset of permutations with maximum value

Originally Posted by OReubens

or in short, no actual algorithm exists for this.

Of course there exists an algorithm. This for example,

1. Generate all possible subsets of the N "permutations". There are 2^N such subsets.
2. From all possible subsets select the valid (no conflicting "permutations") subsets.
3. From all valid subsets pick the one(s) with the highest score sum.

This is not a polynominal algorithm (it's something like O(2^N * N * logN)) so it's intractable for big N, still it's a working algorithm.

Re: Algorithm for finding subset of permutations with maximum value

Originally Posted by mayeri

I guess the challenge is to implelent this in O(NlogN) rather than the na´ve implemention of O(N2)

Well if you have an O(N^2) algorithm already you've come quite far.

To me it looks like your problem is equivalent to the Weighted Interval Scheduling Problem. To see that you only have to view your "permutations" as weighted time intervals (jobs) with a start time, an end time and a weight (score).

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.