The AI logic isn't perfect, but it seems reasonable in my book. Basically, if the AI has a unit that can give extra food, it checks all it's cities and the distance to them. Then, if searches the cities to see if any are stagnating or starving. Those are first priority, and the trade caravan will head to them if they aren't really far way (if it takes less than 12 turns to arrive there). Then, if none of those flag, it heads to the first city it sees that is ranked as small in regards to population, to give it a boost. If you have any other suggestions, or complaints about this, I'd love to hear them... otherwise