我是 C++ 新手,请如果有人可以提供这些错误的指导/见解。这会有很大帮助。
以下代码fuzzyex1.cpp:
#include "fuzzyvar.h"
TControlVariable TEMPERATURE(0,1,1200);
TFuzzySet
COLD = TEMPERATURE.Trapezoid(0,0,300,500),
COOL = TEMPERATURE.Trapezoid(100,300,500,700),
TEPID = TEMPERATURE.Trapezoid(300,500,700,900),
WARM = TEMPERATURE.Trapezoid(500,700,900,1100),
HOT = TEMPERATURE.Trapezoid(700,900,1200,1200);
TSolutionVariable POWER(0,1,100);
TFuzzySet
LOW = POWER.Trapezoid(0,0,30,50),
MEDIUM = POWER.Triangle(30,50,70),
HIGH = POWER.Trapezoid(50,70,100,100);
void FuzzyController(float Temperature, float &Power)
{
TEMPERATURE = Temperature;
If (TEMPERATURE is COLD) then (POWER should be HIGH);
If (TEMPERATURE is TEPID) then (POWER should be MEDIUM);
If (TEMPERATURE is WARM) then (POWER should be LOW);
Power = POWER.Defuzzification();
}
给出以下错误:
fuzzyex1.cpp:6: error: no matching function for call to TFuzzySet::TFuzzySet(TFuzzySet)’
fuzzyset.h:14: note: candidates are: TFuzzySet::TFuzzySet(TFuzzySet&)
fuzzyset.h:13: note: TFuzzySet::TFuzzySet(TUniverse*)
fuzzyset.h:12: note: TFuzzySet::TFuzzySet()
fuzzyex1.cpp:7: error: no matching function for call to TFuzzySet::TFuzzySet(TFuzzySet)’
fuzzyset.h:14: note: candidates are: TFuzzySet::TFuzzySet(TFuzzySet&)
fuzzyset.h:13: note: TFuzzySet::TFuzzySet(TUniverse*)
fuzzyset.h:12: note: TFuzzySet::TFuzzySet()
等等类似的代码行。
模糊集.h 如下:
#include "membership.h"
#include "universe.h"
class TFuzzySet
{
protected:
TMembershipDegree *Membership;
TUniverse *Universe;
unsigned Size;
public:
TFuzzySet();
TFuzzySet(TUniverse *AUniverse);
TFuzzySet(TFuzzySet &Set);
void SetUniverse(TUniverse *AUniverse);
TUniverse *GetUniverse();
TMembershipDegree &operator [](unsigned Index);
TMembershipDegree MembershipDegree(float Valor);
void Clear();
TFuzzySet operator or(TFuzzySet &Op2);
TFuzzySet operator and(TFuzzySet &Op2);
TFuzzySet operator not();
TFuzzySet operator and(TMembershipDegree &Op2);
TFuzzySet &operator =(TFuzzySet &Op);
~TFuzzySet() ;
};
class TSolutionFuzzySet : public TFuzzySet
{
public:
TSolutionFuzzySet();
TSolutionFuzzySet(TUniverse *AUniverse);
TSolutionFuzzySet &operator=(TFuzzySet &Op);
float Sum();
float WeightedSum();
float Centroid();
float MaxMean() ;
};