MTCT
Design Automation and Optimization for ETCS Railway Networks
Loading...
Searching...
No Matches
cda_rail::instances::GeneralProblemInstance Class Referenceabstract

Base of every problem instance. More...

#include <GeneralProblemInstance.hpp>

Inheritance diagram for cda_rail::instances::GeneralProblemInstance:
cda_rail::instances::GeneralProblemInstanceWithScheduleAndRoutes cda_rail::instances::GeneralPerformanceOptimizationInstance

Classes

struct  FeasibilityCheck
 The outcome of is_obviously_infeasible, with its reason. More...

Public Member Functions

virtual void export_instance (const std::filesystem::path &working_directory) const =0
 Exports the instance to the specified working directory.
virtual void export_instance (const std::string &working_directory) const
 Exports the instance to the specified working directory.
virtual void export_instance (char const *const workingDirectory) const
 Exports the instance to the specified working directory.
virtual bool check_consistency () const =0
 Checks whether the instance is internally consistent.
virtual ~GeneralProblemInstance ()=default
 Virtual destructor.
 GeneralProblemInstance (const GeneralProblemInstance &)=default
 Copy constructor.
GeneralProblemInstance & operator= (const GeneralProblemInstance &)=default
 Copy assignment operator.
 GeneralProblemInstance (GeneralProblemInstance &&) noexcept=default
 Move constructor.
GeneralProblemInstance & operator= (GeneralProblemInstance &&) noexcept=default
 Move assignment operator.
const std::string & get_instance_name () const
 Gets the instance name.
const std::string & get_instance_subdirectory () const
 Provides the instance subdirectory.
void set_instance_name (std::string_view const instanceName)
 Sets the instance name.
void set_instance_subdirectory (std::string_view const instanceSubdirectory)
 Sets the instance subdirectory.
virtual FeasibilityCheck is_obviously_infeasible (bool late_entry_allowed) const =0
 Checks the instance for reasons that make it infeasible by itself.

Protected Member Functions

 GeneralProblemInstance ()=default
 Initializes the instance with empty name and subdirectory.
 GeneralProblemInstance (std::string_view const instanceName, std::string_view const instanceSubdirectory)
 Initializes the instance with a name and subdirectory.

Detailed Description

Base of every problem instance.

An instance knows where it is stored, namely under <working directory>/instances/<subdirectory>/<name>, and how to export itself there. Everything it consists of is added by the derived classes.

Constructor & Destructor Documentation

◆ GeneralProblemInstance() [1/4]

cda_rail::instances::GeneralProblemInstance::GeneralProblemInstance ( )
protecteddefault

Initializes the instance with empty name and subdirectory.

◆ GeneralProblemInstance() [2/4]

cda_rail::instances::GeneralProblemInstance::GeneralProblemInstance ( std::string_view const instanceName,
std::string_view const instanceSubdirectory )
inlineprotected

Initializes the instance with a name and subdirectory.

Parameters
instanceNameThe name of the instance; must be a valid folder name.
instanceSubdirectoryThe subdirectory path; must be a valid folder name.
Exceptions
Ifeither parameter is not a valid folder name.

◆ ~GeneralProblemInstance()

virtual cda_rail::instances::GeneralProblemInstance::~GeneralProblemInstance ( )
virtualdefault

Virtual destructor.

◆ GeneralProblemInstance() [3/4]

cda_rail::instances::GeneralProblemInstance::GeneralProblemInstance ( const GeneralProblemInstance & )
default

Copy constructor.

◆ GeneralProblemInstance() [4/4]

cda_rail::instances::GeneralProblemInstance::GeneralProblemInstance ( GeneralProblemInstance && )
defaultnoexcept

Move constructor.

Member Function Documentation

◆ check_consistency()

virtual bool cda_rail::instances::GeneralProblemInstance::check_consistency ( ) const
nodiscardpure virtual

Checks whether the instance is internally consistent.

Returns
true if the instance is consistent, otherwise false.

Implemented in cda_rail::instances::GeneralPerformanceOptimizationInstance, and cda_rail::instances::GeneralProblemInstanceWithScheduleAndRoutes.

◆ export_instance() [1/3]

virtual void cda_rail::instances::GeneralProblemInstance::export_instance ( char const *const workingDirectory) const
inlinevirtual

Exports the instance to the specified working directory.

Parameters
workingDirectoryPath where the instance will be exported.

Reimplemented in cda_rail::instances::GeneralProblemInstanceWithScheduleAndRoutes.

◆ export_instance() [2/3]

virtual void cda_rail::instances::GeneralProblemInstance::export_instance ( const std::filesystem::path & working_directory) const
pure virtual

Exports the instance to the specified working directory.

Parameters
working_directoryBase export directory.

Implemented in cda_rail::instances::GeneralPerformanceOptimizationInstance, and cda_rail::instances::GeneralProblemInstanceWithScheduleAndRoutes.

◆ export_instance() [3/3]

virtual void cda_rail::instances::GeneralProblemInstance::export_instance ( const std::string & working_directory) const
inlinevirtual

Exports the instance to the specified working directory.

Parameters
working_directoryPath to the directory where the instance is exported.

Reimplemented in cda_rail::instances::GeneralProblemInstanceWithScheduleAndRoutes.

◆ get_instance_name()

const std::string & cda_rail::instances::GeneralProblemInstance::get_instance_name ( ) const
inlinenodiscard

Gets the instance name.

Returns
const std::string& The instance name.

◆ get_instance_subdirectory()

const std::string & cda_rail::instances::GeneralProblemInstance::get_instance_subdirectory ( ) const
inlinenodiscard

Provides the instance subdirectory.

Returns
Const reference to the instance subdirectory string.

◆ is_obviously_infeasible()

virtual FeasibilityCheck cda_rail::instances::GeneralProblemInstance::is_obviously_infeasible ( bool late_entry_allowed) const
nodiscardpure virtual

Checks the instance for reasons that make it infeasible by itself.

Only necessary conditions are checked, e.g. whether every train can reach its stations and its exit vertex at all. An instance that passes this check may still turn out to be infeasible once the trains are considered together, which no check can tell without solving the instance.

Parameters
late_entry_allowedWhether trains may enter later than scheduled. If they may not, the scheduled entry times themselves can be checked against each other as well.

Implemented in cda_rail::instances::GeneralProblemInstanceWithScheduleAndRoutes.

◆ operator=() [1/2]

GeneralProblemInstance & cda_rail::instances::GeneralProblemInstance::operator= ( const GeneralProblemInstance & )
default

Copy assignment operator.

◆ operator=() [2/2]

GeneralProblemInstance & cda_rail::instances::GeneralProblemInstance::operator= ( GeneralProblemInstance && )
defaultnoexcept

Move assignment operator.

◆ set_instance_name()

void cda_rail::instances::GeneralProblemInstance::set_instance_name ( std::string_view const instanceName)
inline

Sets the instance name.

Parameters
instanceNameThe new instance name; must be a valid folder name.
Exceptions
Ifthe instance name is not a valid folder name.

◆ set_instance_subdirectory()

void cda_rail::instances::GeneralProblemInstance::set_instance_subdirectory ( std::string_view const instanceSubdirectory)
inline

Sets the instance subdirectory.

Parameters
instanceSubdirectoryThe new subdirectory name.
Exceptions
std::invalid_argumentIf the subdirectory is not a valid folder name.

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