bpo.planners module¶
Classes:
A |
|
A |
|
|
Specific planner for the |
|
Abstract class that all planners must implement. |
|
A |
- class bpo.planners.GreedyPlanner[source]¶
Bases:
bpo.planners.PlannerA
Plannerthat assigns tasks to resources in an anything-goes manner.Methods:
assign(environment)Assign tasks to resources from the simulation environment.
- assign(environment)[source]¶
Assign tasks to resources from the simulation environment.
- Parameters
environment – a
Simulator- Returns
[(task, resource, moment)], where task is an instance of
Task, resource is one ofProblem.resources, and moment is a number representing the moment in simulation time at which the resource must be assigned to the task (typically, this can also beSimulator.now).
- class bpo.planners.HeuristicPlanner[source]¶
Bases:
bpo.planners.PlannerA
Plannerthat takes each task and tries to assign it to the optimal resource. The optimal resource must be one ofProblem.resourcesand specified as value of the ‘optimal_resource’ ofTask.data. If no such resource is available, it will assign an arbitrary resource.Methods:
assign(environment)Assign tasks to resources from the simulation environment.
- assign(environment)[source]¶
Assign tasks to resources from the simulation environment.
- Parameters
environment – a
Simulator- Returns
[(task, resource, moment)], where task is an instance of
Task, resource is one ofProblem.resources, and moment is a number representing the moment in simulation time at which the resource must be assigned to the task (typically, this can also beSimulator.now).
- class bpo.planners.ImbalancedPredictivePlanner(predicter)[source]¶
Bases:
bpo.planners.PlannerSpecific planner for the
problem.ImbalancedProblem, to be used for test purposes. APlannerthat tries to assign a task to the optimal resource, same as theHeuristicPlanner, but failing that will predict if it is better to wait with the assignment or assign to a suboptimal resource. Specifically, if the optimal resource is not available, it will make a prediction, using the passed predicter, to check if the optimal resource will be ready in time before it becomes better to assign another resource. If so, it will not assign the task.Methods:
assign(environment)Assign tasks to resources from the simulation environment.
- assign(environment)[source]¶
Assign tasks to resources from the simulation environment.
- Parameters
environment – a
Simulator- Returns
[(task, resource, moment)], where task is an instance of
Task, resource is one ofProblem.resources, and moment is a number representing the moment in simulation time at which the resource must be assigned to the task (typically, this can also beSimulator.now).
- class bpo.planners.Planner[source]¶
Bases:
abc.ABCAbstract class that all planners must implement.
Methods:
assign(environment)Assign tasks to resources from the simulation environment.
- abstract assign(environment)[source]¶
Assign tasks to resources from the simulation environment.
- Parameters
environment – a
Simulator- Returns
[(task, resource, moment)], where task is an instance of
Task, resource is one ofProblem.resources, and moment is a number representing the moment in simulation time at which the resource must be assigned to the task (typically, this can also beSimulator.now).
- class bpo.planners.PredictiveHeuristicPlanner(predicter, nr_lookahead, epsilon)[source]¶
Bases:
bpo.planners.PlannerA
Plannerthat tries to assign a task to the optimal resource. This is the resource that is predicted to have the lowest processing time on the task. It takes the list of unassigned tasks and the list of available resources and creates the assignment with the lowest processing time (in a greedy manner). To avoid starvation of tasks, it only looks in the first nr_lookahead tasks and with probability epsilon simply assigns the first task. If nr_lookahead is 0, it looks at all tasks.Methods:
assign(environment)Assign tasks to resources from the simulation environment.
- assign(environment)[source]¶
Assign tasks to resources from the simulation environment.
- Parameters
environment – a
Simulator- Returns
[(task, resource, moment)], where task is an instance of
Task, resource is one ofProblem.resources, and moment is a number representing the moment in simulation time at which the resource must be assigned to the task (typically, this can also beSimulator.now).