Initializing help system before first use

# Scheduling

Topics covered in this chapter:

- Tasks
- Resources
- Schedule

Scheduling plays an important role in manufacturing and engineering where it can have a major impact on the productivity of a process. The goal of scheduling is to optimize the production process by telling which operation to do, when, with which staff, and using which equipment.

Let's take the example of constructing a house. This task can be broken down into a set of smaller tasks:

- Grading and preparation of the site
- Foundations
- Framing
- Installation of windows and doors
- Roofing
- Siding
- Electricity
- Plumbing
- Underlayment
- Painting
- etc...

All these tasks must be carried out in a certain order: for example, laying the foundations cannot be done before the excavation and grading of the site. Moreover, certain tasks require specific resources (you need a plumber to do plumbing, a concrete mixer to do the carpentry etc.).

Tasks and resources are represented in kalis by the special purpose types cpresource and cptask.

## Tasks

A cptask is represented by three decision variables of type cpvar:

- start representing the starting time of the task
- end representing the ending time of the task
- duration representing the duration of the task

These three structural variables are linked by Xpress Kalis with the following constraint: start + duration = end.

- The starting time variable represents two specific parameters of the task:
  - the Earliest Start Time (EST, represented by the lower bound of the 'start' variable) and its Latest Start Time (LST, represented by the upper bound of the 'start' variable).
- The end variable represents two specific parameters of the task:
  - the Earliest Completion Time (ECT, represented by the lower bound of the 'end' variable) and its Latest Completion Time (LCT, represented by the upper bound of the 'end' variable).
- The duration variable represents two specific parameters of the task:
  - the minimum task duration (Dmin, represented by the lower bound of the 'duration' variable) and the maximum task duration (Dmax, represented by the upper bound of the 'duration' variable).

The picture below illustrates this:

In the case of tasks using resources, another variable is instantiated : the resource assignment binary variable. It is defined for a couple (task, resource) and takes the value 1 if the task uses the specific resource, otherwise it has value 0.

Task attributes can be assigned or retrieved with the following methods:

- getstart
- getend
- getduration
- setduration
- has_assignment
- getassignment
- get_earliest_start_possible
- getname
- setname
- is_fixed
- addpredecessors
- setpredecessors
- addsuccessors
- setsuccessors
- setsetuptime

## Resources

A resource can be of two different types:

- Disjunctive when the resource can process only one task at a time (KALIS_UNARY_RESOURCE).
- Cumulative when the resource can process several tasks at the same time (KALIS_DISCRETE_RESOURCE).

Traditional examples of disjunctive resources are Jobshop scheduling problems. Cumulative resources are used for the Resource-Constrained Project Scheduling Problem (RCPSP)

Note that a disjunctive resource is semantically equivalent to a cumulative resource with maximal capacity one and unit resource usage for each task using this resource but this equivalence does not hold in terms of constraint propagation.

When defining a resource with Xpress Kalis its initial capacity is specified. For a disjunctive resource the capacity value is always equal to one. The structural capacity of a resource does not vary over time but a maximal temporal capacity can be imposed at any point of time with the procedure setcapacity.

The following graphic shows an example with three tasks A, B and C executing on a disjunctive resource and on a cumulative resource with resource usage 3 for task A, 1 for task B, and 1 for task C.

Tasks require, provide, consume and produce resources:

- A task requires a resource if some amount of the resource capacity must be made available for the execution of the activity. The capacity is renewable, this means the required capacity becomes available again after the end of the task.
- A task provides a resource if some amount of the resource capacity is made available through the execution of the task. The capacity is renewable, that is, the provided capacity is available only during the execution of the task.
- A task consumes a resource if some amount of the resource capacity must be made available for the execution of the task and the capacity is non-renewable, that is, the consumed capacity is no longer available at the end of the task.
- A task produces a resource if some amount of the resource capacity is made available through the execution of the task and the capacity is non-renewable, that is, the produced capacity is definitively available after the start of the task.

Task productions, requirements, provisions and productions can be accessed with the following methods:

- consumes
- requires
- provides
- produces
- getconsumption
- getrequirement
- getprovision
- getproduction
- is_consuming
- is_requiring
- is_providing
- is_producing

