copasi API  0.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
CNormalLogical Class Reference

#include <CNormalLogical.h>

Inheritance diagram for CNormalLogical:
CNormalBase

List of all members.

Classes

class  SetOfSetsSorter
class  SetSorter
class  TemplateSet
class  TemplateSetOfSets

Public Types

typedef TemplateSet
< CNormalChoiceLogical
ChoiceSet
typedef TemplateSetOfSets
< CNormalChoiceLogical
ChoiceSetOfSets
typedef TemplateSet
< CNormalLogicalItem
ItemSet
typedef TemplateSetOfSets
< CNormalLogicalItem
ItemSetOfSets

Public Member Functions

 CNormalLogical ()
 CNormalLogical (const CNormalLogical &src)
virtual ~CNormalLogical ()
CNormalLogicaloperator= (const CNormalLogical &src)
bool operator== (const CNormalLogical &rhs) const
bool operator< (const CNormalLogical &rhs) const
virtual CNormalBasecopy () const
virtual std::string toString () const
virtual bool simplify ()
bool isNegated () const
void setIsNegated (bool negate)
void negate ()
ChoiceSetOfSetsgetChoices ()
const ChoiceSetOfSetsgetChoices () const
ItemSetOfSetsgetAndSets ()
const ItemSetOfSetsgetAndSets () const
void setAndSets (const ItemSetOfSets &set)
void setChoices (const ChoiceSetOfSets &set)

Static Public Member Functions

template<typename TYPE >
static void cleanSetOfSets (TemplateSetOfSets< TYPE > &s)
template<typename TYPE >
static void copySet (const TemplateSet< TYPE > &source, TemplateSet< TYPE > &target)
template<typename TYPE >
static void cleanSet (const TemplateSet< TYPE > &s)

Protected Member Functions

bool generateCanonicalDNF (ItemSetOfSets &tmpAndSet) const
bool evaluateExpression (const std::map< CNormalLogicalItem, bool > &truthValueMap) const

Static Protected Member Functions

template<typename TYPE >
static bool negateSets (const TemplateSet< TYPE > &source, TemplateSet< TYPE > &target)
template<typename TYPE >
static bool negateSetOfSets (const TemplateSetOfSets< TYPE > &source, TemplateSetOfSets< TYPE > &target)
template<typename TYPE >
static bool convertAndOrToOrAnd (const TemplateSetOfSets< TYPE > &source, TemplateSetOfSets< TYPE > &target)
template<typename TYPE >
static void copySetOfSets (const TemplateSetOfSets< TYPE > &source, TemplateSetOfSets< TYPE > &target)
static void eliminateNullItems (const ItemSetOfSets &source, ItemSetOfSets &target, bool orSet)

Protected Attributes

bool mNot
ItemSetOfSets mAndSets
ChoiceSetOfSets mChoices

Member Typedef Documentation


Constructor & Destructor Documentation

CNormalLogical::CNormalLogical ( )
CNormalLogical::CNormalLogical ( const CNormalLogical src)
CNormalLogical::~CNormalLogical ( ) [virtual]

Member Function Documentation

template<typename TYPE >
static void CNormalLogical::cleanSet ( const TemplateSet< TYPE > &  s) [inline, static]

This routine calls delete an all pointers in the set.

template<typename TYPE >
static void CNormalLogical::cleanSetOfSets ( TemplateSetOfSets< TYPE > &  s) [inline, static]

This routine calls cleanSet on all inner sets.

template<typename TYPE >
static bool CNormalLogical::convertAndOrToOrAnd ( const TemplateSetOfSets< TYPE > &  source,
TemplateSetOfSets< TYPE > &  target 
) [inline, static, protected]

Converts a set of AND combined sets of OR combined elements into a target set of OR combined sets of AND combined elements.

CNormalBase * CNormalLogical::copy ( ) const [virtual]

Implements CNormalBase.

template<typename TYPE >
static void CNormalLogical::copySet ( const TemplateSet< TYPE > &  source,
TemplateSet< TYPE > &  target 
) [inline, static]

