Is it possible to identify what magnet has crossed over a hall effect sensor?
Look at RFID tags. They can be microscopically small (and lightweight). And cost only a few pennies for guaranteed unique identification. You could  put a tag in each piece of rolling stock and use inexpensive sensor kit(s) to monitor/record/control the complete makeup of trains.

Ref: http://www.pcrnmra.org/pcr/clinics/RFID-in-Model-Railroading-20130123.pdf