the rhino

ConFLIP++ Library description

ConFLIP++ modules

cflplist.h / cflplist.cpp

Node1d

This class is used to generate an item of the GenList class. It is the most generic way to describe an element of a linear list by storing a reference to the item, its predecessor, and its successor. The item is a void pointer and is set to NULL when a new Node1d object is initialized.

GenList

The GenList class is a generic list type used for all kinds of linear cyclical lists in ConFLIP++. It provides the generic framework for cyclical lists used for derivations of specific lists. The attributes of the class are the root node, which is always empty and therefore indicates the start of the list, with the integer attribute no_of_items storing the number of items contained in the list, and the attribute flag showing the status of the list.

There are three possibilities to generate a GenList object: Either one uses the constructor without parameters, which causes an empty list to be generated via the protected init method, otherwise it is possible to construct a new GenList object as a copy from an existing GenList object. Alternatively to the latter form of initialization it is also possible to use the constructor which takes a GenSled object associated to a GenList object as an argument and hence generates a new GenList object as a copy of the GenList associated with the specified GenSled object.

The attribute flag is set to lf_init with all three constructors. The destructor deletes the root node. The method clear empties the list by deleting all its elements with the help of the del method which needs to be specified according to the specific item of the list, the flag is also set to lf_init. The method copy copies all the items of an existing GenList object to the current GenList object using the item specific cpy method.

The overloaded operator = enables the user to assign one GenList object to another, just as it is with normal variables. The same is valid for the = operator with a GenSled object on the right side, which assigns the GenList object associated to the GenSled object to the GenList object on the left side. The overloaded compare operator == renders it possible to compare two GenList objects for identity. Two lists are considered to be identical if they have the same number of items, which in turn have to be identical. The comparison of two items is made through the use of the cmp method where the terms of identity between items must be specified.

The method weak_equal checks whether two lists consist of the same set of elements, this can be interpreted as a weak form of identity. The method read reads a GenList from a file via the protected method rd and adds them with the add_quick method described below to the current GenList object. Similarly, the method write writes the contents of the GenList to a file via the protected method wr. The method get_how_full returns the number of elements contained in the list. The method get_flags retrieves, the methods set_flags and clr_flags manipulate the flag attribute of the list. The method show writes the list, i.e. its nodes with their items, via the write method to the standard output device. The methods del, key, look, cmp, cpy, rd, and wr depend on the specific details of the item contained in each node object, which makes it necessary to design them according to the needs of the specific items.

Hence it follows that for the generic and abstract classes described here they do not have any functionality, and must be rewritten in any derived class. The method insert puts a new item (info) into the list after the node stated in the parameter node, through the InfoCopy parameter it is possible to indicate whether the new item should be copied or moved. The success of the insertion procedure is shown in the boolean return value. The method kick_out deletes a node from the list by simply deleting its item with the del method, unlinking it from its predecessor and successor, and then deleting the node itself. The kick_out method has also an alternative variant which makes it possible for us to specify the item of a node object, so that the node object containing this item is removed from the list.

The get_info method returns the item contained in a list node specified in the parameter. The add method puts a new item into the list via the add_quick method described below, but only if no other node with the same key for the item exists. The key of an item in the list is determined by the protected method key.

The method add_quick adds a new item just before the root node of the cyclic list, which is the end position of the list. The insertion is in fact executed by the insert method. The lookup method comes in three variants. The first one tries to find an item of the list starting from the node stated in the parameter node. If the item was found the count parameter holds the distance from the starting node to the node containing the found item. The second lookup leaves out the count parameter and therefore simply calls the first lookup with a dummy variable for the count parameter. The third lookup has only the item to be searched as parameter and calls the second variant of lookup with the first node of the list as starting node, i.e. the successor of the root node. This variant checks the whole list whether the specified item exists or not.

GenSled

This class is always associated with a GenList and offers various kinds of handling the GenList object and its contents. By setting the flags of the GenList object it is possible to allow or disallow certain operations to the GenSled object. Among these operations are the insert, add, add_quick, and kick_out methods, all of which can make changes to the contents of the list. The class has three attributes: a pointer to a Node1d object referring to the currently positioned node in the list, a pointer to a GenList object and an integer variable index stating the position in the list.

