26 return fmt::format(
"{:.2f}*{}",W,feature);
32 return fmt::format(
"{:.2f}", W);
37 return fmt::format(
"{:.2f}*{}", W, feature);
42 return fmt::format(
"{}+Sum", W);
45 return fmt::format(
"{:.2f}*{}",W,name);
55 return fmt::format(
"If({}>{:.2f},{},{})",
66 return fmt::format(
"If({},{},{})",
73 return fmt::format(
"If({}>{:.2f},{},{})",
82 string args = fmt::format(
"{},", W);
90 return fmt::format(
"Sum({})",
args);
100 return fmt::format(
"{}({})", get_name(),
args);
114 {
"center_op",
p.center_op},
115 {
"prob_change",
p.prob_change},
117 {
"node_type",
p.node_type},
118 {
"sig_hash",
p.sig_hash},
119 {
"sig_dual_hash",
p.sig_dual_hash},
120 {
"ret_type",
p.ret_type},
121 {
"arg_types",
p.arg_types},
122 {
"is_weighted",
p.is_weighted},
124 {
"feature",
p.get_feature()}
203 auto msg = fmt::format(
"Can't infer arguments for {} from json."
204 " Please provide them.\n",
n);
211 node.set_signature<
Signature<ArrayXf(ArrayXf,ArrayXf,ArrayXf)>>();
222 if (
j.contains(
"node_type"))
223 j.at(
"node_type").get_to(
p.node_type);
227 if (
j.contains(
"name"))
228 j.at(
"name").get_to(
p.name);
232 if (
j.contains(
"center_op"))
233 j.at(
"center_op").get_to(
p.center_op);
235 if (
j.contains(
"fixed"))
236 j.at(
"fixed").get_to(
p.fixed);
238 if (
j.contains(
"feature"))
241 p.set_feature(
j.at(
"feature"));
243 if (
j.contains(
"is_weighted"))
244 j.at(
"is_weighted").get_to(
p.is_weighted);
248 if (
j.contains(
"prob_change"))
249 j.at(
"prob_change").get_to(
p.prob_change);
254 bool make_signature=
false;
256 if (
j.contains(
"ret_type"))
257 j.at(
"ret_type").get_to(
p.ret_type);
260 if (
j.contains(
"arg_types"))
261 j.at(
"arg_types").get_to(
p.arg_types);
264 if (
j.contains(
"sig_hash"))
265 j.at(
"sig_hash").get_to(
p.sig_hash);
268 if (
j.contains(
"sig_dual_hash"))
269 j.at(
"sig_dual_hash").get_to(
p.sig_dual_hash);
279 j.at(
"W").get_to(
p.W);
void bind_engine(py::module &m, string name)
#define HANDLE_ERROR_THROW(err)
< nsga2 selection operator for getting the front
ostream & operator<<(ostream &os, DataType n)
Eigen::Array< bool, Eigen::Dynamic, 1 > ArrayXb
void from_json(const json &j, Fitness &f)
auto Is(NodeType nt) -> bool
void to_json(json &j, const Fitness &f)
void init_node_with_default_signature(Node &node)
std::map< NodeType, std::string > NodeTypeName
class holding the data for a node in a tree.
string get_name(bool include_weight=true) const noexcept
gets a string version of the node for printing.
string get_model(const vector< string > &) const noexcept