KTask

class KTask : public KPtrArray<KTask>

Tasks (processing operations, activities) are represented by the class KTask. This object contains three variables :

  • a start variable representing the starting time of the task

  • an end variable representing the ending time of the task

  • a duration variable representing the duration of the task

These three structural variables are linked by Artelys-Kalis with the following constraint :

start + duration = end

The starting time variable represents two specific parameters of the task:

  • the Earliest Starting Time (EST represented by the start variable lower bound)

  • and its Latest Starting Time (LST represented by the start variable upper bound)

The end variable represents two specific parameters of the task:

  • the Earliest Completion Time (ECT represented by the end variable lower bound)

  • and its Latest Completion Time (LCT represented by the end variable upper bound)

The duration variable represents two specific parameters of the task:

  • the minimum task duration (Dmin represented by the duration variable lower bound)

  • the maximum task duration (Dmax represented by the duration variable upper bound)

../../_images/task.png

Since

2016.1

Public Functions

KTask()

Empty constructor

KTask(KSchedule &schedule)

Basic constructor

KTask(KSchedule &s, const char *name)

Primary constructor

Parameters
  • s – the schedule

  • name – string representing the name of the task

KTask(KSchedule &s, const char *name, int smin, int smax, int dmin, int dmax)

Constructor with min/max value for start time and duration

Parameters
  • s – the schedule

  • name – string representing the name of the task

  • smin – Minimum possible start of the task

  • smin – Maximum possible start of the task

  • dmin – Minimum possible duration of the task

  • dmax – Maximum possible duration of the task

KTask(KSchedule &s, const char *name, int duration)

Constructor with constant duration

Parameters
  • s – the schedule

  • name – string representing the name of the task

  • duration – fixed duration of the task

KTask(KSchedule &s, const char *name, int duration, KResource &r)

Constructor with fixed duration and unary resource usage

Parameters
  • s – the schedule

  • name – string representing the name of the task

  • duration – fixed task duration

  • r – the resource required by the task

KTask(KSchedule &s, const char *name, KResource &r, int consumption)
Parameters
  • s – the schedule

  • name – string representing the name of the task

KTask(const KTask &toCopy)

Copy constructor

virtual ~KTask()

Destructor

KSchedule *getSchedule() const

Pretty printing of the task to stdout

virtual void print() const

Pretty printing the task.

virtual void print(void *ctx, PrintFunctionPtr *pfp) const

Pretty printing of the task with a PrintFunctionPtr

void setSetupTime(KTask &task, int before, int after)

Set the sequence dependent setup time between the current task,and the one passed in parameters to before/after

int getSetupTime(KTask &task)

Return the setup time between the current task and the one passed in parameter

void requires (KResourceUsage &resusage)

Add a resource usage requirement for this task.

void provides(KResourceUsage &resusage)

Add a resource usage provision for this task.

void consumes(KResourceUsage &resusage)

Add a resource usage consumption for this task.

void produces(KResourceUsage &resusage)

Add a resource usage production for this task.

void requires (KResourceUsageArray &resusagearray, int min=1, int max=1)

Add optional resources usages requirements for this task and ensure that between [min..max] of theses requirements are satisfied

void provides(KResourceUsageArray &resusagearray, int min = 1, int max = 1)

Add optional resources usages provisions for this task and ensure that between [min..max] of theses requirements are satisfied

void consumes(KResourceUsageArray &resusagearray, int min = 1, int max = 1)

Add optional resources usages consumptions for this task and ensure that between [min..max] of theses requirements are satisfied

void produces(KResourceUsageArray &resusagearray, int min = 1, int max = 1)

Add optional resources usages productions for this task and ensure that between [min..max] of theses requirements are satisfied

int getMinimalRequirement(KResource *resource, int tslot)

Return the minimal resource requirement for this task and the resource in parameters at time step tslot

int getMinimalConsumption(KResource *resource, int tslot)

Return the minimal resource consumption for this task and the resource in parameters at time step tslot

int getMaximalProvision(KResource *resource, int tslot)

Return the maximal resource provision for this task and the resource in parameters at time step tslot

int getMaximalProduction(KResource *resource, int tslot)

Return the maximal resource production for this task and the resource in parameters at time step tslot

void requires (KResource &resource, int requirement)

State that this ressource requires ( renewable ) requirement unit of resource resource

Parameters
  • resource – the resource

  • requirement – the resource requirement

void consumes(KResource &resource, int consumption)

State that this ressource consumes ( non-renewable ) consumption unit of resource resource

Parameters
  • resource – the involved resource

  • consumption – the resource consumption

void provides(KResource &resource, int provision)

State that this ressource provides ( renewable ) provision unit of resource resource

Parameters
  • resource – the resource

  • provision – the resource provision

void produces(KResource &resource, int production)

State that this ressource produces ( non-renewable ) production unit of resource resource

Parameters
  • resource – the resource

  • production – the resource production

void requires (KResource &resource, int requirementmin, int requirementmax)

State that this ressource requires ( renewable ) between requirementmin and ‘requirementmax unit of resource resource

