<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\section{Ki\-Track\-:\-:Subset\-Simple$&lt;$ T $&gt;$ Class Template Reference}
\label{classKiTrack_1_1SubsetSimple}\index{Ki\-Track\-::\-Subset\-Simple$&lt;$ T $&gt;$@{Ki\-Track\-::\-Subset\-Simple$&lt;$ T $&gt;$}}


A class to get the best subset by taking the element with the highest quality indicator and throwing away all incompatible ones.  




{\ttfamily \#include $&lt;$Subset\-Simple.\-h$&gt;$}

Inheritance diagram for Ki\-Track\-:\-:Subset\-Simple$&lt;$ T $&gt;$\-:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classKiTrack_1_1SubsetSimple}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\footnotesize template$&lt;$class Get\-Q\-I , class Are\-Compatible $&gt;$ }\\void {\bf calculate\-Best\-Set} (Are\-Compatible are\-Compatible, Get\-Q\-I get\-Q\-I)
\begin{DoxyCompactList}\small\item\em Calculates the best set using a very simple method. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Additional Inherited Members}


\subsection{Detailed Description}
\subsubsection*{template$&lt;$class T$&gt;$class Ki\-Track\-::\-Subset\-Simple$&lt;$ T $&gt;$}

A class to get the best subset by taking the element with the highest quality indicator and throwing away all incompatible ones. 

On the remaining elements repeat the procedure. 

\subsection{Member Function Documentation}
\index{Ki\-Track\-::\-Subset\-Simple@{Ki\-Track\-::\-Subset\-Simple}!calculate\-Best\-Set@{calculate\-Best\-Set}}
\index{calculate\-Best\-Set@{calculate\-Best\-Set}!KiTrack::SubsetSimple@{Ki\-Track\-::\-Subset\-Simple}}
\subsubsection[{calculate\-Best\-Set}]{\setlength{\rightskip}{0pt plus 5cm}template$&lt;$class T $&gt;$ template$&lt;$class Get\-Q\-I , class Are\-Compatible $&gt;$ void {\bf Ki\-Track\-::\-Subset\-Simple}$&lt;$ T $&gt;$\-::calculate\-Best\-Set (
\begin{DoxyParamCaption}
\item[{Are\-Compatible}]{are\-Compatible, }
\item[{Get\-Q\-I}]{get\-Q\-I}
\end{DoxyParamCaption}
)}\label{classKiTrack_1_1SubsetSimple_af76a07b8f9ee8fe262a5695396b531fd}


Calculates the best set using a very simple method. 

After this the results can be accessed with the \doxyref{get\-Accepted()}{p.}{classKiTrack_1_1Subset_a185d85f923c6705cf91b047a01e7af6b} and \doxyref{get\-Rejected()}{p.}{classKiTrack_1_1Subset_a6c68e5197ba52b2f4bcc2dc0fed57e0c} methods (provided by the baseclass \doxyref{Subset}{p.}{classKiTrack_1_1Subset}).

This is a templated class to allow the reuse with objects from different. The goal is this\-: if you have a set of things that are somehow compatible or incompatible with each other and you want a subset that only contains compatible ones and has a high quality, to find this subset.

For example\-: you plan a concert where a lot of different artists shall perform together. You have 20 that you are interested in asking. B\-U\-T\-: not all of them get along together very well. So artist 1 might be incompatible with artist 2 and 7 for some arbitrary reasons. And artist 2 is incompatible with artist 1,3 and 13 and so on. In order not to completely mess up the concert you can only invite artists who are entirely compatible with each other. A\-N\-D\-: not all artists are equal\-: some are really famous and some are pretty mediocre. So you want to find a set of artists with the highest possible quality which is completely compatible.

This is done by this class.

The algorithm used for it is this\-: take the element with the highest quality and accept it. Reject all other elements that are incompatible with it. From the remaining elements redo the same with the next best element. In our artist example\-: take the biggest star and throw out all he doesn't get allong with. From the remaining artists (those who do get along with the biggest star) pick next famous one. Once again kick out all that don't get along with him and so on.

In order to work it needs to know two things\-: how to calculate the quality of an element and how to determine if two elements are compatible. These are of course things the user has to provide. For both a functor object is needed.

Here is how it could look like in the artist example\-:

\begin{DoxyVerb}class AristQI{
   
public:
   
   // returns the quality of an artist (a value between 0 and 1, 0 being bad and 1 being fantastic)  
   inline double operator()( Artist artist ){
      
      return artist.numberOfFans()/nPeopleOnEarth;    // a number between 0 and 1
      
   }
   
};

class ArtistCompatibility{
   
public:
   
   // returns whether two artists are compatible
   inline bool operator()( Artist artistA, Artist artistB ){
      
      if( artistA.hates( artistB ) ) return false;
      else return true; 
      
   }
   
};


//Somewhere within the program:

ArtistCompatibility comp;
ArtistQI qi;

SubsetHopfieldNN&lt; Artist &gt; subset;
subset.add( vecOfArtists );                                 
subset.calculateBestSet( comp, qi );

std::vector&lt; Artist &gt; artistsToInvite = subset.getAccepted();
std::vector&lt; Artist &gt; artistsToStayAtHome = subset.getRejected();\end{DoxyVerb}


\begin{DoxyVerb}     @param areCompatible a functor of type bool( T, T ) that should tell whether two elements are compatible
     or not.

     @param getQI a functor of type double( T ) that returns the quality of an element and should range between 0 and 1.\end{DoxyVerb}
 

The documentation for this class was generated from the following file\-:\begin{DoxyCompactItemize}
\item 
Subset\-Simple.\-h\end{DoxyCompactItemize}
</pre></body></html>