当前位置: 首页>>代码示例>>Python>>正文


Python PolyLine.intersection方法代码示例

本文整理汇总了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
开发者ID:Kisensum,项目名称:volttron,代码行数:24,代码来源:offer_manager.py

示例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
开发者ID:VOLTTRON,项目名称:volttron,代码行数:7,代码来源:test_poly_line.py

示例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
开发者ID:VOLTTRON,项目名称:volttron,代码行数:7,代码来源:test_poly_line.py

示例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
开发者ID:VOLTTRON,项目名称:volttron,代码行数:7,代码来源:test_poly_line.py


注:本文中的volttron.platform.agent.base_market_agent.poly_line.PolyLine.intersection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。