Question Walk time optimalizer

File Not Found

Guest
On my laptop, I have the codebase for my farming script generator...

It takes the coordinates (and troops) of all of your villages (or just the ones on the page), and accepts a list of coords (I usually used tribalwars map to get all barbs in a K (there is a page to do that in one go)), then alocates X (user specified) number of target villages to each of your own villages, and generates a rather large (and to be honest, poorly coded) farming script. I generally updated once a week or so.

It isn't reakky what your after though, as it assigns targets to your villages in the order your villages appear, and the closest unused target, then loops your villages until its out of targets, or you've reached X.
 

DeletedUser

Guest
Would it be faster if you translated all this to C and then had the script sit on a webserver and have php call the script and pass the village variables? I'm not sure how much time it'll save but it should be faster than straight JavaScript.

P.S. If you need a webserver to test my suggestions just let me know, I could give u some small access to mine.

I don't think it would be much faster in C just because with the Hungarian algorithum their is no way to get around the size of data created. A 1000x1000 matrix holds 1 million entities and you also need a few other large variables to handle the selection of zeros.


Anyways I finished my version in javascript and got 1000x1000 matrix solve time down to 100 seconds.

Hungarian algorithm V6
The function is called by
Code:
FindAssignments(villages,targets)
Where villages and targets are arrays of coordinates and targets.length>=villages.length
It returns an array with the index equaling the index of the coord at the same index of the villages array.
The value equals the index of the coord in the targets array.

Example:
will add soon...
Code:
FindAssignments([],[]) returns []


Speeds:(all speed test done on my laptop, only a 1% change between different browsers.)
200x200 1 second
500x500 12 seconds
1000x1000 100 seconds :icon_biggrin:


If anyone has question/improvement to my implementation my skype is iridescent63. Also if you thinking of doing your own implementation I can give you a lot of ideas on how to speed up the code no matter what language it's in.
 

DeletedUser

Guest
I also downloaded your excel file called: 'Example' (the thing that calculates something like walk times).

1A = first coordinate
1B = second coordinate (target)
1C = Unit
1D = Some kind of number, that get bigger when I choose for longer distances.


Please could I get a copy of this spreadsheet? :)
 
Top