和顺 / 影核 返回所属 Agent
YH-08.03

资源冲突处理

原能力

暴露人员、设备或场地冲突,给出改序、换用或等待的选项。(细化版 p.12–13)

首选项目

OR-Tools(Apache-2.0)。 OR-Tools

匹配范围

资源容量约束检测不可行并求备选。

源码

OR-Tools · def add_cumulative(

ortools/sat/python/cp_model.py · 1476–1489 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
    def add_cumulative(
        self,
        intervals: Iterable[IntervalVar],
        demands: Iterable[LinearExprT],
        capacity: LinearExprT,
    ) -> Constraint:
        """Adds Cumulative(intervals, demands, capacity).

        This constraint enforces that:

            for all t:
              sum(demands[i]
                if (start(intervals[i]) <= t < end(intervals[i])) and
                (intervals[i] is present)) <= capacity
  • # Copyright 2010-2025 Google LLC

OR-Tools · def solve(

ortools/sat/python/cp_model.py · 1785–1798 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
    def solve(
        self,
        model: CpModel,
        solution_callback: Optional["CpSolverSolutionCallback"] = None,
    ) -> cmh.CpSolverStatus:
        """Solves a problem and passes each solution to the callback if not null."""
        with self.__lock:
            self.__solve_wrapper = cmh.SolveWrapper()

        self.__solve_wrapper.set_parameters(self.parameters)
        if solution_callback is not None:
            self.__solve_wrapper.add_solution_callback(solution_callback)

        if self.log_callback is not None:
  • # Copyright 2010-2025 Google LLC

实现与验收要点

资源更换候选、额外成本和负责人定顺序。