code: def _offbidToCase(self):
          
          generators = [g for g in self.case.generators if not g.is_load]
          vLoads = [g for g in self.case.generators if g.is_load]
  
          # Convert offers into piecewise linear segments and update limits.
          for g in generators:
  #            print "G: ", g.p_min, g.p_max, g.p_cost, g.pcost_model
  
              g.offers_to_pwl(self.offers)
  
  #            print "GG:", g.p_min, g.p_max, g.p_cost, g.pcost_model
  
          for vl in vLoads:
  #            print "L: ", vl.p_min, vl.p_max, vl.p_cost
  
              vl.bids_to_pwl(self.bids)
  
  #            print "VL:", vl.p_min, vl.p_max, g.q_min, g.q_max, vl.p_cost
  
          # Move p_min and p_max limits out slightly to avoid problems with
          # lambdas caused by rounding errors when corner point of cost function
          # lies at exactly p_min or p_max.
          for g in generators: # Skip dispatchable loads.
              g.p_min -= 100 * self.violation
              g.p_max += 100 * self.violation
docs: Converts offers/bids to pwl functions and updates limits.