Skip to content

Commit

Permalink
Merge pull request #466 from SchwarzschildX/master
Browse files Browse the repository at this point in the history
fixed cstrs_self_adpative integer problem handling #465
  • Loading branch information
bluescarni authored Dec 27, 2021
2 parents 121ec57 + a08dd68 commit cd209f3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/pagmo/algorithms/cstrs_self_adaptive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ struct PAGMO_DLL_PUBLIC penalized_udp {
// The bounds are unchanged
std::pair<vector_double, vector_double> get_bounds() const;

// The integer dimension is unchanged
vector_double::size_type get_nix() const;

// The fitness computation
vector_double fitness(const vector_double &) const;

Expand Down
6 changes: 6 additions & 0 deletions src/algorithms/cstrs_self_adaptive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ std::pair<vector_double, vector_double> penalized_udp::get_bounds() const
return m_pop_ptr->get_problem().get_bounds();
}

// The integer dimension is unchanged
vector_double::size_type penalized_udp::get_nix() const
{
return m_pop_ptr->get_problem().get_nix();
}

// The fitness computation
vector_double penalized_udp::fitness(const vector_double &x) const
{
Expand Down
1 change: 1 addition & 0 deletions tests/cstrs_self_adaptive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ BOOST_AUTO_TEST_CASE(penalized_problem_construction)
BOOST_CHECK_EQUAL(udp_p.m_f_hat_down.size(), udp.get_nf());
BOOST_CHECK_EQUAL(udp_p.m_f_hat_up.size(), udp.get_nf());
BOOST_CHECK_EQUAL(udp_p.m_f_hat_round.size(), udp.get_nf());
BOOST_CHECK_EQUAL(udp_p.get_nix(), udp.get_nix());
BOOST_CHECK_EQUAL(udp_p.m_fitness_map.size(), NP);
// We also test get bounds here
BOOST_CHECK(udp_p.get_bounds() == udp.get_bounds());
Expand Down

0 comments on commit cd209f3

Please sign in to comment.