Power purchase plan using minimal cost flow