Dijkstra Algorithm Optimization for Unique Rules System

Job ID: 40603082

Budget: ₹1,500 – ₹12,500 INR

Need algorithm- specifically Djikstra expert for optimizing special , particular case of Djikstra in a special rules system.

# Rules :
In a 2d grid, each point can either have an object or not.
Object can be of different types wood, stone, dirt, etc. eac
Each object has a current value.
Object can be a current source, if it is, it will have 66 current.
For any current source, it can give current to object connected to it through other objects. for any object, current can only travel to all of its 8 neighbours.
Each type of object has a resistance.

for A and B adjacent objects :
If A has 5 current, and it gives 2 current to B, B has 2 current, while A still has 5 current, not 5 - 2 = 3 current.
if A has 10 current, and 2 current is to travel to B, and B's resistance is 6, then B will get 2/6 = 1/3 current.

for A adjacent to B, all of A's current travels to B, but B only gets whats left after applying resistance.

current needs to travel through objects.
For any object connected to a current source object, the current the object will be the current through the path of least resistance, i.e. max. possible current.

Value of current of an object is sum of contributions of all sources connected to it .

# current alogorithm used - djikstra :
for current source, neigbour of a object only accepts current coming from the object if its greater than its present value. This results in choosing the path of least resistance for each object.
current is propagated from the current source outwards.
Propogation from each current source is done seperately as of now to get contribution from each.

# the problem :
When sources increase, it becomes very computationally expensive. Typically there will be thousands of sources in a region of 30000 points that need to be computed often .
so either reduce work per source or find a way process multiple sources efficiently while keeping seperate contributions. Or do something different entirely.