Esempio n. 1
0
/**
 * Description not yet available.
 * \param
 */
dvariable nograd_assign(double tmp)
{
  kkludge_object kg;
  dvariable tmpout(kg);
  value(tmpout)=tmp;
  return tmpout;
}
Esempio n. 2
0
QCString getMscImageMapFromFile(const QCString& inFile, const QCString& outDir,
                                const QCString& relPath,const QCString& context)
{
  QCString outFile = inFile + ".map";

  // chdir to the output dir, so dot can find the font file.
  QCString oldDir = convertToQCString(QDir::currentDirPath());
  // go to the html output directory (i.e. path)
  QDir::setCurrent(outDir);
  //printf("Going to dir %s\n",QDir::currentDirPath().data());

  QCString mscExe = Config_getString("MSCGEN_PATH")+"mscgen"+portable_commandExtension();
  QCString mscArgs = "-T ismap -i \"";
  mscArgs+=inFile + ".msc\" -o \"";
  mscArgs+=outFile + "\"";

  int exitCode;
  portable_sysTimerStart();
  if ((exitCode=portable_system(mscExe,mscArgs,FALSE))!=0)
  {
    portable_sysTimerStop();
    QDir::setCurrent(oldDir);
    return "";
  }
  portable_sysTimerStop();
  
  QString result;
  QTextOStream tmpout(&result);
  convertMapFile(tmpout, outFile, relPath, context);
  QDir().remove(outFile);

  QDir::setCurrent(oldDir);
  return result.data();
}
Esempio n. 3
0
vector<float>
FuzzyRule::FuzzyOutput_average(const vector<float>& a) const
{
    //check the input dimension
    assert(a.len()==variableSize);
    //check whethe the rule is activated
    if (checkRuleActive(a) !=1)
    {
        fprintf(stderr,"try to use unactivated rule\n");
        exit(1);
    }
    float ave=0.0;
    int tmp=0;
    for (int i=0;i<variableSize;i++)
    {
        if (inputSetFlag[i]!=0)
        {
	 ave +=inputVariable[i].output(a[i],inputSetFlag[i]);
	 tmp++;
        }
    }
    ave =ave/tmp;
    int outflag=0;
    vector<float> tmpout(outputSize);
    for (i=0;i<outputSize;i++)
    {
        if (outputSetFlag[i] ==0)
        {
	 outflag++;
	 tmpout[i]=0.0;
        }
        else
        {
	 if (outputSetFlag[i]>0)
	     tmpout[i]=ave;
	 else
	 {
	     if (ave>=0.9999)                       
		tmpout[i]=0.0001;
	     else
		tmpout[i]=1-ave;
	 }
        }
    }
    if (outflag==outputSize)
    {
        cout<<"output flag can't be zero for all output variables"<<endl;
        cout<<"before using rule, check whether it is feasible or not"<<endl;
        cout<<"fuzzyrul.cpp,  line 335"<<endl;
        exit(1);
    }
    return tmpout;
}
Esempio n. 4
0
vector<float>
FuzzyRule::FuzzyOutput_average(const vector<float>& a) const
{
    //check the input dimension
    assert(a.len()==variableSize);

    //check whethe the rule is activated
    if (checkRuleActive(a) !=1)
    {
        fprintf(stderr,"try to use unactivated rule\n");
        exit(1);
    }

    float ave=0.0;
    int tmp=0;
    for (int i=0;i<variableSize;i++)
    {
        if (inputSetFlag[i]!=0)
        {
	 ave +=inputVariable[i].output(a[i],inputSetFlag[i]);
	 tmp++;
        }
    }
    ave =ave/tmp;

    vector<float> tmpout(outputSize);
    for (i=0;i<outputSize;i++)
    {
        if (outputSetFlag[i] ==0)
	 tmpout[i]=0.0;
        else
        {
	 if (outputSetFlag[i]>0)
	     tmpout[i]=ave;
	 else
	 {
	     if (ave>=0.9999)
		tmpout[i]=0.0001;
	     else
		tmpout[i]=1-ave;
	 }
        }
    }

    return tmpout;
}
Esempio n. 5
0
// Listing 8.9 Implementation of method FuzzyOutput() in class FuzzyRule
vector<float>
FuzzyRule::FuzzyOutput(const vector<float>& a) const
{
    //check the input dimension
    assert(a.len()==variableSize);

    //check whethe the rule is activated
    if (checkRuleActive(a) !=1)
    {
        fprintf(stderr,"try to use unactivated rule\n");
        exit(1);
    }

    float min=1.0,tmp;

    for (int i=0;i<variableSize;i++)
    {
        if (inputSetFlag[i]!=0)
        {
	 tmp=inputVariable[i].output(a[i],inputSetFlag[i]);
            if (min>tmp)
	     min=tmp;	//get the minimum value
        }
    }

    vector<float> tmpout(outputSize);
    for (i=0;i<outputSize;i++)
    {
        if (outputSetFlag[i] ==0)
	 tmpout[i]=0.0;
        else
        {
	 if (outputSetFlag[i]>0)
	     tmpout[i]=min;
	 else
	 {
	     if (min>=0.9999)
		tmpout[i]=0.0001;
	     else
		tmpout[i]=1-min;
	 }
        }
    }

    return tmpout;
}