Camargue
Public Member Functions | Public Attributes | List of all members
CMR::Segment Struct Reference

Simple utility struct for storing an interval of nodes. More...

#include <util.hpp>

Inheritance diagram for CMR::Segment:
Inheritance graph
[legend]

Public Member Functions

 Segment ()=default
 Default construct a Segment. More...
 
 Segment (int lo, int hi)
 Construct a Segment with specified start and end point. More...
 
int size () const
 Size of the Segment. More...
 
bool contains (int vx) const
 Does the Segment contain a certain vertex. More...
 
bool subset_of (const Segment &seg) const
 Is one Segment a subset of the other. More...
 
bool operator> (const Segment &rhs) const
 Compare segments by size and then start point. More...
 
bool operator== (const Segment &rhs) const
 Equality operator. More...
 

Public Attributes

int start
 The start index of the Segment. More...
 
int end
 The end index of the Segment. More...
 

Detailed Description

Simple utility struct for storing an interval of nodes.

A Segment is defined in terms of some list of nodes, usually a tsp tour. If tour is the nodelist, then a Segment S defined relative to tour represents the nodes tour[S.start], ..., tour[S.end]. Thus a Segment is meaningless without a tour from which to be dereferenced.

Remarks
Representation of nodes as a segment of a tour is a common theme in tsp computation, and for primal cutting plane tsp computation in particular. This class is open for inheritance to define subtour cuts associated to segments, bodies of simple teeth, and simple teeth themselves where the notion of size and containment is identical.

Constructor & Destructor Documentation

CMR::Segment::Segment ( )
default

Default construct a Segment.

CMR::Segment::Segment ( int  lo,
int  hi 
)
inline

Construct a Segment with specified start and end point.

Member Function Documentation

bool CMR::Segment::contains ( int  vx) const
inline

Does the Segment contain a certain vertex.

Returns true iff vx lies in the interval specified by the Segment.

bool CMR::Segment::operator== ( const Segment rhs) const
inline

Equality operator.

bool CMR::Segment::operator> ( const Segment rhs) const
inline

Compare segments by size and then start point.

int CMR::Segment::size ( ) const
inline

Size of the Segment.

This is the number of the nodes in the closed interval from start to end.

bool CMR::Segment::subset_of ( const Segment seg) const
inline

Is one Segment a subset of the other.

Returns true iff the interval defined by this Segment is a subset of that defined by seg.

Member Data Documentation

int CMR::Segment::end

The end index of the Segment.

int CMR::Segment::start

The start index of the Segment.


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