Title: Optimal power flow based on a generalized loss formula