From d422e4778da5b03feec10a48c409d0769ddec38e Mon Sep 17 00:00:00 2001 From: Emmanuel Benazera Date: Sun, 7 Mar 2021 11:19:54 +0100 Subject: [PATCH] feat(python): best sol candidate in phenotype space --- python/lcmaes.cc | 11 +++++++++++ python/ptest_bounds.py | 2 ++ 2 files changed, 13 insertions(+) diff --git a/python/lcmaes.cc b/python/lcmaes.cc index 83f99e6d..cd1953b2 100644 --- a/python/lcmaes.cc +++ b/python/lcmaes.cc @@ -97,6 +97,16 @@ boost::python::list get_candidate_x(const Candidate &c) return x; } +boost::python::list get_best_candidate_pheno(const CMASolutions &s, + const GenoPheno &gp) +{ + boost::python::list gpx; + dVec d = gp.pheno(s.best_candidate().get_x_dvec()); + for (int i=0;i>("GenoPhenoNB","genotype/phenotype transformation object for problem with unbounded parameters") diff --git a/python/ptest_bounds.py b/python/ptest_bounds.py index e0332b92..0d104190 100644 --- a/python/ptest_bounds.py +++ b/python/ptest_bounds.py @@ -25,8 +25,10 @@ def nfitfunc(x,n): # collect and inspect results bcand = cmasols.best_candidate() +bcand_pheno = lcmaes.get_best_candidate_pheno(cmasols,gp) bx = lcmaes.get_candidate_x(bcand) print("best x=",bx) +print('best x in phenotype space=',bcand_pheno) print("distribution mean=",lcmaes.get_solution_xmean(cmasols)) cov = lcmaes.get_solution_cov(cmasols) # numpy array print("cov=",cov)