34 std::map<std::string, double> w;
42 rules.erase(rules.find(con));
43 alphas.erase(alphas.find(con));
44 biases.erase(biases.find(con));
67 std::string rule =
getRule(opnd);
70 std::map<std::string, double> w;
77 std::map<std::string, std::string>::iterator itr;
78 for (itr = rules.begin(); itr != rules.end(); itr++) {
83 rule = std::string(opnd) +
" : " + rule;
84 if (!parser.
parse(rule)) {
92 biases[opnd] = trainer.
getBias();
94 std::vector<double> alf = trainer.
getAlphas();
95 std::map<std::string, double> w;
97 std::map<std::string, bool>::iterator itr;
98 std::map<std::string, bool> operands = parser.
getOperands();
100 for(itr=operands.begin(); itr!=operands.end(); itr++)
102 w[itr->first] = alf[i];
109 logger->
addError(
"Maximum number of iterations is reached without finding any solution. Check for the correctness of the expression logic.");
121 std::map<std::string, std::string>::iterator itr;
122 for (itr = rules.begin(); itr != rules.end(); itr++) {
139 int n = alphas.size();
145 std::map<std::string, std::map<std::string, double> >::iterator itr;
146 std::map<std::string, std::map<std::string, double> >::iterator jtr;
149 for(itr=alphas.begin(); itr!=alphas.end(); itr++)
151 std::map<std::string, double>& w = itr->second;
153 for(jtr=alphas.begin(); jtr!=alphas.end(); jtr++)
155 std::string opnd = jtr->first;
156 if (w.find(opnd) != w.end()) {
157 A(row,col) = w[opnd];
171 for(
size_t i=0; i<real.
size(); i++)
173 if((
float)fabs(real[i]) >= 1.0)
176 logger->
addError(
"Inconsistency in logical expressions. This will result an unstable arbitration system!");
215 logger->
addWarning(
"Yarpmanager is compiled without libYarpMath. Your compact logical expression might result an unstable arbitration system!");
contains the definition of a Matrix type
contains the definition of a Vector type
void addRule(const char *con, const char *rule)
Class Arbitrator.
const char * getRule(const char *con)
void removeRule(const char *con)
const std::vector< std::vector< int > > & getTruthTable()
void addRestrictedOperand(const char *opnd)
bool parse(std::string _exp)
const std::map< std::string, bool > & getOperands()
Singleton class ErrorLogger.
void addError(const char *szError)
void addWarning(const char *szWarning)
static ErrorLogger * Instance()
Singleton class ErrorLogger.
bool train(const std::vector< std::vector< int > > &truthTable)
const std::vector< double > & getAlphas()
bool eigenValues(const yarp::sig::Matrix &in, yarp::sig::Vector &real, yarp::sig::Vector &img)
Computes eigenvalues of the n-by-n real nonsymmetric matrix (defined in Math.h).
#define __CHECK_NULLPTR(_ptr)