TCPSPSuite
Public Types | Public Member Functions | List of all members
Job Class Reference

A job of an TCPSP instance. More...

#include <job.hpp>

Public Types

using JobId = unsigned int
 

Public Member Functions

 Job (unsigned int release, unsigned int deadline, unsigned int duration, ResVec usages, unsigned int id)
 
 Job (unsigned int release, unsigned int deadline, const Job &other)
 
unsigned int get_duration () const
 
unsigned int get_release () const
 
unsigned int get_deadline () const
 
Maybe< unsigned int > get_hint () const
 
double get_resource_usage (unsigned int rid) const
 
const ResVec & get_resource_usage () const
 
unsigned int get_jid () const
 
void set_id (unsigned int id)
 
void set_hint (Maybe< unsigned int > hint)
 
bool operator== (const Job &other) const
 
Job clone () const
 

Detailed Description

A job of an TCPSP instance.

A job of a TCPSP instance. Each job is associated with a set of attributes:

Constructor & Destructor Documentation

◆ Job() [1/2]

Job::Job ( unsigned int  release,
unsigned int  deadline,
unsigned int  duration,
ResVec  usages,
unsigned int  id 
)

Constructs a job from its release time, deadline, duration, usages and its ID.

Parameters
releaseThe release time of the job to be created
deadlineThe deadline of the job to be created
durationThe duration of the job to be created
usagesA vector of usage specifications. usages[i] specifies how much of resource with ID i this job requires.
idThe ID of the job to be created.

◆ Job() [2/2]

Job::Job ( unsigned int  release,
unsigned int  deadline,
const Job other 
)

Creates a job as a copy of another job (with the same ID!), allowing to modify release and deadline.

Warning: Never add this job to the same instance as the <other> job. Both jobs have the same ID, and two jobs with the same ID within the same instance produces undefined behavior.

Parameters
releaseThe release time of the new job
deadlineThe deadline of the new job
otherThe original job from which all other values are taken.

Member Function Documentation

◆ clone()

Job Job::clone ( ) const

Performs a deep copy of this job.

Returns
A cloned version of this job.

◆ get_deadline()

unsigned int Job::get_deadline ( ) const

Returns the deadline of the job.

Returns
The deadline of the job.

◆ get_duration()

unsigned int Job::get_duration ( ) const

Returns the duration of the job.

Returns
The duration of the job.

◆ get_hint()

Maybe< unsigned int > Job::get_hint ( ) const

Returns the start-time hint, if set

Returns
The start-time hint

◆ get_jid()

unsigned int Job::get_jid ( ) const

Returns the ID of the job.

Returns
The ID of the job.

◆ get_release()

unsigned int Job::get_release ( ) const

Returns the release of the job.

Returns
The release of the job.

◆ get_resource_usage() [1/2]

const ResVec & Job::get_resource_usage ( ) const

Returns how much of all resources this Job uses.

Returns
the amount of resource used for each resource

◆ get_resource_usage() [2/2]

double Job::get_resource_usage ( unsigned int  rid) const

Returns how much of a certain resource this job uses.

Parameters
ridThe ID of the resource one is interested about
Returns
The amount of resource with ID <rid> that this job uses

◆ set_hint()

void Job::set_hint ( Maybe< unsigned int >  hint)

Sets the start-time hint of the job. This hint may be used by solvers to speed up solving.

Parameters
hintThe hint to be used, or Maybe<unsigned int>{} for no hint.

◆ set_id()

void Job::set_id ( unsigned int  id)

Sets the ID of the job.

Warning: Changing the ID of the job after the lag graph has been initialized breaks the instance. Only use this if you know what you are doing.

Parameters
idThe new ID of this job.

The documentation for this class was generated from the following files: