discrete_optimization.generic_tasks_tools.solvers.cp.cpmpy package
Submodules
discrete_optimization.generic_tasks_tools.solvers.cp.cpmpy.auto module
- class discrete_optimization.generic_tasks_tools.solvers.cp.cpmpy.auto.GenericSchedulingAutoCpmpySolver(problem: Problem, params_objective_function: ParamsObjectiveFunction | None = None, solver_name: str | None = None, **kwargs: Any)[source]
Bases:
GenericSchedulingAutoCpSolver[Task,UnaryResource,Skill,NonSkillCumulativeResource,NonRenewableResource,ExclusionResource],TasksCpmpySolver[Task],Generic[Task,UnaryResource,Skill,NonSkillCumulativeResource,NonRenewableResource,ExclusionResource]Generic cpmpy solver for scheduling problems (with or without allocation).
The needed variables are automatically created, with common constraints (precedence, resource capacity). The objective is set by default to global makespan but can be changed by modifying solver.default_objective value.
This solver class needs still to be derived to create a solution from the proper class. You will need at least to implement the conversion from the task variables to the actual solution object.
If custom constraints are needed, override init_model(). If a custom objective is needed, set solver.default_objective to Objective.CUSTOM so that no objective is set by default and override init_model() to define your objective.
- class discrete_optimization.generic_tasks_tools.solvers.cp.cpmpy.auto.SinglemodeGenericSchedulingAutoCpmpySolver(problem: Problem, params_objective_function: ParamsObjectiveFunction | None = None, solver_name: str | None = None, **kwargs: Any)[source]
Bases:
SinglemodeGenericSchedulingAutoCpSolver[Task,UnaryResource,Skill,NonSkillCumulativeResource,NonRenewableResource,ExclusionResource],GenericSchedulingAutoCpmpySolver[Task,UnaryResource,Skill,NonSkillCumulativeResource,NonRenewableResource,ExclusionResource]Subclass of GenericSchedulingAutoCpmpySolver for single mode problems.
Give access to task intervals without dealing with modes.
discrete_optimization.generic_tasks_tools.solvers.cp.cpmpy.auto_impl module
- class discrete_optimization.generic_tasks_tools.solvers.cp.cpmpy.auto_impl.GenericSchedulingAutoCpmpyImplSolver(problem: GenericSchedulingImplProblem, params_objective_function: ParamsObjectiveFunction | None = None, custom_objective_factory: Callable[[GenericSchedulingAutoCpImplSolver], Any] | None = None, **kwargs: Any)[source]
Bases:
GenericSchedulingAutoCpImplSolver,GenericSchedulingAutoCpmpySolver[Hashable,Hashable,Hashable,Hashable,Hashable,Hashable]Generic implementation of cpmpy solver for scheduling problems (with or without allocation).
It implements abstract class GenericSchedulingAutoCpmpySolver.
discrete_optimization.generic_tasks_tools.solvers.cp.cpmpy.base module
- class discrete_optimization.generic_tasks_tools.solvers.cp.cpmpy.base.TasksCpmpySolver(problem: Problem, params_objective_function: ParamsObjectiveFunction | None = None, solver_name: str | None = None, **kwargs: Any)[source]
Bases:
CpmpySolver,TasksCpSolver[Task]- add_cumulative(intervals: Iterable[IntervalVar], demands: Iterable[Any], capacity: Any) list[Any][source]
Add cumulative constraint
Enforces that:
- for all t:
- self.sum(demands[i]
if (start(intervals[i]) <= t < end(intervals[i])) and (intervals[i] is present)) <= capacity
- Parameters:
intervals
demands
capacity
Returns:
- add_no_overlap(intervals: Iterable[IntervalVar]) list[Any][source]
Add constraint so that no intervals overlap.
- Parameters:
intervals
Returns:
- create_interval_var(start: Any, duration: Any, name: str, end: Any | None = None, presence: Any = True) IntervalVar[source]
Create an interval variable in the underlying cp model.
The interval can be - fixed or not - with fixed duration or not - optional (with associated presence bool var)
- Parameters:
start
duration
end
presence – should be a boolean variable if the interval is optional
name
- Returns:
the created interval variable
discrete_optimization.generic_tasks_tools.solvers.cp.cpmpy.interval_var module
- class discrete_optimization.generic_tasks_tools.solvers.cp.cpmpy.interval_var.IntervalVar(start: cpmpy.expressions.core.Expression, name: str, duration: cpmpy.expressions.core.Expression | None = None, end: cpmpy.expressions.core.Expression | None = None, presence: cpmpy.expressions.core.Expression = True)[source]
Bases:
object- duration: Expression | None = None
- end: Expression | None = None
- name: str
- presence: Expression = True
- start: Expression