There are three different constructors for the GenSled class. The first one simply initializes a GenSled object with the pointers set to NULL and the index to zero. The second constructor has a reference to a GenList object as a parameter and sets the list_ptr to this reference, the index to the first element (zero when no element) and the node pointer to the first node (root when no element). The third variant of the constructor is exactly the same as the second one except for the parameter, which is not a reference but a pointer argument. < P>There are several overloaded operators in order to support navigation in the list. The ++ operator following its assigned object accesses the next item in the list in a forward direction and returns a pointer to the new item of the list. Whereas, the ++ operator preceding its assigned object returns a pointer to the old item of the list after accessing the next item in the list. This is just the same as in C++ with the i++ and ++i statements. Of course, the same procedure applies to the -- operator. Furthermore, the [] operator tries to access an element specified by an integer index. This makes it possible to treat the list as an array, if the list is empty or the specified index is zero or less then the list is positioned on the root node. In any case the item of the positioned node is returned. The += operator advances several steps specified by the parameter after the operator. The same applies to the -= operator which goes backwards instead of forwards. The () operator returns the item of the currently positioned node.

The method isvalid checks whether the currently positioned node is valid, i.e. different from the root pointer.The islast method checks whether the currently positioned node is the last in the list, similarly the isfirst method checks whether the currently positioned node is the first in the list. The methods first and last return the item of the first and last node respectively. The method position returns the index of the currently positioned node. The lookup method checks whether an item is contained in the list or not by the use of the lookup method of the GenList object. In case the item is in the list it positions on the node containing the item and returns the item, otherwise it positions on the root node and returns NULL. The method insert first checks whether it is possible to insert an item into the list, this is indicated by the lf_insert flag set in the associated GenList object. If so, the item specified in the parameter is inserted into the list by the use of the insert method of the GenList object. The same procedure is valid for the add and the add_quick method.

Similarly the kick_out method is also accessible through the GenSled object after the flag (lf_kick_out) of the GenList object has been checked. If the flag setting allows the GenSled object to kick out then the currently positioned item is removed and the GenSled is positioned to its predecessor. The method get_how_full returns the number of items in the list.

cflplib.h / cflplib.cpp

ListOfStrings

This class is derived from the GenList class and is especially used for the handling of lists of strings.

The constructors of the object are the same as with the GenList object. The destructor clears the whole list via the use of the inherited clear method. To specify the class according to the use of string items it is necessary to modify the internal protected methods of the GenList class. Among these are the del, key, look, cmp, cpy, rd and wr method. The del method simply deletes an item of the list, which is referred to by a pointer, with the delete command and casting the pointer to a character pointer indicating that it is a reference to a string. The key method returns its argument meaning that with a string item the key is identical to the string item. The look and cmp method check whether two items of the list are equal or not by doing a string comparison. The cpy method copies a string value into a list item with the length set according to the actual string length. This is used in the copy method (see GenList). The rd method reads a single list item from a file into the list, whereas the wr method writes a single list item to a file.

The remaining methods of the class are implemented by the direct use of GenList methods, among them are the operators =, == and the methods weak_equal, add, add_quick, kick_out, and lookup. They are overwritten in order to modify the parameter types to strings.

SledOfStrings

This class does exactly the same as the generic GenSled class, except that the parameters used and the results returned are character pointers instead of void pointers, which is necessary for a string list. The class operates as sled for the ListOfStrings class.

ListOfLingTerms

This class is derived from the GenList class and is especially used for the handling of lists of linguistic terms.

The constructors of the object are the same as with the GenList object. The destructor clears the whole list via the use of the inherited clear method. To specify the class according to the use of linguistic term items it is of course necessary to modify the internal protected methods of the class. Among these are the del, key, look, cmp, cpy, rd and wr method.

As linguistic terms are also strings the methods del, key, look, cmp are the same as those in the ListOfStrings class. Futhermore, the method cpy copies a string value, which is a linguistic term, into a list item. Contrary to the cpy method of the ListOfStrings, the length of the string is set to the maximum linguistic term length independent of the actual term length. The method rd reads a single list item from a file and checks prior to the insertion of the data into the item whether it forms a valid linguistic term. The check is done in the function check_ling. Only strings within the length boundaries of linguistic terms and containing no illegal characters are considered to be valid. The method wr writes a single list item to a file. The method insert also checks whether a valid linguistic term is inserted into the list and then makes the insertion through the inherited insert method. The method rename replaces all items of the list containing a specific linguistic term with another linguistic term.

The remaining methods of the class are implemented by the direct use of GenList methods. These are the methods add,kick_out, lookup, weak_equal, and the operators = and ==. Their parameter types are modified according to the specific classes. This class does exactly the same as the generic GenSled class, except that the parameters used and the results returned are character pointers instead of void pointers, which is necessary for string (linguistic term) items. The class operates as a sled for the ListOfLingTerms class.

SetOfLingTerms

