Hi folks,
I'm pretty new to Drools and try to figure out how to get the best
out of this technology.
The issue at hand is a two-layered grid analysis of a given area regarding
its threat-level, which is calculated by certain rules.
So let's get started by explaining the problem:
I have a rectangular area, which is sliced into a grid:
=> int[][] threatLvl = int[maxX][maxY], where threatLvl[myX][myY]
represents the threat-level of the certain block
I also do have information about the following:
the position of a ball (x/y)
the position of 5 friendly units (x/y)
the position of 5 enemy units (x/y)
the (constant) position of a goal (x0, y1 to y2)
the information about which team is in control of the ball
In case you were wondering: yes, it's about some kind of soccer ;)
My aim is to calculate a basic threat-level for each block based on the
following rules:
#1 a block is more dangerous, when there is a direct line between the block
and the goal (any point of the goal), which is not blocked by a
defensive/offensive unit ( => additional threat of T / 0.5*T )
#2 a block is more dangerous, when there is a direct line between the block
and the ball, which is not blocked by a defensive/offensive unit (+ threat T
/ 0.5*T)
#3 a block receives a higher threat-level for any offensive unit within a
certain range, the closer the unit, the higher the threat (something like
already calculated Threat-Amount times a factor, which is influenced by the
range)
#4 a block receives a lower threat-level for any defensive unit within a
certain range, the closer the unit, the lower the threat (something like
already calculated Threat-Amount divided by a factor, which is influenced by
the range)
Note additionally: the x/y of all units are their midpoints, the actual unit
has a (constant) radius of R, which has to be translated into an area,
effecting rules #1 and #2.
Secondly, I will divide my calculation into 2 layers in order to optimize.
At first, i will calculate the level for the midpoint of a (let's say)
5x5-block, if this block reaches a certain threat-level, i consider it
worthy being analyzed in depth, going through the rules again for every 1x1
block inside the 5x5 block.
My thoughts on solving this:
- Is this a problem i should solve with Drools (being more of a rhetorical
question ;D )
- Given it is: Should i declare one large rule (which crosses my
comprehension of drools) or can i split this up into multiple rules
- i know i can create rule-groups and control, that rules #3 and #4 are
fired after #1 and #2, in order to ensure i multiply the correct numbers
- i feel the extremely powerful accumulate functions are just what i need,
yet i can't figure how to use them efficiently in this case
Lastly, i want to state that i do of course _not_ seek some kind of complete
implementation, but rather draw on your experience and learn how to approach
this issue.
Thanks to anyone, who is willing to spend his time to think about this issue
with me :)
Vendetta
--
View this message in context:
http://n3.nabble.com/Grid-analyzing-with-drools-tp718061p718061.html
Sent from the Drools - User mailing list archive at
Nabble.com.