-
Notifications
You must be signed in to change notification settings - Fork 1
Handling schedules and Gantt charts
scheptk
includes the class Schedule
, which can be used to save, load and print schedules that can be generated by the supporting scheduling layouts, or can be also generated autonomously by adding tasks to an existing schedule.
A typical schedule file is a text file containing the following tags:
[JOBS=5]
[MACHINES=4]
[SCHEDULE_DATA=1,0,10,0,10,10;1,10,20,2,40,20;2,80,120;1,30,10;3,30,10]
[JOB_ORDER=0,1,2,3,4]
The tag JOBS
indicates the number of jobs in the schedule, MACHINES
the number of machines, and SCHEDULE_DATA
contains the tasks for each job (in the order given by JOB_ORDER
) in the form of a tuple machine, starting_time, duration
.
A schedule stored in a file sched.sch
can be open using the constructor of the class Schedule
. If no argument is specified, an empty instance of the Schedule
class is created. The following code opens and print the schedule contained in the file openshop.sch
from scheptk.scheptk import Schedule
sched = Schedule('openshop.sch')
sched.print()
A schedule can be created by adding tasks to an instance of the class Schedule
. The tasks are added using the method add_task()
, which takes as argument an instance of the class Task
. The constructor of the class Task
requires four arguments, i.e. Task(job, machine, st, ct)
where job
and machine
indicates the job and the machine whereas st
and ct
indicate the starting and completion times of the task, respectively. The following code creates an empty schedule, then it populates it with several tasks and finally