if (maxDepth <= 0)
p = pBinary + pUnary + (pVar + pConst) * rand.nextDouble();
else
p = rand.nextDouble();
if (p < pBinary) {
FuzzyExpression arg1 = getRandomExpression(variables, pBinary, pUnary, pVar, pConst, maxDepth - 1);
FuzzyExpression arg2 = getRandomExpression(variables, pBinary, pUnary, pVar, pConst, maxDepth - 1);
double p2 = rand.nextDouble();
if (p2 < 0.33)
return new FuzzyBinaryExpression(arg1, arg2, new TW());
else if (p2 < 0.66)
return new FuzzyBinaryExpression(arg1, arg2, new IW());
else
return new FuzzyBinaryExpression(arg1, arg2, new SW());
}
else if (p < pBinary + pUnary) {
FuzzyExpression arg1 = getRandomExpression(variables, pBinary, pUnary, pVar, pConst, maxDepth - 1);
return new FuzzyUnaryExpression(arg1, new N());
}
else if (p < pBinary + pUnary + pVar)
return new FuzzyVariableExpression(variables.get(rand.nextInt(variables.size())));
else {