Text this: Hybrid Planning for Self-Optimization in Railbound Mechatronic Systems