Resources and tasks are declared by using the standard Mosel syntax. For instance, the following code extract shows how to create a task my_cptask, a static array of resources cpresource_array, and a dynamic array of cptask dyn_cptask_array:

    declarations
       my_cptask       : cptask
       cpresource_array: array(1..10) of cpresource
       dyn_cptask_array: array(range) of cptask
    end-declarations

Note that entries of dynamic arrays of tasks or resources (arrays declared as dynamic at their creation or arrays for which some or all of the index sets are not known at the declaration like dyn_cptask_array in the example above) must be created explicitly using the Mosel procedure create:

    declarations
       dyn_cptask_array: array(range) of cptask
    end-declarations
    forall(i in 3..30) create (dyn_cptask_array(i))

After its declaration, the second step in the creation of a task or resource consists of defining somes attributes with the procedures set_task_attributes and set_resource_attributes.

## Schedule

Tasks and resources form a schedule. The cp_schedule method allows to optimize a schedule with respect to any objective variable and implements advanced scheduling techniques specialized in makespan minimization. The creation of the schedule makespan can be automated by calling the getmakespan method that ensures automatically its computation.

A custom scheduling optimization strategy can be specified by using the task_serialize branching scheme to select the task to be scheduled and value choice heuristics for its start and duration variables.

The task selection method can be any user Mosel method or it may be configured with the predefined strategies of Xpress Kalis:

- KALIS_SMALLEST_ECT
- KALIS_SMALLEST_EST
- KALIS_SMALLEST_LCT
- KALIS_SMALLEST_LST
- KALIS_LARGEST_ECT
- KALIS_LARGEST_EST
- KALIS_LARGEST_LCT
- KALIS_LARGEST_LST

The picture below illustrates the definition of a task-based branching strategy:

kalis defines a set of functions for accessing and modifying cptask and cpresource states:

addpredecessors | Adds a set of predecessors for a task
addsuccessors | Adds a set of tasks as successors of a task
consumes | Sets the minimal and maximal amount of resource consumed by a task for a particular resource
cp_close_schedule | Close the schedule.
cp_get_default_schedule_strategy | Gets the default schedule search strategy of cp_schedule
cp_schedule | Optimizes the schedule with respect to an objective variable.
cp_set_schedule_strategy | Sets the schedule search strategy for cp_schedule
cp_show_schedule | Shows a textual representation of the current schedule
get_earliest_start_possible | Gets the earliest time at which the task can start on the given resource.
getassignment | Gets the cpvar representing the assignment of a task for a particular resource.
getcapacity | Get the maximal capacity of a resource for a specific time period.
getconsumption | Gets the cpvar representing the consumption of a task for a particular resource
getduration | Gets the cpvar representing a task duration
getend | Gets the cpvar representing a task completion time
getmakespan | Gets the cpvar representing the makespan of the schedule.
getproduction | Gets the cpvar representing the production of a task for a particular resource
getprovision | Gets the cpvar representing the provision of a task for a particular resource
getrequirement | Gets the cpvar representing the requirement of a task for a particular resource
getsetuptime | Gets the sequence dependent setup times between two tasks
getstart | Gets the cpvar representing a task start time
has_assignment | Tests whether an assignment decision variable for a task and a particular resource exists.
is_consuming | Tests whether a task consumes a specific resource
is_fixed | Tests if a task is fixed
is_idletime | Tests if a timestep is an idle timestep for a resource.
is_producing | Tests whether a task produces a specific resource
is_providing | Tests whether a task provides a specific resource
is_requiring | Tests whether a task requires a specific resource
produces | Sets the minimal and maximal amount of resource produced by a task for a particular resource
provides | Sets the minimal and maximal amount of resource provided by a task for a particular resource.
requires | Sets the minimal and maximal amount of resource required by a task for a particular resource
resusage | Creates a resource usage
set_resource_attributes | Sets some attributes for a resource
set_task_attributes | Sets some attributes for a task
setcapacity | Sets the maximal capacity of a resource between two time bounds.
setduration | Sets the duration of a task
setidletimes | Specifies the set of timesteps where a resource is idle.
setmaxavailability | Sets the maximal capacity of a resource between two time bounds.
setminusage | Sets the minimum usage of a resource between two time bounds.
setpredecessors | Sets the tasks that must precede a task
setsetuptime | Sets sequence dependent setup times between two tasks
setsuccessors | Sets the set of tasks that must succeed a task

Parent Topic Paradigm

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.