Forums Register Login

one for the mathematicians

1
+Pie Number of slices to send: Send
This is more of a maths question rather than pure java.

I need to have my application calculate the impact of something. Every time an error has occurred at a location it is counted. So for example:

Location A:1
Location B:1
Location C:1
Location D:3

Locations A-C have had one error each and location D has had 3.

Calculating the sum is easy but what I need is an algorithm that takes into account the fact that a location has had the error several times and therefore see this as a bigger issue.

An error can only be reported up to 100 times in one location. In the case of the above example, rather than the result being 6 it should be more due to location D. If each location only has 1 reported errors the result would be 4.

What would be the best way to calculate this?
+Pie Number of slices to send: Send
You have to define your rules much more thoroughly.

rather than the result being 6 it should be more due to location D

How much more? What if the values were:
Location A: 0
Location B: 0
Location C: 0
Location D: 3

In this scenario, there is less than 1 incident per location, but because there is more than 1 incident at location D, how do you want that reflected in the result?
+Pie Number of slices to send: Send
To be honest I'm not sure. I've not really thought that part through and I'm open to ideas. The final result should be a percentage between 0-100. A single location doesn't have more than 100 errors.

Location A: 0
Location B: 0
Location C: 0
Location D: 3

That scenario would be the same as:

Location A:1
Location B:1
Location C:1
Location D:3

but minus 3. So if the algorithm were to decide that 3 is weighted as 5 then the final sum would be 5 for the first one and 7 for the second one.

Based on the fact that a single location will not have more than 100 errors and there are 300 locations, what would you say would be a sensible weighting of a location that has more than one error?
+Pie Number of slices to send: Send
If I may ask, what is the purpose of doing all this ? What are your requirements exactly ?

1
+Pie Number of slices to send: Send
 

Robin Heard wrote:To be honest I'm not sure. I've not really thought that part through



Well, that's what you will have to do. It will be really hard for anyone to come up with a good answer without the full spec. Since you know what the application is and what it is supposed to do, you are the one that needs to come up with that spec. The forums is not really a great place for hammering out ideas based on partial specs because only one side of the conversation knows what they are talking about (you) and the other side (us) will have to guess.

For example:

That scenario would be the same as [the first one] but minus 3. So if the algorithm were to decide that 3 is weighted as 5 then the final sum would be 5 for the first one and 7 for the second one.


What that means is hard for me to decipher. Why is 3 a 5, and why is it 5 in one scenario and 7 in another (when one is supposed to be the other minus 3).

Not knowing anything about your situation: I would report an average value. I would set 'thresholds' for what is considered OK (example average < 0.5) what is Code Red (average > 1), and a record of all sites with > 1 incident. But that is a naive attempt at something I don't know anything about.
1
+Pie Number of slices to send: Send
Well, if I were making up the requirements I would start out by weighting Location X to be the square of the number of errors at that location. That makes more errors look much worse (e.g. 50 errors is weighted as 2,500). You might find that too aggressive, in which case you could use some other function which grows more slowly such as N log N or N ^ 1.5 for example. (Remember, you did ask for advice from the mathematicians.) However if you had to explain it to upper management types who couldn't be put off by hand-waving you might get into trouble doing something like that.

But I have no idea where your percentage between 0 and 100 comes into the picture. What would constitute 100%? 50%?
+Pie Number of slices to send: Send
I've done some test cases and N log N seems like a good idea.

Thanks for the help
+Pie Number of slices to send: Send
 

Robin Heard wrote:I've done some test cases and N log N seems like a good idea...


OK, but like Steve, I'm still totally in the dark as to what you're trying to achieve, nor how you arrived at the fact that N log N is a good idea (as opposed to any of the other possibilities suggested).

Design is about WHAT, not HOW; and you seem to have leapt to an implementation (the latter) without being able to describe to us WHAT you're trying to do - and I hate to say, but that's almost invariably a bad way to proceed.

Winston
The human mind is a dangerous plaything. This tiny ad is pretty safe:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 771 times.
Similar Threads
Answers to IBM 486 sample test
Programming in Go - author background?
Compliation error when using 'or' operator on learning website “Learneroo" (Java)
Fresh Meat - Extremely Simple Numerology Word Processing Program - Assistance Requested!
Need tip/advise to solve complex looping
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:44:46.