|
Edited on Sat Mar-13-04 04:21 PM by htuttle
I wrote a taxi dispatching system some years ago, and studied GnuChess first to get a general idea of how to go about doing a brute force problem solving algorithm.
One thing I'd say was vastly different: In chess, you have a finite number of pieces, and a finite (albeit large) number of possible end states. In any 'real life' endeavor, you probably have a functionally infinite number of possible end states -- actually, there is no 'end state'. In addition, unlike chess, when dispatching taxicabs and fares, new 'pieces' pop up on the board all the time.
What I decided was that it wasn't much use to work much past the second move, if that. The 'board' was too dynamic to bother working it farther. In addition, each 'piece' would move once (make one decision) per 'turn' (or 'round' in my lingo), instead of one move per 'turn' per side. I settled on going over the entire fleet once, figuring out the best 'first move', then doing it again for the second move, based on the first.
'Moves' (assignments) were weighted based on a number of factors (which I'm still in the process of modifying regularly). The first 'move' (assignment) for each taxi was weighted higher than the second. The best two assignment pair was then chosen for that taxi.
However, what I'd like to do is also compare each taxi's 'pair' of assignments (which my also be two 'null' assignments, ie., no calls to that taxi this round) with every other taxi's pairs, so that if two taxis were up for the same fare, the one with the best 'fitter' (more taxi lingo) would end up with it. Unfortunately, I didn't get this far, since I started to worry that my algorithm was getting kind of ugly. I think my class hierarchy needs a bit of refactoring before I go there.
Since we have some regular sets of fares that ride everyday at the same time, I'd like to treat favorable combinations of these in a manner similar to the 'book' in a chess program, but that will have to wait for refactoring as well.
|