Skip to main content

Task scheduler for python

Project description

Python Task Scheduler

This Python program is a task scheduler that takes a set of tasks and assigns them to resources within their respective resource groups. The program uses Google OR-Tools library to build a constraint programming model and solve it, minimizing the makespan of the tasks.

Features

Define tasks with duration, priority, and resource groups Define resources with availability slots Schedule tasks to resources within their respective resource groups, minimizing the makespan Output the optimal or feasible schedule if found

Requirements

To run this program, you need to have the following packages installed:

Python 3.6 or later ortools (pip install ortools)

Usage

  1. Import the necessary classes and functions:
from scheduler import Resource, ResourceGroup, Task, Scheduler
  1. Define resources and resource groups:
r1_availability_slots = [
     {"slot_id" : 0, "start":0, "end":4},
     {"slot_id" : 1, "start":5, "end":10}
]
r2_availability_slots = [
     {"slot_id" : 0, "start":0, "end":10}
]
resource1 = Resource(id=1, availability_slots=r1_availability_slots)
resource2 = Resource(id=2, availability_slots=r2_availability_slots)
resource_group = ResourceGroup(id=1, resources=[resource1, resource2])
  1. Define tasks with duration, and resource group:
tasks = [Task(id=1, duration=3, resource_group=resource_group)]
  1. Set the scheduling horizon:
horizon = 50
  1. Call the Scheduler function with tasks and horizon:
s = Scheduler()
s.schedule(tasks)

If a solution is found, the program will print the optimal or feasible schedule with makespan, resource assignments, task start and end times, and durations.

Makespan = 8.0
Assigned to resource 2
Task (0, 0): starts: 0, end: 8, duration: 8

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyplanpro-0.0.1.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyplanpro-0.0.1-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file pyplanpro-0.0.1.tar.gz.

File metadata

  • Download URL: pyplanpro-0.0.1.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pyplanpro-0.0.1.tar.gz
Algorithm Hash digest
SHA256 651f709bcf6e6acc00d798fa8409b1ed233cacb646878775133214cf924954b6
MD5 46bb9317030908e35ab47755d00c5997
BLAKE2b-256 981951b65a8ff5c3ee2aecc95681253ee90f3c0b8aa9d22624d1beffc454c13b

See more details on using hashes here.

File details

Details for the file pyplanpro-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyplanpro-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pyplanpro-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0467624bf331e0b93b4e8ac1078189683b83cceed926ae410d0c10751359c582
MD5 1e8a08af54ce995c250912164df7bf76
BLAKE2b-256 e5260ae4e459875c453bcebe384dba4e649ae0430842061a9451564e399d854c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page