File body.hpp

class IConditional
#include <body.hpp>

Defines an interface for all classes that allow to check whether an example is covered or not.

Subclassed by ConjunctiveBody::ConditionVector< int32, CompareNominalEq >, ConjunctiveBody::ConditionVector< int32, CompareNominalNeq >, ConjunctiveBody::ConditionVector< int32, CompareOrdinalGr >, ConjunctiveBody::ConditionVector< float32, CompareNumericalGr >, ConjunctiveBody::ConditionVector< float32, CompareNumericalLeq >, ConjunctiveBody::ConditionVector< int32, CompareOrdinalLeq >, IBody

Public Functions

inline virtual ~IConditional()
virtual bool covers(View<const float32>::const_iterator begin, View<const float32>::const_iterator end) const = 0

Returns whether an individual example, which is stored in a C-contiguous matrix, is covered or not.

Parameters:
  • begin – An iterator to the beginning of the example’s feature values

  • end – An iterator to the end of the example’s feature values

Returns:

True, if the example is covered, false otherwise

virtual bool covers(View<uint32>::const_iterator indicesBegin, View<uint32>::const_iterator indicesEnd, View<float32>::const_iterator valuesBegin, View<float32>::const_iterator valuesEnd, float32 sparseValue, View<float32>::iterator tmpArray1, View<uint32>::iterator tmpArray2, uint32 n) const = 0

Returns whether an individual example, which is stored in a CSR sparse matrix, is covered or not.

Parameters:
  • indicesBegin – An iterator to the beginning of the example’s feature values

  • indicesEnd – An iterator to the end of the example’s feature values

  • valuesBegin – An iterator to the beginning of the example’s feature_indices

  • valuesEnd – An iterator to the end of the example’s feature indices

  • sparseValue – The value that should be used for sparse feature values

  • tmpArray1 – An iterator that is used to temporarily store non-zero feature values. May contain arbitrary values

  • tmpArray2 – An iterator that is used to temporarily keep track of the feature indices with non-zero feature values. Must not contain any elements with value n

  • n – An arbitrary number. If this function is called multiple times for different examples, but using the same tmpArray2, the number must be unique for each of the function invocations

Returns:

True, if the example is covered, false otherwise

class IBody : public IConditional
#include <body.hpp>

Defines an interface for all classes that represent the body of a rule.

Subclassed by ConjunctiveBody, EmptyBody

Public Types

typedef std::function<void(const EmptyBody&)> EmptyBodyVisitor

A visitor function for handling objects of the type EmptyBody.

typedef std::function<void(const ConjunctiveBody&)> ConjunctiveBodyVisitor

A visitor function for handling objects of the type ConjunctiveBody.

Public Functions

inline virtual ~IBody() override
virtual void visit(EmptyBodyVisitor emptyBodyVisitor, ConjunctiveBodyVisitor conjunctiveBodyVisitor) const = 0

Invokes one of the given visitor functions, depending on which one is able to handle this particular type of body.

Parameters:
  • emptyBodyVisitor – The visitor function for handling objects of the type EmptyBody

  • conjunctiveBodyVisitor – The visitor function for handling objects of the type ConjunctiveBody