本文整理汇总了Python中volttron.platform.agent.base_market_agent.poly_line.PolyLine.intersection方法的典型用法代码示例。如果您正苦于以下问题:Python PolyLine.intersection方法的具体用法?Python PolyLine.intersection怎么用?Python PolyLine.intersection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类volttron.platform.agent.base_market_agent.poly_line.PolyLine
的用法示例。
在下文中一共展示了PolyLine.intersection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 intersection [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
示例2: test_poly_line_no_intersection
# 需要导入模块: from volttron.platform.agent.base_market_agent.poly_line import PolyLine [as 别名]
# 或者: from volttron.platform.agent.base_market_agent.poly_line.PolyLine import intersection [as 别名]
def test_poly_line_no_intersection():
demand1 = create_demand_curve()
demand2 = create_demand_curve()
intersection = PolyLine.intersection(demand1, demand2)
assert len(intersection) == 2
示例3: test_poly_line_intersection_yeilds_two
# 需要导入模块: from volttron.platform.agent.base_market_agent.poly_line import PolyLine [as 别名]
# 或者: from volttron.platform.agent.base_market_agent.poly_line.PolyLine import intersection [as 别名]
def test_poly_line_intersection_yeilds_two():
demand = create_demand_curve()
supply = create_supply_curve()
intersection = PolyLine.intersection(demand, supply)
assert len(intersection) == 2
示例4: test_poly_line_intersection_not_none
# 需要导入模块: from volttron.platform.agent.base_market_agent.poly_line import PolyLine [as 别名]
# 或者: from volttron.platform.agent.base_market_agent.poly_line.PolyLine import intersection [as 别名]
def test_poly_line_intersection_not_none():
demand = create_demand_curve()
supply = create_supply_curve()
intersection = PolyLine.intersection(demand, supply)
assert intersection is not None