Real-Time Grid Topology Modeling And Optimization For Power Transmission Systems