Economic Scheduling Functions to Operate Microgrids in Liberalized Energy Markets