Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #8258

Re: Looking for simple brute force solution

From root <NoEMail@home.org>
Newsgroups comp.programming
Subject Re: Looking for simple brute force solution
Date 2018-01-04 16:46 +0000
Organization Linux Advocacy
Message-ID <p2llpa$trn$1@news.albasani.net> (permalink)
References <p2jobe$48s$1@news.albasani.net> <7c7ab511-b4db-47ac-8720-9005d345b271@googlegroups.com> <e03b1053-de0c-488b-b1f3-266755f14760@googlegroups.com> <p2kuq1$hjp$1@dont-email.me> <V4s3C.138032$4Z6.37846@fx41.iad>

Show all headers | View raw


Richard Damon <Richard@Damon-Family.org> wrote:
> On 1/4/18 5:14 AM, root wrote:
>> cost of materials 100.
>> cost of assembly   45.
>> cost of item      145.
>> cost of shipping   11.
>> total cost        156.
>> 
>> 
>> In this list it is easy to see that we can take the
>> first, second, and fourth items to account for the total
>> cost. We have to ignore the intermediate term 145.
>
> It sounds like your goal is to transform that list into something like;
>
>
>          100   Cost of materials
>           45   Cost of Assembly
>      145      Cost of Item
>       11      Cost of Shipping
> 156         Total Cost
>
> Where you assign everything a 'level' (the grand sum being level 0) and 
> a given level is the sum of all the items 1 level higher between it and 
> the previous item of its level. It sounds like you also want to allow 
> some items to be negated for the sum, as credits/debits aren't carefully 
> indicated (which actually make the process much tougher). If at all 
> possible, I would try to understand the category names and assign a sign 
> to them, even if I had to try a couple possibilities, as only having 
> sums and no differences makes things much simpler.

It would make sense that in the income statement expenses would always
have a minus sign, but in my data that isn't true. In order for the
numbers to work out, some of the expenses have to be added to
income. For example, the entry "Total Interest Expense" has to
be subtracted from income. Several lines down, "Other Interest Expense"
has to be added to income for the numbers to hang together. It would
make sense that Other Interest Expense should be ignored as having
already been included in Total Interest Expense.

I am resorting to the brute force method because too many of the
items I see don't make sense to me.
>
> Now if 'running sums' aren't actually right after the items they are the 
> sum for, then you probably need to brute force the solution.

In my case, the running sums are generally ahead of the individual
items, but are not identified as running sums. Not only that, but
some items which are identified as "expense" are added to income
instead of subtracted.

>
> IF you can try assigning signs to values to make it so you are always 
> adding, then you can work starting at the top of the list with the 
> second item (as the first can't be a running sum) and see if that item 
> is the sum of some number of items before it that aren't part of a 
> previously detected running sum, and if you find such a case, mark it as 
> a running sum, and push everything that went into it up a level (and 
> things that made them up a level too).
>
> Note, this means that Cost of Shipping would only check if it was 'sum 
> of Cost of Item, and not include Cost of Assembly, as this is already 
> accounted for.
>
> There is a chance that you may miss-detect some running sums if the 
> numbers aren't accurate or just happen to add up, and for a one-off, 

My numbers are only good for 4 digits. That means that when my best
understanding is off by a "little" I can't be sure that I haven't
made a mistake.

There are three types of reports in financial statements: income, balance,
and cash-flow. The numbers in all three reports have to be consistent,
and that is a higher level of difficulty. Whatever I deduce from the
income statement has to correspond to what I infer from the cash-flow
statement and that isn't working out given the accuracy of the numbers
I have.

> just outputting that detection may be enough (or even do it by hand, as 
> the human brain is better at detecting suspicious conditions) for you to 
> manually adjust things.
>
> If you really need to do it programmatically, you can add back tracking 
> where you systematically undo marking things as possible running sums 
> until you get to a suitable result.

That is what the brute force method is doing.
>

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-03 23:18 +0000
  Re: Looking for simple brute force solution fir <profesor.fir@gmail.com> - 2018-01-03 16:49 -0800
    Re: Looking for simple brute force solution fir <profesor.fir@gmail.com> - 2018-01-03 17:11 -0800
      Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 10:14 +0000
        Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-04 10:52 -0500
          Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 16:46 +0000
            Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-04 12:37 -0500
  Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-03 21:28 -0500
    Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 09:42 +0000
      Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-04 10:16 -0500
        Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 17:26 +0000
          Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 21:19 +0000
  Re: Looking for simple brute force solution Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-01-04 02:29 +0000
    Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 09:55 +0000
      Re: Looking for simple brute force solution Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-01-04 14:29 +0000
        Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 16:55 +0000
          Re: Looking for simple brute force solution Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-01-04 20:36 +0000
      Re: Looking for simple brute force solution Robert Wessel <robertwessel2@yahoo.com> - 2018-01-04 12:03 -0600
        Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 21:28 +0000
          Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 21:50 +0000
            Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-04 23:06 +0000
            Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-04 21:35 -0500
              Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-05 05:59 +0000
                Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-05 16:48 +0000
                Re: Looking for simple brute force solution Richard Damon <Richard@Damon-Family.org> - 2018-01-06 08:50 -0500
                Re: Looking for simple brute force solution root <NoEMail@home.org> - 2018-01-06 16:47 +0000

csiph-web