This routine makes a deep copy of all elements in the souce set and appends them to the target set.

template<typename TYPE >
static void CNormalLogical::copySetOfSets ( const TemplateSetOfSets< TYPE > &  source,
TemplateSetOfSets< TYPE > &  target 
) [inline, static, protected]

This routine makes deep copies of all inner sets and appends them to the target set.

void CNormalLogical::eliminateNullItems ( const ItemSetOfSets source,
ItemSetOfSets target,
bool  orSet 
) [static, protected]

This methods checks wether there is something like A and !A in a set, if such an occurance is found, the whole set is converted to a set with either a false or a true item. For or combined items, this would be true, for and combined sets, it would be false. If there already are sets in the outer set, this set could be eliminated altogether.

bool CNormalLogical::evaluateExpression ( const std::map< CNormalLogicalItem, bool > &  truthValueMap) const [protected]

Given a map that associates each logical element with a truth value, this method evaluates the whole logical expression.

bool CNormalLogical::generateCanonicalDNF ( ItemSetOfSets tmpAndSet) const [protected]

This method creates the canonical disjunctive normalform for a logical expression. The expression must not contain choices and no negated item sets or items. Since the method scales with exponentially, the number of logical individual logical items in the expression is limited to 16. The return value is true if the call succeeded and false otherwise.

CNormalLogical::ItemSetOfSets & CNormalLogical::getAndSets ( )
const CNormalLogical::ItemSetOfSets & CNormalLogical::getAndSets ( ) const
CNormalLogical::ChoiceSetOfSets & CNormalLogical::getChoices ( )
const CNormalLogical::ChoiceSetOfSets & CNormalLogical::getChoices ( ) const
bool CNormalLogical::isNegated ( ) const
void CNormalLogical::negate ( )
template<typename TYPE >
static bool CNormalLogical::negateSetOfSets ( const TemplateSetOfSets< TYPE > &  source,
TemplateSetOfSets< TYPE > &  target 
) [inline, static, protected]

Negates a set of sets with elements. The result of the operation is returned in target. The type of the result depends on the source. If the source was a set of AND combined sets of OR combined elements, the rersult will be a set of OR combined sets with AND combined elements.

template<typename TYPE >
static bool CNormalLogical::negateSets ( const TemplateSet< TYPE > &  source,
TemplateSet< TYPE > &  target 
) [inline, static, protected]

Negates a set of elements. The result of the operation is returned in target. The type of result depends on the source. If the source was a set of AND combined elements, the result is a set of OR combined elements and vice versa. target set.

bool CNormalLogical::operator< ( const CNormalLogical rhs) const
CNormalLogical & CNormalLogical::operator= ( const CNormalLogical src)
bool CNormalLogical::operator== ( const CNormalLogical rhs) const

Converts a set of AND combined sets of OR combined elements into a target set of OR combined sets of AND combined elements. Negates a set of elements. The result of the operation is returned in target. The type of result depends on the source. If the source was a set of AND combined elements, the result is a set of OR combined elements and vice versa. target set. Negates a set of sets with elements. The result of the operation is returned in target. The type of the result depends on the source. If the source was a set of AND combined sets of OR combined elements, the rersult will be a set of OR combined sets with AND combined elements.

void CNormalLogical::setAndSets ( const ItemSetOfSets set)
void CNormalLogical::setChoices ( const ChoiceSetOfSets set)
void CNormalLogical::setIsNegated ( bool  negate)
bool CNormalLogical::simplify ( ) [virtual]

Out of some reason, I can not use the insert method becasuse this seems to lead to different results in certain cases. E.g. I had a itemSetOfSets with 17 entries and if I used the insert, only 15 eneded up in mAndItems, whereas when I copied them in a loop, all 17 ended up in mAndItems. This is strange and unsatisfying, but since sets can't be debuged that well, I didn't feel like digging into this. RG

Implements CNormalBase.

std::string CNormalLogical::toString ( ) const [virtual]

Implements CNormalBase.


Member Data Documentation

bool CNormalLogical::mNot [protected]

Flag to specify whether the whole logical expression has to be negated.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines