Table of Contents
Objects of the type task can be grouped into a set of tasks. A set
of tasks is an object of the type
taskset which can be
created by the command
taskset. Syntax for this
T = taskset(tasks[,prec])
tasks is an array of objects of the type
task. Furthermore, relations between tasks can be
defined by precedence constraints in parameter
prec is an adjacency
matrix (see Chapter 6, Graphs) defining a graph where nodes
correspond to tasks and edges are precedence constraints between these
tasks. If there is an edge from
Tj in the graph, it means that
Ti must be completed before
Tj can be started.
If there are not precedence constraints between the tasks, we can use a shorter form of creating a set of tasks using square brackets (see the first line in Figure 4.1, “Creating a set of tasks and adding precedence constraints”).
>> T1 = [t1 t2 t3] Set of 3 tasks >> T1 = taskset(T1,[0 1 1; 0 0 1; 0 0 0]) Set of 3 tasks There are precedence constraints >> T2 = taskset([3 4 2 4 4 2 5 4 8]) Set of 9 tasks
Figure 4.1. Creating a set of tasks and adding precedence constraints
You can also create a set of tasks directly from a vector of
processing times. Call the command
taskset as shown
in Figure 4.1, “Creating a set of tasks and adding precedence constraints”.
Tasks with those processing times will be automatically created inside the
set of tasks. Precedence constraints can be added in the same way as in
case of taskset
T1 (see Figure 4.1, “Creating a set of tasks and adding precedence constraints”).
As for single tasks, command
plot can be used
to draw parameters of set of tasks graphically. An example of plot output
with explanation of used marks is shown in Figure 4.2, “Gantt chart for a set of scheduled tasks”. For more
details see Reference Guide @taskset/plot.m.
Commands changing parameters of tasksets are the same as for task
get returns the value of the
specified property or values of all properties. Command
set sets the value of the specified property. These
two commands has got a standard syntax, which is described in Matlab user
manual. Property access is allowed over the . (dot) operator too.
To obtain a list of all accessible properties use command
get. Note that some private and virtual properties
aren't accessible over the . (dot) operator, although they are displayed
when the automatic completion by Tab key is used.
Tasks parameters may be modified via virtual properties of object
taskset. The list of virtual properties are:
UserParam. All parameters are arrays data type. Items
order in the arrays is the same as tasks order in the set of the
The only way how to operate with schedule of tasks is through
add_schedule inserts a schedule (i.e. start time
sj, number of assigned
processor, ...) into taskset object. Its syntax is described in
Reference Guide @taskset/add_schedule.m. An example
add_schedule command use is shown in Figure 4.4, “Schedule inserting example”. Vector
is vector of start times (i.e. first task starts at 0), vector processor
is vector of assigned processors (i.e. first task is assigned to the
firs processor) and string description is a brief note on used
>> start = [0 0 2 3 6 6 7 9 11]; >> processor = [1 2 1 2 1 2 2 1 2]; >> description = 'a handmade schedule'; >> add_schedule(T2,description,start,T2.ProcTime,processor); >> >> get_schedule(T2) ans = 0 0 2 3 6 6 7 9 11 >> plot(T2);
Figure 4.4. Schedule inserting example
On the other hand, the schedule can be obtained from a taskset
get_schedule (e.g. as is shown in
Figure 4.4, “Schedule inserting example”). For more details about
this function see Reference Guide @taskset/get_schedule.m. Graphical schedule interpretation
(Gantt chart) can be obtained using function
Parameters of a given schedule (e.g. value of optimality criteria,
solving time, ...) can be obtained using function
schparam. It returns information about schedule
inside the taskset and its syntax is described in Reference Guide @taskset/schparam.m. An example of use is shown in Figure 4.5, “Schedule parameters”.
size(T) return number of tasks in the set of tasks
T. At this moment they return the same value.
Returned value will be different after implementing the general shop
problems into the toolbox. Now it is recommended to use command
T can be created by the command
randtaskset. Tasks parameters in the taskset are
generated with a uniform distribution. The syntax is described in
Reference Guide randtaskset.m. Example of its
application is shown in Figure 4.7, “Example of random taskset use”.
>> T = randtaskset(8,[8 15],[3 6]); >> T.ProcTime ans = 15 12 14 11 14 12 14 9 >> T.ReleaseTime ans = 4 4 5 3 4 5 5 4
Figure 4.7. Example of random taskset use
Random task can be created by command