本文整理汇总了Python中volttron.platform.agent.base_market_agent.poly_line.PolyLine.compare方法的典型用法代码示例。如果您正苦于以下问题:Python PolyLine.compare方法的具体用法?Python PolyLine.compare怎么用?Python PolyLine.compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类volttron.platform.agent.base_market_agent.poly_line.PolyLine
的用法示例。
在下文中一共展示了PolyLine.compare方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: settle
# 需要导入模块: from volttron.platform.agent.base_market_agent.poly_line import PolyLine [as 别名]
# 或者: from volttron.platform.agent.base_market_agent.poly_line.PolyLine import compare [as 别名]
def settle(self):
enough_buys = len(self._buy_offers) > 0
enough_sells = len(self._sell_offers) > 0
if enough_buys:
demand_curve = self._aggregate(self._buy_offers)
else:
_log.debug("There are no buy offers.")
if enough_sells:
supply_curve = self._aggregate(self._sell_offers)
else:
_log.debug("There are no sell offers.")
if enough_buys and enough_sells:
intersection = PolyLine.intersection(demand_curve, supply_curve)
else:
intersection = None, None, {}
quantity = intersection[0]
price = intersection[1]
aux = PolyLine.compare(demand_curve, supply_curve)
return quantity, price, aux