Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Ensure that denormalize input is valid. #127

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/problem/normalized.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ decision_vector normalized::denormalize(const decision_vector& x) const
{
decision_vector retval(x.size(), 0);
for(base::size_type i = 0; i < x.size(); ++i){
if (x[i] < -1.0 || x[i] > 1.0) {
pagmo_throw(value_error, "Vector values must be between -1 and 1.");
}
retval[i] = (x[i] * m_normalization_scale[i]) + m_normalization_center[i];
}
return retval;
Expand Down