MS-RCPSP
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
SchedulingProblem::Schedule Class Referenceabstract

Base abstract class for specimen (schedule) representations. More...

#include <Schedule.h>

Inheritance diagram for SchedulingProblem::Schedule:
Inheritance graph
[legend]
Collaboration diagram for SchedulingProblem::Schedule:
Collaboration graph
[legend]

Public Member Functions

void printState (bool short_output)
 
void writeToFile (FILE *stream)
 
int size ()
 
int fitness ()
 
int resource (int i) const
 
int max_res_count (int i) const
 
virtual void reset ()=0
 

Public Attributes

int * ires
 
int * start
 

Protected Member Functions

 Schedule (int *_ires)
 
int finish_time (int i) const
 
virtual int compute_fitness ()=0
 

Protected Attributes

int n
 
int _fitness = -1
 
Task ** tasks
 

Friends

class Validator
 

Detailed Description

Base abstract class for specimen (schedule) representations.

If you want to implement your own representation of schedule, you must create a subclass of Schedule and implement Schedule::compute_fitness function. Then you have to instantiate all Crossover and Mutator operators you're going to use for your new subclass. For instantiation example see src/UniformCrossover.cpp. Finally, you have to define equality operator, for clone removal to work.

Definition at line 22 of file Schedule.h.

Member Function Documentation

virtual int SchedulingProblem::Schedule::compute_fitness ( )
protectedpure virtual

Computes fitness and writes it to Schedule::_fitness cache variable.

Implemented in SchedulingProblem::PrioSchedule.

int SchedulingProblem::Schedule::finish_time ( int  i) const
inlineprotected

Returns finish time of the task at index i.

Parameters
iIndex of the task.

Definition at line 82 of file Schedule.h.

int SchedulingProblem::Schedule::fitness ( )

Calculates fitness function. Caches result in _fitness.

See also
Schedule::compute_fitness

Definition at line 11 of file Schedule.cpp.

int SchedulingProblem::Schedule::max_res_count ( int  i) const
inline

Returns number of resources capable of performing task at index i.

Parameters
iIndex of the task.

Definition at line 57 of file Schedule.h.

void SchedulingProblem::Schedule::printState ( bool  short_output)

Prints current state to stdout.

Definition at line 18 of file Schedule.cpp.

virtual void SchedulingProblem::Schedule::reset ( )
pure virtual

Reset schedule representation to random state.

Implemented in SchedulingProblem::PrioSchedule, and SchedulingProblem::SimpleSchedule.

int SchedulingProblem::Schedule::resource ( int  i) const
inline

Returns index of resource assigned to the task at index i.

Parameters
iIndex of the task.

Definition at line 51 of file Schedule.h.

int SchedulingProblem::Schedule::size ( )
inline

Returns number of tasks.

Definition at line 39 of file Schedule.h.

void SchedulingProblem::Schedule::writeToFile ( FILE *  stream)

Outputs solution to file stream in compatible format.

Definition at line 27 of file Schedule.cpp.

Member Data Documentation

int SchedulingProblem::Schedule::_fitness = -1
protected

Cached fitness value for this specimen.

See also
Schedule::fitness

Definition at line 73 of file Schedule.h.

int* SchedulingProblem::Schedule::ires

List of resources assigned to corresponding tasks.

Definition at line 33 of file Schedule.h.

int SchedulingProblem::Schedule::n
protected

Number of tasks.

Definition at line 67 of file Schedule.h.

int* SchedulingProblem::Schedule::start

List of task start times.

Definition at line 36 of file Schedule.h.

Task** SchedulingProblem::Schedule::tasks
protected

List of tasks to complete. Shortcut to Project::tasks.

Definition at line 76 of file Schedule.h.


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