def _clipPrices(self):
        """ Clip cleared prices according to guarantees and limits.
        """
        # Guarantee that cleared offer prices are >= offers.
        if self.guaranteeOfferPrice:
            for offer in self.offers:
                if offer.accepted and offer.clearedPrice < offer.price:
                    offer.clearedPrice = offer.price

        # Guarantee that cleared bid prices are <= bids.
        if self.guaranteeBidPrice:
            for bid in self.bids:
                if bid.accepted and bid.clearedPrice > bid.price:
                    bid.clearedPrice = bid.price

        # Clip cleared offer prices.
        if self.limits.has_key("maxClearedOffer"):
            maxClearedOffer = self.limits["maxClearedOffer"]

            for offer in self.offers:
                if offer.clearedPrice > maxClearedOffer:
                    offer.clearedPrice = maxClearedOffer

        # Clip cleared bid prices.
        if self.limits.has_key("minClearedBid"):
            minClearedBid = self.limits["minClearedBid"]

            for bid in self.bids:
                if bid.clearedPrice < minClearedBid:
                    bid.clearedPrice = minClearedBid

        # Make prices uniform across all offers/bids for each generator after
        # clipping (except for discrim auction) since clipping may only affect
        # a single block of a multi-block generator.
        if self.auctionType != DISCRIMINATIVE:
            for g in self.case.generators:
                gOffers = [of for of in self.offers if of.generator == g]
                if gOffers:
                    uniformPrice = max([of.clearedPrice for of in gOffers])
                    for of in gOffers:
                        of.clearedPrice = uniformPrice

                gBids = [bid for bid in self.bids if bid.vLoad == g]
                if gBids:
                    uniformPrice = min([bid.cleared_price for bid in gBids])
                    for bid in gBids:
                        bid.clearedPrice = uniformPrice
def _clipPrices ( self ) : if self . guaranteeOfferPrice : for offer in self . offers : if offer . accepted and offer . clearedPrice < offer . price : offer . clearedPrice = offer . price if self . guaranteeBidPrice : for bid in self . bids : if bid . accepted and bid . clearedPrice > bid . price : bid . clearedPrice = bid . price if self . limits . has_key ( "maxClearedOffer" ) : maxClearedOffer = self . limits [ "maxClearedOffer" ] for offer in self . offers : if offer . clearedPrice > maxClearedOffer : offer . clearedPrice = maxClearedOffer if self . limits . has_key ( "minClearedBid" ) : minClearedBid = self . limits [ "minClearedBid" ] for bid in self . bids : if bid . clearedPrice < minClearedBid : bid . clearedPrice = minClearedBid if self . auctionType != DISCRIMINATIVE : for g in self . case . generators : gOffers = [ of for of in self . offers if of . generator == g ] if gOffers : uniformPrice = max ( [ of . clearedPrice for of in gOffers ] ) for of in gOffers : of . clearedPrice = uniformPrice gBids = [ bid for bid in self . bids if bid . vLoad == g ] if gBids : uniformPrice = min ( [ bid . cleared_price for bid in gBids ] ) for bid in gBids : bid . clearedPrice = uniformPrice
Clip cleared prices according to guarantees and limits.