double match(const nvar& v, bool full){ //cout << "attrs_ is: " << attrs_ << endl; //cout << "v is: " << v << endl; if(attrs_["in"] != v["in"]){ //cout << "f1" << endl; return -1; } if(attrs_["out"] && !v["out"]){ //cout << "a is: " << attrs_.out << endl; //cout << "b is: " << v.out << endl; //cout << "f2" << endl; return -1; } if(attrs_.hasKey("vec")){ if(!v.hasKey("vec") && attrs_["vec"] != undef){ return -1; } } else if(v.hasKey("vec")){ return -1; } if(attrs_.hasKey("set")){ if(!v.hasKey("set") && attrs_["set"] != undef){ return -1; } } else if(v.hasKey("set")){ return -1; } if(full){ if(attrs_.hasKey("takeCloneOf")){ if(!v.hasKey("cloneOf")){ //cout << "f5" << endl; return -1; } if(attrs_["takeCloneOf"] != v["cloneOf"]){ //cout << "f6" << endl; return -1; } } } else{ return 1; } // no age bias for right now return 1; if(v["age"] > 100){ return -1; } double m = pow((100.0 - v["age"])/50.0, 2.0); //cout << "m is: " << m << endl; return m; }