Skip to content

Commit

Permalink
fix in ParameterEnsemble::zeros_like()
Browse files Browse the repository at this point in the history
  • Loading branch information
jtwhite79 committed Apr 22, 2024
1 parent 87f466d commit 7cc32d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/libs/pestpp_common/Ensemble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2166,10 +2166,18 @@ ParameterEnsemble ParameterEnsemble::zeros_like(int nrows)
if (nrows < 0)
nrows = real_names.size();
Eigen::MatrixXd new_reals = Eigen::MatrixXd::Zero(nrows, var_names.size());

stringstream ss;
vector<string> new_real_names;
for (int i = 0; i < nrows; i++)
new_real_names.push_back(real_names[i]);
if (i < real_names.size())
new_real_names.push_back(real_names[i]);
else
{
ss.str("");
ss << "zeros_like_real_" << i;
new_real_names.push_back(ss.str());
}


ParameterEnsemble new_en(pest_scenario_ptr, rand_gen_ptr);
new_en.from_eigen_mat(new_reals, new_real_names, var_names);
Expand Down
2 changes: 1 addition & 1 deletion src/libs/pestpp_common/MOEA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ void ParetoObjectives::update(ObservationEnsemble& op, ParameterEnsemble& dp, Co
// the 'false' arg is to not apply risk shifting to the satisfaction calcs since
// 'op' has already been shifted
violations = constraints_ptr->get_unsatified_obs_constraints(obs, 0.0, false);
end = obs_obj_set.end()=;
end = obs_obj_set.end();
for (auto v : violations) {
if (obs_obj_set.find(v.first) == end)
vsum += pow(v.second * oi->get_weight(v.first), 2);
Expand Down

0 comments on commit 7cc32d2

Please sign in to comment.