This class stores a whole set of linguistic terms. It is derived from the ListOfLingTerms class. The main difference between the basic class and the derived class is that the attribute name_of_set, which stores the name of the set of linguistic terms, is added to the derived class.

The constructor without parameters initializes a set with a default set name and an empty list of linguistic terms. The constructor with another SetOfLingTerms object specified as parameter initializes the object with the same values as the object in the argument. The destructor is an empty function. The method clear deletes all elements of the linguistic term's list by the clear method of the ListOfLingTerms class. The methods copy, operator =, operator ==, and weak_equal need to be adapted due to the additional name_of_set attribute. The method check_equality is identical to the method weak_equal. The methods readlesswrite need also to be adapted, so that the additional attribute apart from the list of linguistic terms will be read andwritten.

Furthermore, the methods get_name_of_set and set_name_of_set enable the getting and setting of the name_of_sest attribute. The set_name_of_set checks via the check_set function whether the name of the set is a valid name. The set method sets the name_of_set attribute and the ListOfLingTerms object according to its parameters, which makes it possible to combinean existing ListOfLingTerms with a name to form a SetOfLingTerms object.

ListOfSetsOfLingTerms

Several sets of linguistic terms, i.e. several linguistic variables, are combined in this class. It is derived from the GenList class.

The three types of constructors are implemented in the same way as the three mentioned in the GenList class description. One initializing a default (=empty) list, one initializing the list as a copy of another list, and finally one initializing the list with the values of a list associated to a specified sled. The destructor simply empties the list using the clear method. The method del deletes one item of the list, which is a SetOfLingTerms object. The method key returns the key value of a list item, which is the name of the SetOfLingTerms object. The methods cmp and look compare the key value of the specified list item with the specified string value and return the result of the comparison in a boolean value. The method cpy copies a specified SetOfLingTerms object into the specified item. The methods rd and wr read/write an item of the list from/to a file. The remaining methods are implemented by using the GenList methods. The methods add, kick_out, lookup, weak_equal and the operators =, == are modified for the specific types of parameters.

SledForSetsOfLingTerms

This class does exactly the same as the generic GenSled class, except that the parameters used and the results returned are SetOfLingTerms pointers instead of void pointers, which is necessary for this type of list. The class operates as sled for the ListOfSetsOfLingTerms class.

Table

This class is the basic class for the description of the operator functionality.It is an abstract class, which is used for the two table types concat and compare described below. It contains the table of possible results when an operator is applied to a comparison between a linguistic variable and a value or when it is used for the concatenation of constraints. The attributes arse the sname and the type of the Table.

The constructor without parameters initializes a default Table with the use of the init method. The constructor with another Table object as argument initializes a Table object with the same contents as the specified Table object via the copy method. The destructor is an empty function. The method init generates a default table name using the function get_default_table_name. The method clear is an empty function. The method copy copies the attributes of the specified Table object into the object. The "=" operator enables the assignment operation between Table objects. The "==" operator compares two Table objects using the attributes name and type as comparison criterion, and returns the result of the comparison as a boolean value. The get_name and get_type methods return the values of the respective attributes. The set_name method sets the name of the Table object, after it has checked the name by the use of the check_table function. The method write writes the attributes of the Table object to a file. The method read reads from a file, and prior to assigning the name attribute it checks whether the read name is a valid Table object name by using the check_table function.

TableCompare

This class is derived from the Table class and represents the compare operator functionality. This table is used when a compare expression is evaluated (e.g. temperature <= 10). Compare operators are <=, >=, = and !=. The attributes are the three ListOfLingTerms arrays in, out, and table_compare, which contain the relationship between the linguistic terms of the input linguistic variable and the linguistic terms of the output linguistic variable. For the compare operators the input and output linguistic variables can either be of fuzzy or crisp dilatation type. Therefore with each method it is necessary to specify the dilatation type. The arrays contain entries for each of the dilatation types.

The default constructor initializes a default table with the type attribute set to t_comp indicating a compare table. The alternative constructor sets attributes of the TableCompare object according to the contents of the TableCompare object specified in the argument. The destructor is an empty function. The method clear deletes the contents of all the attributes. The method copy copies all the attributes of another TableCompare object to the current object.

The = operator enables the assignement between TableCompare objects or between a TableCompare and a Table object. The == operator compares two TableCompare objects using all the attributes as comparison criterion, and returning the result of the comparison in a boolean value. The methods read and write read/write all attributes of the object from/to a file.

