Returns the reward corresponding to the last action performed.

def getReward(self):
        """ Returns the reward corresponding to the last action performed.
        """
        t = self.env.market.period

        # Compute revenue minus costs.
        totalEarnings = 0.0
        for g in self.env.generators:
            # Compute costs in $ (not $/hr).
            costs = g.total_cost(round(g.p, 4),
                                 self.env._g0[g]["p_cost"],
                                 self.env._g0[g]["pcost_model"])

            offbids = [ob for ob in self.env._lastAction if ob.generator == g]

            revenue = t * sum([ob.revenue for ob in offbids])
            if offbids:
                revenue += offbids[0].noLoadCost

            if g.is_load:
                earnings = costs - revenue
            else:
                earnings = revenue - costs#(fixedCost + variableCost)

            logger.debug("Generator [%s] earnings: %.2f (%.2f, %.2f)" %
                         (g.name, earnings, revenue, costs))

            totalEarnings += earnings

        # Startup/shutdown costs.
        onlineCosts = 0.0
        for i, g in enumerate(self.env.generators):
            if self._gOnline[i] and not g.online:
                onlineCosts += g.c_shutdown
            elif not self._gOnline[i] and g.online:
                onlineCosts += g.c_startup
        self._gOnline = [g.online for g in self.env.generators]

        reward = totalEarnings - onlineCosts
        self.addReward(reward)

        logger.debug("Task reward: %.2f (%.2f - %.2f)" %
                     (reward, totalEarnings, onlineCosts))

        return reward