Skip to content

Start using scheptk

framinan edited this page Feb 6, 2022 · 21 revisions

Installation

scheptk can be installed using PIP. Copy and paste the command to install it from here.

Overview

scheptk contains two main modules:

  • scheptk where the main scheduling classes and its methods are included.
  • util contains a number of functions, some employed by the classes internally.

A typical program runs like this:

from scheptk.scheptk import *
from scheptk.scheptk util *

instance = SingleMachine('test_single.txt')
sequence = sorted_index_asc(instance.dd)
print('EDD sequence for the instance is: ', end='')
print(sequence)
completion_time = instance.SumCj(sequence)
print('The completion time of the sequence is {}'.format(completion_time))

The program starts by instantiating one of the scheduling layout classes (i.e. SingleMachine, ParallelMachines,UnrelatedMachines, FlowShop, JobShop or OpenShop).Each one of these classes contains all the data that describe a scheduling instance of the corresponding type (such as jobs, processing times, due dates, etc). These data are typically loaded from a text file where they are contained in tags. Here is the content of such text file for a SingleMachine instance:

[JOBS=3]
[PT=10,15,6]
[DD=50,65,60]

In this example, it is defined an instance of a single machine scheduling problem with 3 jobs, each one with the processing times 10,15 and 6, and the due dates 50,65 and 60.

Some of these data (such as the number of jobs and the processing times) are mandatory while others (such as the due dates) are optional. The full list of data for each type of instance is provided below.

Once the data have been loaded into an object, they are accessible as attributes of the class:

print('The number of jobs is {}.format(instance.jobs))

The full list of attributes for each type of layout can be found here.

A solution for the instance can be entered or computed using some algorithm. This solution can be evaluated regarding the most common scheduling criteria.

from scheptk.scheptk import *
from scheptk.scheptk util *

instance = SingleMachine('test_single.txt')
solution = [1,0,2]
print('The maximum tardiness of the solution is {}.format(instance.Tmax(solution)))

The first line of the previous example loads the instance of the single machine scheduling problem. The second defines a solution for the problem, in this case a sequence that specifies that job 1 is scheduled first, then job 0 and finally job 2. The third line simply print the maximum tardiness (Tmax) corresponding to the solution.