9 #ifndef YARP_MANAGER_BINEXPARSER
10 #define YARP_MANAGER_BINEXPARSER
38 sprintf(str,
"%s%d", opd,
node_id++);
49 sprintf(str,
"%s%d", opt,
node_id++);
85 const char*
getName() {
return strName.c_str(); }
104 bool parse(std::string _exp);
108 validOperands.push_back(opnd);
121 bool evalTree(
BinaryNodePtr node, std::map<std::string, bool>& opnd);
123 bool checkExpression(std::string& strexp);
124 void parseExpression(std::string &strexp,
BinaryNodePtr& node);
127 std::string getNextOperand(std::string &strexp);
128 std::string popNextOperand(std::string &strexp);
129 void createTruthTable(
const int n);
130 void printTruthTable(std::string lopr);
134 std::string expression;
138 std::map<std::string, bool> operands;
139 std::vector<std::string> validOperands;
140 std::vector<std::string> invalidOperands;
141 std::vector<std::vector<int> > truthTable;
151 maxIteration(max_itr),
152 trainRate(train_rate),
158 bool train(
const std::vector<std::vector<int> > &truthTable);
160 const std::vector<double> &
getAlphas() {
return alphas; }
161 const std::vector<double> &
getErrors() {
return errors; }
167 std::vector<double> alphas;
168 std::vector<double> errors;
177 #endif // __YARP_MANAGER_BINEXPARSER____