Re: Looking for an algorithm to accomplish the following



There are indeed N sets and 1 result set. You can sum more than 2 sets to
get the results. Going by the total as you suggested may not work since you
may have two sets that have the same values but they are in reversed
positions (X=5, Y=7) and (X=7, Y=5) <-- simplified for clarity.

Now the elimination concept will work to an extent, but it will still leave
large number of sets to iterate.

"kendo" <Kendo.Zhang@xxxxxxxxx> wrote in message
news:1125468493.591862.64670@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>I hope it might be useful.
> There are N sets and 1 result set.
> Sum the attributes like this.
> sum the rows.
> entries sets:
> 10 15 5 25 55
> 10 5 10 20 45
> 10 10 20 0 40
> 10 30 10 5 55
> result set:
> 20 15 30 20 85
>
> Now the algorithm will really depend on the general behaviour of data.
> 1.
> If the first attribut is always 10, then the first attribut of the
> result set give us a clue
> about the number of sets that we need to add. 20 means 2 sets. Then we
> will try to
> find TWO numbers in the right most column which add up to 85.
> 2.
> If the number of attributes are really weird, like 3.1416442 or
> 6.842555 etc. and it will be much easier... what are the odds that the
> row sums will coincide with these kinds of attributes?
> if the row sum of entries are :
> 10.2599588
> 9.58745555
> 88.5456688
> 3.21158788
> ....
>
> Not a lot of these sums can add up to a result sum like 125.8499972
> Maybe you still need a complet enumeration here.
> 3.
> and maybe you can do a little tricks to eliminate certain rows, like
> the last attribute of first entry is 25 but the last attribute of
> result set is 20. There is no way 25 can add up to 20. It might be
> useful if you have a large database and it is just not worth it to
> wasting time to consider these entries.
> 4.
> so maybe you can conclude the number of sets we need by doing this:
> find the maximal sum and the minimal sum using only two sets.
> Like the two biggest sets(bigger means the ROW SUM is bigger) add
> together, the sum of these sets' row sum is still smaller than the row
> sum of result set, you will know that more than 2 sets are needed. By
> the same methode, you can find the Min. if the row sum of result set is
> smaller than the min sum of 4 sets. then we know that 3 sets are
> required.
>
> When you found some rows which sum is equal to the row sum of result
> set, then you can check attribute by attribute.
>


.



Relevant Pages

  • Re: Debug for my code, help~
    ... one with the sum of every column and row equals to one, ... What do I mean by an additive shift? ... unit row sum normalized and unit ... % ans = ...
    (comp.soft-sys.matlab)
  • Re: Looking for an algorithm to accomplish the following
    ... Sum the attributes like this. ... If the first attribut is always 10, then the first attribut of the ... if the row sum of entries are: ... useful if you have a large database and it is just not worth it to ...
    (sci.math)
  • Add record to a query with totals.
    ... I have a query with totals: 2 fields use the sum function. ... I only want to show the CardID once, then on the same row sum the two fields ... It will not let me add new records when I have Totals. ...
    (microsoft.public.access.queries)
  • Re: Multiple Sheets and Columns
    ... Column E = values to sum ... Valko" wrote: ... Each Date has like 10 entries below before going to the next Date. ... I have a formula that gets all the totals in one bucket, ...
    (microsoft.public.excel.worksheet.functions)
  • Re: How to find the maximum sum of atleast L consecutive integersgivena sequence of N integers.
    ... I assume the starred entries are supposed to be the selection? ... The *s mark the point at which any candidate sum is found, ... I just used rand to supply a stream of positive integers. ...
    (comp.programming)