51 if (_scalingstrategy._id)
55 std::vector<double>
lb(dim,_scalingstrategy._intmin);
56 std::vector<double>
ub(dim,_scalingstrategy._intmax);
65 if (_scalingstrategy._id)
69 std::vector<double>
lb(dim,_scalingstrategy._intmin);
70 std::vector<double>
ub(dim,_scalingstrategy._intmax);
98 dMat pheno_candidates(
const dMat &candidates)
const
102 dMat ncandidates = dMat(candidates.rows(),candidates.cols());
103#pragma omp parallel for if (candidates.cols() >= 100)
104 for (
int i=0;i<candidates.cols();i++)
106 dVec ext = dVec(candidates.rows());
107 _phenof(candidates.col(i).data(),ext.data(),candidates.rows());
108 ncandidates.col(i) = ext;
115 dMat geno_candidates(
const dMat &candidates)
const
119 dMat ncandidates = dMat(candidates.rows(),candidates.cols());
120#pragma omp parallel for if (candidates.cols() >= 100)
121 for (
int i=0;i<candidates.cols();i++)
123 dVec in = dVec(candidates.rows());
124 _genof(candidates.col(i).data(),in.data(),candidates.rows());
125 ncandidates.col(i) = in;
133 dMat pheno(
const dMat &candidates)
const
136 dMat ncandidates = pheno_candidates(candidates);
139#pragma omp parallel for if (ncandidates.cols() >= 100)
140 for (
int i=0;i<ncandidates.cols();i++)
143 _boundstrategy.to_f_representation(ncandidates.col(i),ycoli);
144 ncandidates.col(i) = ycoli;
148 if (!_scalingstrategy._id)
150#pragma omp parallel for if (ncandidates.cols() >= 100)
151 for (
int i=0;i<ncandidates.cols();i++)
154 _scalingstrategy.scale_to_f(ncandidates.col(i),ycoli);
155 ncandidates.col(i) = ycoli;
161 dMat geno(
const dMat &candidates)
const
164 dMat ncandidates = candidates;
165 if (!_scalingstrategy._id)
167#pragma omp parallel for if (ncandidates.cols() >= 100)
168 for (
int i=0;i<ncandidates.cols();i++)
171 _scalingstrategy.scale_to_internal(ycoli,ncandidates.col(i));
172 ncandidates.col(i) = ycoli;
177#pragma omp parallel for if (ncandidates.cols() >= 100)
178 for (
int i=0;i<ncandidates.cols();i++)
181 _boundstrategy.to_internal_representation(ycoli,ncandidates.col(i));
182 ncandidates.col(i) = ycoli;
186 ncandidates = geno_candidates(ncandidates);
190 dVec pheno(
const dVec &candidate)
const
196 ncandidate = dVec(candidate.rows());
197 _phenof(candidate.data(),ncandidate.data(),candidate.rows());
201 dVec phen = dVec::Zero(candidate.rows());
203 _boundstrategy.to_f_representation(candidate,phen);
204 else _boundstrategy.to_f_representation(ncandidate,phen);
207 if (!_scalingstrategy._id)
209 dVec sphen = dVec::Zero(phen.rows());
210 _scalingstrategy.scale_to_f(phen,sphen);
216 dVec geno(
const dVec &candidate)
const
218 dVec ccandidate = candidate;
219 dVec gen = dVec::Zero(candidate.rows());
222 if (!_scalingstrategy._id)
224 _scalingstrategy.scale_to_internal(gen,candidate);
229 _boundstrategy.to_internal_representation(gen,ccandidate);
234 dVec ncandidate(gen.rows());
235 _genof(gen.data(),ncandidate.data(),gen.rows());
241 TBoundStrategy get_boundstrategy()
const {
return _boundstrategy; }
243 TBoundStrategy& get_boundstrategy_ref() {
return _boundstrategy; }
245 TScalingStrategy get_scalingstrategy()
const {
return _scalingstrategy; }
247 void remove_dimensions(
const std::vector<int> &k)
249 if (!_scalingstrategy.is_id())
250 _scalingstrategy.remove_dimensions(k);
251 if (!_boundstrategy.is_id())
252 _boundstrategy.remove_dimensions(k);
256 TBoundStrategy _boundstrategy;
GenoPheno(const dVec &scaling, const dVec &shift, const double *lbounds=nullptr, const double *ubounds=nullptr)
this is a dummy constructor to accomodate an easy to use linear scaling with pwq bounds from a given ...
Definition genopheno.h:83