Skip to content

Commit cd209f3

Browse files
authored
Merge pull request #466 from SchwarzschildX/master
fixed cstrs_self_adpative integer problem handling #465
2 parents 121ec57 + a08dd68 commit cd209f3

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

include/pagmo/algorithms/cstrs_self_adaptive.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ struct PAGMO_DLL_PUBLIC penalized_udp {
9696
// The bounds are unchanged
9797
std::pair<vector_double, vector_double> get_bounds() const;
9898

99+
// The integer dimension is unchanged
100+
vector_double::size_type get_nix() const;
101+
99102
// The fitness computation
100103
vector_double fitness(const vector_double &) const;
101104

src/algorithms/cstrs_self_adaptive.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ std::pair<vector_double, vector_double> penalized_udp::get_bounds() const
8080
return m_pop_ptr->get_problem().get_bounds();
8181
}
8282

83+
// The integer dimension is unchanged
84+
vector_double::size_type penalized_udp::get_nix() const
85+
{
86+
return m_pop_ptr->get_problem().get_nix();
87+
}
88+
8389
// The fitness computation
8490
vector_double penalized_udp::fitness(const vector_double &x) const
8591
{

tests/cstrs_self_adaptive.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ BOOST_AUTO_TEST_CASE(penalized_problem_construction)
6565
BOOST_CHECK_EQUAL(udp_p.m_f_hat_down.size(), udp.get_nf());
6666
BOOST_CHECK_EQUAL(udp_p.m_f_hat_up.size(), udp.get_nf());
6767
BOOST_CHECK_EQUAL(udp_p.m_f_hat_round.size(), udp.get_nf());
68+
BOOST_CHECK_EQUAL(udp_p.get_nix(), udp.get_nix());
6869
BOOST_CHECK_EQUAL(udp_p.m_fitness_map.size(), NP);
6970
// We also test get bounds here
7071
BOOST_CHECK(udp_p.get_bounds() == udp.get_bounds());

0 commit comments

Comments
 (0)