The method set_in_vars sets the linguistic terms of the input linguistic variable for the compare expression. It checks whether the dilatation type is crisp or fuzzy and wether the output linguistic variable has already been set or not . Then the entries in the table of compare operators for the type of input variable are set to the corresponding output variable. For each linguistic term of the input variable there must be a corresponding entry in the table of compare operators. Compare operators exist only for crisp and fuzzy dilatation types and have one input and one output variable.

The method set_out_vars is rather similar to the previous method. It inserts the linguistic terms of the output linguistic variable and sets the table of compare operators accordingly. The method set_in_to_out_vars sets the table of a specific compare operator to the linguistic terms given in the argument. The specified linguistic terms must be valid linguistic terms of the output linguistic variable. The method set enables to set one single linguistic term, which corresponds to a linguistic term of the input linguistic variable, in the table of a specific compare operator.

The method add_in_var adds one specified linguistic term to the input linguistic variable and extends the table of compare operators with one entry for each operator corresponding to the new input linguistic term. The method add_out_var extends the output linguistic variable with one linguistic term. The kick_out_in_var deletes a linguistic term of the input linguistic variable and the corresponding entries in the table of compare operators. The method kick_out_out_var deletes a linguistic term of the output linguistic variable. The method rename_in_var renames a linguistic term of the input linguistic variable. The method rename_out_var renames a linguistic term of the output linguistic variable.

The methods get_in, get_out, and get_in_to_out return sleds for the input linguistic variable, the output linguistic variable, and the table of compare operators respectively.

TableConcat

This class is derived from the Table class and represents the concat operator functionality. This table is used when a concat expression is evaluated (e.g. temperature_constraint AND humidity_constraint). Contrary to the compare operator in the class TableCompare, the concat operator needs two input linguistic variables for the concatenation. The concat operators are and and or. The attributes are the three ListOfLingTerms arrays in, out, and table_concat, which contains the relationship between the linguistic terms of the input linguistic variables and the linguistic terms of the output linguistic variable. For the concat operators the input linguistic variables can either be of fuzzy or crisp dilatation type, whereas the output linguistic variable can additionally be of mixed dilatation type. Therefore with each method it is necessary to specify the dilatation type. The arrays contain entries for each of the dilatation types.

The default constructor initializes a default table with the type attribute set to t_conc indicating a concat table. The alternative constructor sets attributes of the TableConcat object according to the contents of the TableConcat object specified in the argument. The destructor is an empty function. The method clear deletes the contents of all the attributes. The method copy copies all the attributes of another TableConcat object to the current object. The = operator enables the assignement between TableConcat objects or between a TableConcat and a Table object. The == operator compares two TableConcat objects using all the attributes as comparison criterion, and returning the result of the comparison in a boolean value. The methods read and write read/write all attributes of the object from/to a file. The method set_in_vars sets the linguistic terms of the specified input linguistic variable for the concat expression.

It is checked whether the the dilatation type is crisp or fuzzy and the output linguistic variable has already been set. Then the entries in the table of concat operators for the type of input variable are set to the corresponding output variable. For each combination of linguistic terms of the input variables there must be a corresponding entry in the table of concat operators. The method set_out_vars is rather similar to the previous method. It inserts the linguistic terms of the output linguistic variable and sets the table of concat operators accordingly. As the output linguistic variable can also be of mixed type, which is the result of a concatenation of a crisp and a fuzzy input linguistic variable, this must also be considered when initializing the table of concat operators. The method set_in_to_out_vars sets the table of a specific compare operator to the linguistic terms given in the argument. The specified linguistic terms must be valid linguistic terms of the output linguistic variable. The method set enables to set one single linguistic term, which corresponds to a combination of linguistic terms of the input linguistic variables, in the table of a specific concat operator.

The method add_in_var adds one specified linguistic term to the specified input linguistic variable and extends the table of concat operators with one entry for each linguistic term of the other input linguistic variable and each operator corresponding to the new input linguistic term. The method add_out_var extends the output linguistic variable with one linguistic term. The kick_out_in_var deletes a linguistic term of the specified input linguistic variable and the corresponding entries in the table of compare operators. The method kick_out_out_var deletes a linguistic term of the output linguistic variable. The method rename_in_var renames a linguistic term of the specified input linguistic variable. The method rename_out_var renames a linguistic term of the output linguistic variable.

The methods get_in, get_out, and get_in_to_out return sleds for the specified input linguistic variable, the output linguistic variable, and the table of compare operators respectively.

ListOfTables

This class is derived from the abstract class GenList. It represents a collection of several operator Tables.

The default constructor generates an empty list. The other two constructors generate a list with the contents copied from the ListOfTables object specified in the parameter. The parameter is either a reference to the ListOfTables object or a reference to a SledForTables which is associated to a ListOfTables object. The destructor deletes all elements of the list. The method del deletes an item of the list, which either can be a TableCompare or a TableConcat object. The method key returns the name of the referenced Table askey.