Parameters
  • resource – the resource

  • requirementmin – the minimal resource requirement

  • requirementmax – the maximal resource requirement

void consumes(KResource &resource, int consumptionmin, int consumptionmax)

State that this ressource consumes ( non-renewable ) between consumptionmin and consumptionmax unit of resource resource

Parameters
  • resource – the resource

  • consumptionmin – the minimal resource consumption

  • consumptionmax – the maximal resource consumption

void provides(KResource &resource, int provisionmin, int provisionmax)

State that this ressource provides ( renewable ) between provisionmin and ‘provisionmax unit of resource resource

Parameters
  • resource – the resource

  • provisionmin – the minimal resource provision

  • provisionmax – the maximal resource provision

void produces(KResource &resource, int productionmin, int productionmax)

State that this ressource produces ( non-renewable ) between productionmin and productionmax unit of resource resource

Parameters
  • resource – the resource

  • productionmin – the minimal resource production

  • productionmax – the maximal resource production

int requires (KResource &resource)

State that this ressource requires ( renewable ) one unit of resource resource

int consumes(KResource &resource)

State that this ressource consumes ( non-renewable ) one unit of resource resource

int provides(KResource &resource)

State that this ressource provides ( renewable ) one unit of resource resource

int produces(KResource &resource)

State that this ressource produces ( non-renewable ) one unit of resource resource

void startsAfter(KTask &task, int delay = 0)

State that this task starts delay time unit after the completion of the given task

Parameters
  • task – the task before the current task

  • delay – the time distance between the two tasks

void endsBefore(KTask &task, int delay = 0)

State that this task ends delay time unit before the completion of the given task

Parameters
  • task – the task before the current task

  • delay – the time distance between the two tasks

void postEndToEndMaxC(KTask &task, int Max = 0)

State that the distance between the completion of this task and the completion of task task cannot exceed Max time units

Parameters
  • task – the task

  • Max – the distance between the completion of this task and the completion of task task

void postEndToStartMaxC(KTask &task, int Max = 0)

State that the distance between the completion of this task and the start of task task cannot exceed Max time units

Parameters
  • task – the task

  • Max – the distance between the completion of this task and the start of task task

void postStartToStartMinC(KTask &task, int Min = 0)

State that the distance between the start of this task and the start of task task must exceed Min time units

Parameters
  • task – the task

  • Min – the distance between the start of this task and the start of task task

void postEndToStartMinC(KTask &task, int Min = 0)

State that the distance between the completion of this task and the start of task task must exceed Min time units

Parameters
  • task – the task

  • Min – the distance between the completion of this task and the start of task task

int getIndex()

Return the id of this task.

const char *getName() const

Return the name of this task.

void setName(const char *name)

Set the name of this task.

KIntVar *getStartDateVar()

Return a pointer to the KIntVar representing the starting date of this task

KIntVar *getEndDateVar()

Return a pointer to the KIntVar representing the ending date of this task

KIntVar *getDurationVar()

Return a pointer to the KIntVar representing the duration of this task

KIntVar *getRequiresVar(KResource *r)

Return a pointer to the KIntVar representing the resource requirement of this task for resource r if any or nullptr

KIntVar *getConsumesVar(KResource *r)

Return a pointer to the KIntVar representing the resource consumtion of this task for resource r if any or nullptr

KIntVar *getProvidesVar(KResource *r)

Return a pointer to the KIntVar representing the resource provision of this task for resource r if any or nullptr

KIntVar *getProducesVar(KResource *r)

Return a pointer to the KIntVar representing the resource production of this task for resource r if any or nullptr

KIntVar *getSizeVar(KResource *r)

Return a pointer to the KIntVar representing the product requirement * duration

KIntVar *getAssignmentVar(KResource *r)

Return a pointer to the KIntVar representing the resource requirement of this task for resource r if any or nullptr

int getDurationValue()

Return the constant duration of this task or the lowerbound if duration is not constant

int getEarliestStartTime()

Return the earliest starting time of this task.

int getLatestStartTime()

Return the latest starting time of this task.

int getEarliestCompletionTime()

Return the earliest completion time of this task.

int getLatestCompletionTime()

Return the latest completion time of this task.

int getMinimumDuration()

Return the minimum duration of this task.

int getMaximumDuration()

Return the maximum duration of this task.

void setEarliestStartTime(int time)

Set the earliest starting time of this task.

void setLatestStartTime(int time)

Set the latest starting time of this task.

void setEarliestCompletionTime(int time)

Set the earliest completion time of this task.

void setLatestCompletionTime(int time)

Set the latest completion time of this task.

void setMinimumDuration(int durationmin)

Set the minimum duration of this task.

void setMaximumDuration(int durationmax)

Set the maximum duration of this task.

void setStartTime(int startTime)

Set the starting time of this task to startTime

void setEndTime(int endTime)

Set the ending time of this task to endTime

void setDuration(int duration)

Set the duration of this task to duration

bool isFixed()

Return true IFF this task is fixed (Start,End,Duration, and resource utilizations variables are instantiated)