Adaptive near-optimal compensation in lossy polyphase power systems