bpo.planners module

Classes:

GreedyPlanner()

A Planner that assigns tasks to resources in an anything-goes manner.

HeuristicPlanner()

A Planner that takes each task and tries to assign it to the optimal resource.

ImbalancedPredictivePlanner(predicter)

Specific planner for the problem.ImbalancedProblem, to be used for test purposes.

Planner()

Abstract class that all planners must implement.

PredictiveHeuristicPlanner(predicter, ...)

A Planner that tries to assign a task to the optimal resource.

class bpo.planners.GreedyPlanner[source]

Bases: bpo.planners.Planner

A Planner that 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 of Problem.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 be Simulator.now).

class bpo.planners.HeuristicPlanner[source]

Bases: bpo.planners.Planner

A Planner that takes each task and tries to assign it to the optimal resource. The optimal resource must be one of Problem.resources and specified as value of the ‘optimal_resource’ of Task.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 of Problem.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 be Simulator.now).

class bpo.planners.ImbalancedPredictivePlanner(predicter)[source]

Bases: bpo.planners.Planner

Specific planner for the problem.ImbalancedProblem, to be used for test purposes. A Planner that tries to assign a task to the optimal resource, same as the HeuristicPlanner, 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 of Problem.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 be Simulator.now).

class bpo.planners.Planner[source]

Bases: abc.ABC

Abstract 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 of Problem.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 be Simulator.now).

class bpo.planners.PredictiveHeuristicPlanner(predicter, nr_lookahead, epsilon)[source]

Bases: bpo.planners.Planner

A Planner that 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 of Problem.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 be Simulator.now).