All this method does create local copy fuzzyrule class
448 | |
|
---|
From Theory to Application: Coding a Fuzzy Logic Module
As you can see, all this method does is create a local copy of a FuzzyRule class. A FuzzyRule contains an instance of a FuzzyTerm denoting the ante-cedent and another denoting the consequent. These instances are copies of the FuzzyTerms used to construct the FuzzyRule. This is one reason why each FuzzyTerm subclass must implement the virtual constructor method Clone.
Here’s the listing so you can see exactly what’s going on.
public:
FuzzyRule(FuzzyTerm& ant,
FuzzyTerm& con):m_pAntecedent(ant.Clone()), m_pConsequence(con.Clone()) {}Okay, I think that’s enough comment on the design of classes used to create and execute fuzzy rules. If you want to dig into the guts a little further, I
advise you to check out the implementation of the FzAND, FzOR, FzVery, and
TLFeBOOK
Fuzzy Logic | 449
Continuing with the code shown earlier in this section, here is how the rule base for the rocket launcher can be added to the fuzzy module:
/* first initialize the fuzzy module with FLVs */