GClasses
GClasses::GAssignment Class Referenceabstract

Detailed Description

An abstract base class defining an assignment between two sets.

An assignment is a mapping M between two sets A and B. If a and b are elements of A and B respectively, then the following properties hold:

  • M(a) is a single element of B or is undefined
  • M(b) is a single element of A or is undefined
  • M(a) == b if and only if M(b) == a

More specifically, an assignment is a graph-theoretic matching on a bipartite graph.

Practically, this is implemented by denoting the members of the two sets with non-negative integers. Undefined mappings are just given as mapping to -1. sizeA() and sizeB() give the number of elements in each set. The members of A are then denoted as 0..sizeA()-1 and the members of B as the integers 0..sizeB()-1

operator()(int) gives the mapping from A->B (as in

if(assignment(1)==-1){do_something();}

)

inverse(int) gives the mapping from B->A (as in

if(assignment.inverse(1)==-1){do_something();}

)

#include <GAssignment.h>

Inheritance diagram for GClasses::GAssignment:
GClasses::GSimpleAssignment

Public Member Functions

virtual ~GAssignment ()
 A do-nothing destructor needed since there will be subclasses. More...
 
virtual int inverse (unsigned memberOfB) const =0
 Return the number of the member of set A corresponding to the memberOfB element in set B or -1 if there is no corresponding member. More...
 
virtual int operator() (unsigned memberOfA) const =0
 Return the number of the member of set B corresponding to the memberOfA element in set A or -1 if there is no corresponding member. More...
 
virtual std::size_t sizeA () const =0
 Return the number of elements in the A set of this GAssignment. More...
 
virtual std::size_t sizeB () const =0
 Return the number of elements in the B set of this GAssignment. More...
 

Constructor & Destructor Documentation

virtual GClasses::GAssignment::~GAssignment ( )
inlinevirtual

A do-nothing destructor needed since there will be subclasses.

Member Function Documentation

virtual int GClasses::GAssignment::inverse ( unsigned  memberOfB) const
pure virtual

Return the number of the member of set A corresponding to the memberOfB element in set B or -1 if there is no corresponding member.

Parameters
memberOfBthe number of the member of set B whose assignment is desired
Returns
the number of the member of set A corresponding to the memberOfB element in set B or -1 if there is no corresponding member.

Implemented in GClasses::GSimpleAssignment.

virtual int GClasses::GAssignment::operator() ( unsigned  memberOfA) const
pure virtual

Return the number of the member of set B corresponding to the memberOfA element in set A or -1 if there is no corresponding member.

Parameters
memberOfAthe number of the member of set A whose assignment is desired
Returns
the number of the member of set B corresponding to the memberOfA element in set A or -1 if there is no corresponding member

Implemented in GClasses::GSimpleAssignment.

virtual std::size_t GClasses::GAssignment::sizeA ( ) const
pure virtual

Return the number of elements in the A set of this GAssignment.

See the class comment for more information.

Returns
the number of elements in the A set of this GAssignment

Implemented in GClasses::GSimpleAssignment.

virtual std::size_t GClasses::GAssignment::sizeB ( ) const
pure virtual

Return the number of elements in the B set of this GAssignment.

See the class comment for more information.

Returns
the number of elements in the B set of this GAssignment

Implemented in GClasses::GSimpleAssignment.