The method look compares a string with the name of the referenced Table. The method cmp checks whether two referenced Tables are identical. The method cpy copies one Table object into another one. The method rd reads a Table from a file into an item. The method wr writes a Table onto a file. The = and == operators, and the weak_equal, add, kick_out, and look_up methods use the inherited methods of GenList and operate in the same way.

SledForTables

This class does exactly the same as the generic GenSled class, except that the parameters used and the results returned are Tables pointers instead of void pointers, which is necessary for this type of list. The class operates as sled for the ListOfTables class.

ListOfParameterSets

This class is a collection of ParameterSets, which are objects of the underlying FLIP++ library. It is derived from the abstract class GenList. It represents a collection of several linguistic variables.

The default constructor generates an empty list. The other two constructors generate a list with the contents copied from the ListOfParameterSets object specified in the parameter. The parameter is either a reference to the ListOfParameterSets object or a reference to a SledForParameterSets which is associated with a ListOfParameterSets object. The destructor deletes all elements of the list while the method del deletes an item of the list. The method key returns the name of the referenced ParameterSet as a key. The method look compares a string with the name of the referenced ParameterSet. The method cmp is not available. The method cpy copies one ParameterSet object into another . The method rd reads a ParameterSet from a file into an item. The method wr writes a ParameterSetfrom an object into a file. The = and == operators, and the weak_equal, add, kick_out, and look_up methods use the inherited methods of GenList and operate in the same way.

SledForParameterSets

This class does exactly the same as the generic GenSled class, except that the parameters used and the results returned are ParameterSets pointers instead of void pointers, which is necessary for this type of list. The class operates as sled for the ListOfParameterSets class.

conflip.h / conflip.cpp

InfoB

This is an internal abstract class which provides the framework for the InfoCompare and InfoConcat classes. The main purpose is to provide information about a constraint, which is then used in the SetOfConstraints class. The information encompasses a name, a type indicating the type of constraint (compare or concat), an importance attached to a constraint, the dilatation (crisp or fuzzy), and a comment about the constraint.

The default constructor initializes an object with the use of the internal init method. The init method sets a default name generated by the function get_default_info_name, sets the importance to zero, the dilatation to crisp, and the comment to an empty string. As an alternative, an object can be created as a copy of another InfoB object by applying the copy method. The destructor and the method clear are empty functions, as this is an abstract and non-dynamic class. The method copy is used by the above mentioned constructor and copies the contents of another InfoB object to the current one. The operator = is used for assignment. The operator == checks whether two InfoB objects have the same contents in the attributes. Also, the methods read and write handle input/output from/to files.

Furthermore, there are trivial get and set methods to retrieve and set the values of the attributes. For the type attribute there is only a get method because this attribute is set internally by assignment in the InfoCompare and InfoConcat object respectively. There also exists an aggregate set method where all attributes, again with type as exception, that can be set with one call. The name attribute must also fulfill length and character requirements, which are observed by the check_info function.

Info

This class is derived from the virtual class InfoB, it does not add any funcionality. So it is identical with the InfoB class. In fact, it is not treated as an abstract class, and can therefore be used as an object of its own.

InfoCompare

This class is derived from the InfoB class and it is used to provide information about a compare constraint (e.g. temperature >= 30). The attributes are var, which is the linguistic variable contained in the constraint ('temperature' in the above example), var_dilatation which indicates whether the variable is crisp or fuzzy, op specifies the type of compare operator applied ('>=' in the above example), and comp_value, which is the linguistic variable that has to be compared with.

The default constructor initializes an object using the init method. The init method sets the type to compare, generates a default name for the linguistic variable, sets the linguistic variable type to crisp, the operator to equal, and the compare value to zero. There also exists a constructor which takes another InfoCompare object as an argument and sets the attributes of the current object correspondingly. The destructor and the method clear are empty functions. The copy method copies the values of an existing object to the current one and is used by the above mentioned constructor. The operators = and == are used for assignment and comparison. The methods read and write read/write the contents of the object from/to files. Futhermore, it is also possible to indicate in a boolean parameter in the methods clear, copy, read, and write, whether inherited parts from Info should also be processed or not. Again, there are trivial get and set methods to retrieve and set the values of the attributes.

There also exists an aggregate set method which enables the setting of all attributes including the inherited ones at once.

InfoConcat

