# Concurrency Programming GURUS: Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

• September 23rd, 2011, 06:08 AM
Novice85
Concurrency Programming GURUS: Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
There exists a mountainous land in a galaxy far, far away (called MKWorld) where a number (n) of strange magical animals roam. All these animals have a location device attached to them, which periodically outputs their coordinates (x,y) and height above sea LEVEL (note that some animals may live in the deep sea). You are a biologist studying these animals. However, unfortunately you can never see these animals ( “far, far away”). The only information you have for your scientific inquiry is the text files produced by the location devices. Each file contains a (potentially very long) record (or time series) of the roaming of a particular animal. This is a list of numbers with the format:

<counter> <x> <y> <height>

Here, <counter> keeps track of the number of readings recorded

– it will be sequential, but may count in increments greater than 1. The coordinate values <x> and <y> can be thought of as the latitude and the longitude, but may have odd ranges - this is not Earth!

Also, note that counter must be a long value and <x> , <y> and

<h> are floating point values.

The magical strength (M) of each animal is determined by the temperature (which is constant throughout the land), their current x,y position and height h, according to the following expression:

M[x][y] = -T*ln(P(x,y)) – h

Here, P is the probability of animals being at a particular point. Probability is calculated in a straightforward manner as the number of times that an animal is at a particular x,y value divided by the total number of records. To make things easier, you will divide the2D space into blocks and calculate a 2D histogram of the x,y frequency for each animal in each block and then calculate the probabilities of each block from that. The accuracy of this approach is determined by the block size, which is determined by the number of divisions, or bins, in each dimension. You decide that this will best be done with an input parameter, to allow you to fiddle with different grid resolutions. You also don’t know the range of values for either <x> or <y>, but will need to obtain them from scanning the file.

Finally, for the formula you will also need to calculate the average height for each grid point.

The application should output the magical strength matrix for each animal individually, as well as a magical strength matrix for all the animals together. It should be as concurrent as possible – you want research results quickly!
• September 23rd, 2011, 06:31 AM
Sean4u
Re: Concurrency Programming GURUS: Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Quote:

you want research results quickly!
I don't feel the slightest trace of desire for such a thing in this case.

You might be better off addressing a request like this one to liveperson.com, or alternatively you could post your best shot at a solution and some of us might constructively criticise it, offer opinion / help / encouragement etc. My top tip would be to say exactly what it is you would like a respondent to do. If it's "do my work for me", I suspect you'll get a few unpleasant responses.
• September 23rd, 2011, 08:43 AM
copeg
Re: Concurrency Programming GURUS: Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
These forums do not work this way, and sending out multiple private messages will hurt your chances of receiving help even more. Once you make an effort, should you get stuck, ask a specific question. We are not a homework service or a code repository. Some recommended reading:

How To Ask Questions The Smart Way

http://www.javaprogrammingforums.com...e-posting.html
• September 24th, 2011, 08:56 AM
Novice85
Re: Concurrency Programming GURUS: Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Not a smart question i see..Just needed some help with the conceptualization of this problem.
• September 24th, 2011, 09:07 AM
Norm
Re: You still remember how its like to be a Java Newbie:Please help..
Is that your assignment that you have posted?
Do you have any specific questions or problems with it?
Please post them here.
• September 24th, 2011, 10:17 AM
KevinWorkman
Re: Concurrency Programming GURUS: Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I have deleted your duplicate threads, and moved Norm's questions to this one. I suggest that you answer them.

I also suggest you read copeg's links on asking questions the smart way and programming a homework assignment before you post again.

Further spamming of unanswerable homework questions will get you banned.
• September 26th, 2011, 12:47 AM
Mr.777
Re: Concurrency Programming GURUS: Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Well Novice85, the description you added is so long that it annoyed me, so i can guess that many others can get annoyed too.
It took me to concentrate five to six times on the description as it was not that explainatory.
Well, i don't want to be a hater, just try to read the forum rules.
And try to post the problem you got?
If you want the conceptualization, then atleast be precise and write a short description to let us help you.
Thanks
• September 29th, 2011, 05:31 PM
dabdi
Re: Concurrency Programming GURUS: Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
To get results quickly,each animal's time series can be processed separately because the magical strength of
animals is independent of one other. This parallelization is limited by the number of animals you have so
further divide the work for each animal into smaller pieces. You have already gathered all the data and it is not a live feed.Then divide your region into a grid, and count the number of records in each region in parallel. Writes are not thread safe so you need to synchronize there. Use a 2D array to store the counts in each cell. Then you plot the histograms and calculate strength from the frequency tables. The rest is detail you can work out. I don't see any use for the counter since it can be incremented by any amount. So keep track of your own I guess. Hope that helps.