These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
Previous page12
 

A* algorithm for route planner?

First post
Author
morrosis
Ministry of War
Amarr Empire
#21 - 2012-02-16 22:24:29 UTC
Osku Rei wrote:
morrosis wrote:
Still got a bit of work to do but in the mean time

^.^ My jump calc


As of the time of this post it doesn't work, I put in jita and amarr (or any other combination of systems) and it just says "loading..." and never returns a route. :(

Also tried with the system ids just in case and it threw an error.

*Edit*
Oh, it just returned a result for rens to amarr... it took a good few minutes though lol



Yeah like I said, still needs a little work.
Ewo Deveraux
Care Bear Stare IP
#22 - 2012-04-13 06:45:59 UTC
If anyone has come up with a table of distances, I would love a copy. I really don't know much about computer science, and I need to generate a table of the minimum number of jumps between two systems so I can run some statistics. If anyone could generate such a table for me it would be greatly appreciated.
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#23 - 2012-04-13 10:06:57 UTC
Basic route generation, in PHP, for eve. It's based off someone else's code, though stripped down so it's just working with the IDs, rather than the names. Pays no attention to security status, except as hardwired in the jump list.

Hardwired for Jita to Amarr, with a couple of variables at the very top. Depends on PDO, though taking that out shouldn't be difficult, if you want to use the older style mysql connection. Depends on the SDE.

Generates the route in around 0.01 seconds

https://github.com/fuzzysteve/Eve-Route-Plan

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Essence uk
#24 - 2012-04-13 13:40:14 UTC
Steve Ronuken wrote:
Basic route generation, in PHP, for eve. It's based off someone else's code, though stripped down so it's just working with the IDs, rather than the names. Pays no attention to security status, except as hardwired in the jump list.

Hardwired for Jita to Amarr, with a couple of variables at the very top. Depends on PDO, though taking that out shouldn't be difficult, if you want to use the older style mysql connection. Depends on the SDE.

Generates the route in around 0.01 seconds

https://github.com/fuzzysteve/Eve-Route-Plan


All of lines 16 to 72 is someone else's code (think you added M?), like you said, rest is messy; but good enough attempt.

What's with the microtime_float()?

$start = microtime(true);
// Do something
echo microtime(true) - $start; // This will be in seconds

Yes, they are modelled on real life ;)

Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#25 - 2012-04-13 14:07:02 UTC  |  Edited by: Steve Ronuken
Essence uk wrote:
All of lines 16 to 72 is someone else's code (think you added M?), like you said, rest is messy; but good enough attempt.

What's with the microtime_float()?

$start = microtime(true);
// Do something
echo microtime(true) - $start; // This will be in seconds



Actually, /most/ of it is someone elses, including the stuff that invoked that function. I just stripped it down to IDs, and took out the XML wrapping. I'll dig out the link that I found the base on. It's, unfortunatly, not up and running, as I had to get at it through the wayback machine. (on a different pc right now. I'll dig out the link when I get home)

Doing a little digging, looks like they pretty much lifted it too. But I guess there are only so many ways to write it.


Microtime_float's another lifted function. You'll find it here too. http://php.net/manual/en/function.microtime.php
Basically, Microtime returns the the microsecond part of time, then the epoch time. Microtime_float just adds the two together to allow for some quick math.



*stealthedit:

Original was: http://www.othala.co.uk/2008/02/05/route-finder-for-eve-online/ which is now down.

I grabbed the details from:
http://web.archive.org/web/20090204003853/http://www.othala.co.uk/2008/02/05/route-finder-for-eve-online/


Time to go and add a little detail to the included readme.


second stealth edit:
Ahh. hadn't seen the passing a parameter to microtime. Time for another edit.

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Essence uk
#26 - 2012-04-13 14:36:12 UTC
Steve Ronuken wrote:
[quote=Essence uk]

...

second stealth edit:
Ahh. hadn't seen the passing a parameter to microtime. Time for another edit.


Fair enough :)

I don't think i've used microtime() without ever giving it 'true' parameter :)

Yes, they are modelled on real life ;)

Ewo Deveraux
Care Bear Stare IP
#27 - 2012-04-17 00:39:07 UTC
Uhm, I'm having a hard time running the php script in MySQL...I really don't know what I am doing. Steve, would you be so kind as to post the output as a CSV?
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#28 - 2012-04-17 19:35:30 UTC
Steps:
1: Ensure you have PHP and MySQL installed. If you don't have PDO, then you'll have to change the way the script connects to the database. It's set to use PDO, as it provides something the basic interface is sorely lacking: Place holders. Might not be used in this script, but it's good practice.
2: log into mysql and run the sql from README.database. you need the create statement, and one of the inserts.
3: Edit db.inc.php.example to have the correct connection details for your database. rename to db.inc.php.
4: then, from a command line: php route.php

If you're using XAMPP, with the SDE loaded in, then you should have everything you need. Though you'd need to run it as 'c:\xampp\php\php.exe route.php'

The output should be something like:
10
0.01 (this is the time, so it'll be dependant on your system)
30000144,300139,30002791,300002788,30002789,30003504,30003503,30003491,30002187


with no errors thrown.

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Essence uk
#29 - 2012-04-17 22:55:10 UTC
Ewo Deveraux wrote:
Uhm, I'm having a hard time running the php script in MySQL...I really don't know what I am doing. Steve, would you be so kind as to post the output as a CSV?


Sent you a mail.

Yes, they are modelled on real life ;)

Ewo Deveraux
Care Bear Stare IP
#30 - 2012-04-18 08:16:12 UTC
Steve Ronuken wrote:
Steps:
1: Ensure you have PHP and MySQL installed. If you don't have PDO, then you'll have to change the way the script connects to the database. It's set to use PDO, as it provides something the basic interface is sorely lacking: Place holders. Might not be used in this script, but it's good practice.
2: log into mysql and run the sql from README.database. you need the create statement, and one of the inserts.
3: Edit db.inc.php.example to have the correct connection details for your database. rename to db.inc.php.
4: then, from a command line: php route.php

If you're using XAMPP, with the SDE loaded in, then you should have everything you need. Though you'd need to run it as 'c:\xampp\php\php.exe route.php'

The output should be something like:
10
0.01 (this is the time, so it'll be dependant on your system)
30000144,300139,30002791,300002788,30002789,30003504,30003503,30003491,30002187


with no errors thrown.


Thanks Steve, I really appreciate it. I am just getting my feet wet with MySQL, so this is invaluable, to my learning of programming, and to my research.
Previous page12