This seems to be the place where to coders hangout...even though it's been dead for a month..
Anyway, i'm working on something of a trade simulator and am designing an algorithm to assign AI freighters to pick up cargo and sell it somewhere, so that the profit is maximized.
I was wondering how some of the coders here would handle this.
The pathfinding isn't a problem, you can assume that finding a path and determining the distance between 2 locations is easily computable.
There are a certain amount of freighters, each located somewhere on the map.
Freighters have a cost of moving, the cost is linear to the distance travelled.
Freighters also have an upkeep cost, this is linear to the amount of time passed.
Furthermore there are ports. Each port sells and buy items for a certain price, the price for an item can be different at different ports.
I'm probably looking for some kind of approximation to the optimum here, since computing it exactly would most likely take too long.
Some thoughts i had about it:
Freighters only look for a trade route within a certain distance of their current location, and then it simply compares all possible routes within that distance.
However, the freighter might want to end its route at the same location of the start of another route: planning ahead...but that isn't really reliable because other freighters could take that new route before the first freighter gets there. doing it properly then and taking that into account would become too complex as far as i can tell. So i'm forgetting about planning ahead for now.
Soo....any suggestions
Anyway, i'm working on something of a trade simulator and am designing an algorithm to assign AI freighters to pick up cargo and sell it somewhere, so that the profit is maximized.
I was wondering how some of the coders here would handle this.
The pathfinding isn't a problem, you can assume that finding a path and determining the distance between 2 locations is easily computable.
There are a certain amount of freighters, each located somewhere on the map.
Freighters have a cost of moving, the cost is linear to the distance travelled.
Freighters also have an upkeep cost, this is linear to the amount of time passed.
Furthermore there are ports. Each port sells and buy items for a certain price, the price for an item can be different at different ports.
I'm probably looking for some kind of approximation to the optimum here, since computing it exactly would most likely take too long.
Some thoughts i had about it:
Freighters only look for a trade route within a certain distance of their current location, and then it simply compares all possible routes within that distance.
However, the freighter might want to end its route at the same location of the start of another route: planning ahead...but that isn't really reliable because other freighters could take that new route before the first freighter gets there. doing it properly then and taking that into account would become too complex as far as i can tell. So i'm forgetting about planning ahead for now.
Soo....any suggestions
Comment