This class is derived from the InfoB class and is used to provide information about a concat constraint (e.g. temperature_constraint AND humidity_costraint). The attributes are const1 and const2, which are the names of the two constraints to be concatenated ('temperature_constraint' and 'humidity_constraint' in the above example), op which specifies the type of concat operator applied ('AND' in the above example).

The default constructor initializes an object using the init method. The init method sets the type to concat, generates default names for the constraints, and sets the operator to 'c_and'. There also exists a constructor which takes another InfoConcat object as an argument and sets the attributes of the current object correspondingly. The destructor and the method clear are empty functions. The copy method copies the values of an existing object to the current one and is used by the above mentioned constructor. The operators = and == are used for assignment and comparison. The methods read and write read/write the contents of the object from/to files.

Furthermore, it is also possible to indicate in a boolean parameter found in the methods clear, copy, read, and write, whether inherited parts from Info should be processed too or not. Again, there are trivial get and set methods to retrieve and set the values of the attributes. There also exists an aggregate set method which enables the setting of all attributes including the inherited ones at once. The names of the constraints and the concat constraint must be unique.

ListOfInfos

This class collects several objects of the above described Info, InfoCompare, and InfoConcat classes. It is derived from the generic class GenList.

The default constructor generates an empty list. The other two constructors generate a list with the contents copied from the ListOfInfos object specified in the parameter. The parameter is either a reference to the ListOfInfos object or a reference to a SledForInfos which is associated to a ListOfInfos object. The destructor deletes all elements of the list. The method del deletes an item of the list. The method key returns the name of the referenced Info as a key. The method look compares a string with the name of the referenced Info. The method cmp compares two referenced Infos for identity. The method cpy copies one Info object into another one. The method rd reads an Info from a file into an item. The method insert inserts an Info object into the list and in case of the concat constraint checks whether the underlying constraint are existent.

Also the method kick_out, with a node parameter, deletes all appearances of a constraint in other concat constraints of the list prior to deleting the constraint itself. The method wr writes an Info from an object to a file. The = and == operators, and the weak_equal, add, kick_out, and look_up methods use the inherited methods of GenList and operate in the same way.

SledForInfos

This class does exactly the same as the generic GenSled class, except that the parameters used and the results returned are Infos pointers instead of void pointers, which is necessary for this type of list. The class operates as sled for the ListOfInfos class.

Constraint

This is a virtual class derived from the InfoB class and represents a framework for the two constraint classes ConstraintCompare and ConstraintConcat, which are described below. The attributes of the class are satisfaction, which says how well a constraint is satisfied cv_for_constraint, which is the linguistic variable that is attached to the constraint, and where_do_i_belong_to, which refers to the SetOfConstraints object the constraint belongs to.

The default constructor initializes an empty constraint. First it calls the constructor of InfoB, then it calls the method init. This method sets the satisfaction to zero and the pointers cv_for_constraint and where_do_i_belong_to to NULL. Again, there are alternative constructors. One initializing the Constraint object with the contents of another Constraint object. Another one initializing the inherited parts with the contents of the specified InfoB object. The destructor deletes the linguistic variable associated with the constraint. The method clear is an empty method. The method copy copies the contents of another Constraint object to the current one and is used by the constructor described above. The operators = is used for assignment, whereas the operator == is not implemented for this class.

The methods read and write handle input/output from/to files. The methods read, write, and copy have a boolean parameter indicating whether the inherited attributs should be processed too or not. The attributes satisfaction and set_cv_for_const can be set and retrieved with trivial methods. Furthermore, the set methods for the inherited attributes name and importance need to be modified. With set_name not only the inherited name attribute is set to the specified name, but also the name of the linguistic variable cv_for_const.

Furthermore, all appearances in concat constraints must be updated. With set_importance the importance of the linguistic variable is also set. The method make_instance creates a new linguistic variable (CombinedVariable object) for the constraint, where the number of linguistic terms is determined by the compare operator and dilatation type used. The method bind_to_set connects the Constraint object to the specified SetOfConstraints. The method bind_to_flip connects the Constraint object, which is already bound to a SetOfConstraints object, to the FLIP++ library by assigning the linguistic variable cv_for_const. The appropriate variable is found by the name of the constraint, which is also the name of the variable, by searching in the rules of the SetOfConstraints object.

ConstraintCompare

This class is derived from the classes Constraint and InfoCompare. It represents a compare constraint (e.g. temperature >= 30). The attribute cv_for_var is a reference to a linguistic variable used in the constraint.

