IBM ILOG Scheduler User's Manual > Advanced Concepts > Advanced Features and Concepts > Transition Types, Transition Times, and Timetables > Basic Functions

First we look at basic functions for expressing transition times on typed activities.

Defining Activity Types

To specify the type of an activity, the following function is provided:

void IloActivity::setTransitionType(IloInt type);

where type must be a non-negative integer. By default the type of an activity is equal to zero.

We recommend using as few types as possible. If the number of different types is N, define the types between 0 and N-1.

Defining Transition Times

To define transition times between typed activities, define a square matrix of all transition times between types. The class IloTransitionParam has been designed for building such a matrix.

For instance, we can use the following code to define transition times between the types 0, 1 and 2.

IloTransitionParam table(env, 3);

The digit 3 represents the number of types and in consequence the types of activities must be between 0 and 2.

By default, transition times are assumed to be asymmetric; that is, the transition time between activities A1 and A2 depends on which activity, A1 or A2, is first.

To create a symmetric table, an extra argument set to IloTrue must be passed to the constructor of IloTransitionParam, as follows.

IloTransitionParam table(env, 3, IloTrue);

To specify the transition times between two types, the function setValue is provided.

void IloTransitionParam::setValue(IloInt typeA,
                                  IloInt typeB,
                                  IloInt transTime);

Once an instance of IloTransitionParam has been defined, define an instance of IloTransitionTime by passing the IloTransitionParam and a resource (discrete, unary, discrete energy, or state resource) to the constructor. An instance of IloTransitionTime can be created, for example, from a function defining the time to be the sum of the processing time of the two activities A1 and A2 divided by 2.

The following code applies the IloTransitionParam instance table to the IloUnaryResource instance worker.

IloUnaryResource worker(env);
IloTransitionTime tTime(worker, table);