TCPSPSuite
Public Member Functions | List of all members
Instance Class Reference

a TCPSP instance More...

#include <instance.hpp>

Public Member Functions

void swap (Instance &other)
 
Instanceoperator= (Instance other)
 
 Instance (const Instance &other)
 
 Instance (Instance &&other)
 
 Instance ()
 
 Instance (const std::string instance_id, Traits wanted_traits)
 
 Instance (const Instance &origin, std::vector< bool > &&job_is_substituted, std::vector< Job > &&substitutions)
 
LagGraph & get_laggraph ()
 
const LagGraph & get_laggraph () const
 
unsigned int add_job (Job &&job)
 
unsigned int add_resource (Resource &&resource)
 
unsigned int job_count () const
 
const Jobget_job (unsigned int i) const
 
const JobContainer & get_jobs () const
 
unsigned int resource_count () const
 
const Resource & get_resource (unsigned int i) const
 
const Traits & get_traits () const
 
void compute_traits ()
 
const std::string & get_id () const
 
Instance clone () const
 
bool check_feasibility () const
 
void set_window_extension (unsigned int window_extension_limit, unsigned int window_extension_job_limit)
 Setter for the window extension parameters. More...
 
void set_window_extension_hard_deadline (Maybe< unsigned int > deadline)
 
unsigned int get_window_extension_limit () const
 
unsigned int get_window_extension_job_limit () const
 
Maybe< unsigned int > get_window_extension_hard_deadline () const
 
double calculate_max_costs (const std::vector< unsigned int > &start_times) const
 
double calculate_costs (const ResVec &ressource_usage, const ResVec &additional_usage) const
 
double calculate_costs (const ResVec &ressource_usage) const
 
unsigned int get_latest_deadline () const
 Helper to return the latest deadline in the instance. More...
 

Detailed Description

a TCPSP instance

A TCPSP instance consists of the folowing data:

Constructor & Destructor Documentation

◆ Instance() [1/3]

Instance::Instance ( )

Default constructor creates an empty instance without an id

◆ Instance() [2/3]

Instance::Instance ( const std::string  instance_id,
Traits  wanted_traits 
)

Constructs a new instance with a name and sets the instance should have

Parameters
instance_idthe id of this instance
wanted_traitsthe traits this should have

◆ Instance() [3/3]

Instance::Instance ( const Instance origin,
std::vector< bool > &&  job_is_substituted,
std::vector< Job > &&  substitutions 
)

Constructs a new instance based on another instance

Parameters
originthe instance this should be based on
job_is_substituteda vector-of-bool stating for every job if it is substituted or not
substitutionsthe substitutions

Member Function Documentation

◆ add_job()

unsigned int Instance::add_job ( Job &&  job)

adds a job to this instance

Parameters
jobthat should be added
Returns
the index of the job

◆ add_resource()

unsigned int Instance::add_resource ( Resource &&  resource)

adds a resource to this instance

Parameters
resourcethat should be added
Returns
the index of the resource

◆ calculate_costs() [1/2]

double Instance::calculate_costs ( const ResVec &  ressource_usage) const

calculates the cost of a given resource usage

Warning This metho currently uses flat resources!!! TODO change this!

Parameters
ressource_usagethe base usage of all resources
Returns
the overall costs

◆ calculate_costs() [2/2]

double Instance::calculate_costs ( const ResVec &  ressource_usage,
const ResVec &  additional_usage 
) const

calculates the cost of a given resource usage

Warning This metho currently uses flat resources!!! TODO change this!

Parameters
ressource_usagethe base usage of all resources
additional_usagethe additional usage of all resources

TODO what the hell? What is this function for?

Returns
the overall costs

◆ calculate_max_costs()

double Instance::calculate_max_costs ( const std::vector< unsigned int > &  start_times) const

calculates the cost of a given solution in form of a vector of start times (it is NOT validated if the solution is correct!)

Warning This metho currently uses flat resources!!! TODO change this!

Parameters
start_timesthe start times for each job
Returns
the total costs of this solution

◆ check_feasibility()

bool Instance::check_feasibility ( ) const

checks if the created instance is feasible if CRASH_ON_CHECK this will throw an assertion error instead of returning!

Returns
true if it possible to schedule all jobs

◆ clone()

Instance Instance::clone ( ) const

Returns a deep copy of this instance

Returns
a deep copy of this instance

◆ compute_traits()

void Instance::compute_traits ( )

computes the traits this instance actually fulfills Warning this throws an assertion error if the wanted traits are not fulfilled!

◆ get_id()

const std::string & Instance::get_id ( ) const

Returns the id of this instance

Returns
the id of this instance

◆ get_job()

const Job & Instance::get_job ( unsigned int  i) const

Returns the job with the given index

Returns
the job with the given index

◆ get_jobs()

const Instance::JobContainer & Instance::get_jobs ( ) const

Returns a container with all jobs of this instance

Returns
a container with all jobs of this instance

◆ get_laggraph() [1/2]

const LagGraph & Instance::get_laggraph ( )

Returns the lag graph

Returns
the lag graph

◆ get_laggraph() [2/2]

const LagGraph& Instance::get_laggraph ( ) const

Returns the lag graph

Returns
the lag graph

◆ get_latest_deadline()

unsigned int Instance::get_latest_deadline ( ) const

Helper to return the latest deadline in the instance.

Returns
The latest deadline in the instance

◆ get_resource()

const Resource & Instance::get_resource ( unsigned int  i) const

Returns the resource with the given index

Returns
the resource with the given index

◆ get_traits()

const Traits & Instance::get_traits ( ) const

Returns all traits this instance fulfills (not only wanted ones)

Returns
all traits this instance fulfills (not only wanted ones)

◆ job_count()

unsigned int Instance::job_count ( ) const

Returns the number of jobs this instance has

Returns
the number of jobs this instance has

◆ resource_count()

unsigned int Instance::resource_count ( ) const

Returns the number of resourcec this instance has

Returns
the number of resourcec this instance has

◆ set_window_extension()

void Instance::set_window_extension ( unsigned int  window_extension_limit,
unsigned int  window_extension_job_limit 
)

Setter for the window extension parameters.

Parameters
window_extension_limitThe total number of time steps that windows may be extended
window_extension_job_limitThe maximum number of jobs that may have their windows extended

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