The default constructor calls the method init and the constructors of the mother classes. The other two constructors have either an existing ConstraintCompare or InfoCompare object as reference and initialize the object accordingly. The destructor and the method clear are empty methods. The method init sets the attribute cv_for_var to NULL. The method copy copies the contents of another ConstraintCompare object to the current one. The = operator is used for assignment, on the left side either a ConstraintCompare or a Constraint object can appear. The == operator is not implemented. The methods read and write handle input/output from/to files. The methods clear, copy, read, and write have a boolean parameter which determines whether the inherited attributes should be processed too or not. For the attribute cv_for_var exist trivial set and get methods. The method set_name sets not only the name for the Constraint, but also the name for the linguistic variable cv_for_var, which forms the Constraint.

The method set_var_name sets the name of the linguistic variable cv_for_var. The methods set_var_dil and set_op enable setting the dilatation type used for the linguistic variable and the compare operator applied in the Constraint. The last two methods also use the generate_ruleset method to adapt to the rules to the new operator or constraint variable respectively after the old rules for the Constraint have been removed. This is simply done by using the corresponding object for the operator and dilatation type, where for each entry in the table consisting of an input and output value a rule is generated. So, if the cv_for_var variable has a specific linguistic term as value then the cv_for_const variable is set to the linguistic term value that corresponds to the input value found in the table. The method make_instance assigns a CombinedVariable object to the cv_for_var variable, where the number of linguistic terms is determined by the compare operator and dilatation type used. The method bind_to_flip connects the ConstraintCompare object, which is already bound to a SetOfConstraints object, to the FLIP++ library by first connecting via the inherited Constraint object and then assigning the linguistic variable cv_for_var. The appropriate variable is found by the name of the linguistic variable used in the constraint by searching in the rules of the SetOfConstraints object.

ConstraintConcat

This class is derived from the classes Constraint and InfoConcat and represents a concat constraint (e.g. temperature_constraint AND humiditity_constraint).

The default constructor calls the method init and the constructors of the mother classes. The other two constructors have either an existing ConstraintConcat or InfoConcat object as reference and initialize the object accordingly. The destructor, the method clear, and the method init are empty methods. The method copy copies the contents of another ConstraintConcat object to the current one. The = operator is used for assignment, on the left side either a ConstraintConcat or a Constraint object can appear. The == operator is not implemented. The methods read and write handle input/output from/to files. The methods clear, copy, read, and write have a boolean parameter which determines whether the inherited attributes should be processed too or not. The methods set_const1 and set_const2 assign the two constraints used in the concatenation, whereas the method set_op defines the concat operator used in the Constraint.

The previous three methods also use the generate_ruleset method to adapt the rules to the new operator or constraints respectively after the old rules concerning the Constraint have been removed. This is simply done by using the corresponding object for the operator and dilatation type, where for each entry in the table consisting of two input and one output value a rule is generated. So, if the two constraint variables have specific linguistic terms as value then the cv_for_const variable is set to the linguistic term value that corresponds to these input values found in the table. The method make_instance assigns Constraints to the constraint variables and adapts the rules correspondingly. The method bind_to_flip connects the ConstraintConcat object, which is already bound to a SetOfConstraints object, to the FLIP++ library by connecting via the inherited Constraint object.

ListOfConstraints

This class collects several objects of the above described Constraint, ConstraintCompare, and ConstraintConcat classes. It is derived from the generic class GenList.

The default constructor generates an empty list. The other two constructors generate a list with the contents copied from the ListOfConstraints object specified in the parameter. The parameter is either a reference to the ListOfConstraints object or a reference to a SledForConstraints which is associated to a ListOfConstraints object. The destructor deletes all elements of the list. The method del deletes an item of the list. The method key returns the name of the referenced Constraintas key. The method look compares a string with the name of the referenced Constraint. The method cmp compares two referenced Constraints for identity. The method cpy copies one Constraint object into another. The method rd reads a Constraint from a file into an item. The method wr writes a Constraint to a file. The method insert inserts an Constraint object into the list and in case of the concat constraint checks whether the underlying constraints are existent. The method kick_out with a node parameter deletes all appearances of a constraint in other concat constraints of the list prior to deleting the constraint itself. The = and == operators, and the weak_equal, add, kick_out, and look_up methods use the inherited methods of GenList and operate in the same way.

SledForConstraints

This class does exactly the same as the generic GenSled class, except that the parameters used and the results returned are Constraints pointers instead of void pointers, which is necessary for this type of list. The class operates as sled for the ListOfConstraints class.

SetOfConstraints

This class is derived from the ListOfConstraints. It is the master class combining Constraints with Tables, RuleSets and ParameterSets. The attributes are the name of the SetOfConstraints, correspondings_for_compare and correspondings_for_concat, which are the Tables, standard_ps, which is a standard ParameterSet used for the generation of linguistic variables (CombinedVariables), and rules, which is a RuleSet and hence a connection to the FLIP++ libraries.

The default constructor initializes an empty set with a default name. Alternatively a SetOfConstraints can be instantiated as a copy from an existing SetOfConstraints object. The destructor is an empty method. The method clear is used to empty the ListOfConstraints. The method copy copies the values from an existing SetOfConstraints object to the current one. The method insert inserts a new Constraint into the set. The operators = and == are used for assignment and comparison. The methods read and write handle input/output from/to files.

There are also simple get methods for the retrieval of name, the Tables, Rules, and ParameterSet. Furthermore an aggregate set method enables setting the name, Tables, and the ParameterSet. The method set_name sets the name of the SetOfConstraints. The method get_lowest_level looks recursivley for the lowest occurence of a Constraint in a hierarchy of Constraints and returns a list of all Constraints visited when descending down the Constraints tree. The method get_value retrieves the crisp value of the linguistic variable contained in a ConstraintCompare object, whereas the method set_value reversely sets the value of a linguistic variable contained in a ConstraintCompare object.

Hence this method instantiates the linguistic terms of the linguistic variable according to the value specified. The method evaluate starts the evaluation of a Constraint by evaluating the corresponding constraint variable with the use of the FLIP++ libraries.

cflp_dyn.h / cflp_dyn.cpp

EvalConstraint

This class is used for storing the results of the evaluation of a Constraint. This enables the user to combine evaluation results by aggregation or to defuzzy them, or to reuse them in other computations.

The attributes are name, which is the name of the EvalConstraint, cv_name, the name of the CombinedVariable used, result_cv, the CombinedVariable object that stores the evaluation result, and importance, which is the importance attached to the result_cv.

The default constructor uses the init method to initialize the object. The destructor is empty. The init method sets a default name, the importance to zero, and the result_cv to NULL. The method clear deletes the result_cv CombinedVariable. The method copy copies the contents of another EvalConstraint object to the current one. The = operator is used for assignment, whereas the == comparison operator is not supported. The methods read andwrite are used for retrieving and storing the data contents of an object. Simple get and set methods allow to retrieve and modify the values of the attributes.

ListOfEvalConstraints

This class collects several objects of the above described EvalConstraints class. It is derived from the generic class GenList.

The default constructor generates an empty list. The other two constructors generate a list with the contents copied from the ListOfEvalConstraints object specified in the parameter. The parameter is either a reference to the ListOfEvalConstraints object or a reference to a SledForEvalConstraints which is associated to a ListOfEvalConstraints object. The destructor deletes all elements of the list.

The method del deletes an item of the list. The method key returns the name of the referenced EvalConstraint as key. The method look compares a string with the name of the referenced EvalConstraint. The method cmp compares two referenced EvalConstraints for identity. The method cpy copies one EvalConstraint object into another one. The method rd reads an EvalConstraint from a file into an item. The method wr writes an EvalConstraint to afile. The = and == operators, and the weak_equal, add, kick_out, and look_up methods use the inheritedmethods of GenList and operate in the same way.

SledForEvalConstraints

This class does exactly the same as the generic GenSled class, except that the parameters used and the results returned are EvalConstraint pointers instead of void pointers, which is necessary for this type oflist. The class operates as sled for the ListOfEvalConstraints class.

SetOfEvalConstraints

This class is derived from ListOfEvalConstraints and aggregates a ListOfEvalConstraints together with a Table, a ParameterSet, and a RuleSet. It is used to aggregate and defuzzify EvalConst raints. The attributes are name, rules, table, and ps.

Both the constructor and the destructor are empty functions. The method insert inserts a new EvalConstraint into the list and binds its result_cv to the corresponding CombinedVariable in the rules. The methods read and write retrieve and store the data contents of the object from/to files.

Simple get methods allow us to retrieve the values of the attributes. The method get_eval_const_store returns the whole ListOfEvalConstraints object. The method set_name sets the name of the object, whereas themethod set sets the attributes tables, ps, and name. The method defuzzify uses the FLIP++ method accumulate to get a defuzzified result of the specified linguistic variable. The method aggregate is used to concatenate two EvalConstraints in order to form an overall EvalConstraint. The rules and the ps are adapted to the newly created constraint.



Back to DocuFLIP++ overview StarFLIP home page
(c)1996 Andreas RAGGL, Mazen YOUNES, Markus BONNER, Wolfgang SLANY

Last modified: Tue Jun 24 15:29:55 MET-DST 1997 by StarFLIP Team