diff --git a/mo/src/mo.h b/mo/src/mo.h index 3f44d2df7..f936b646d 100755 --- a/mo/src/mo.h +++ b/mo/src/mo.h @@ -184,6 +184,10 @@ #include #include +#include +#include +#include + //#include //#include //#include @@ -193,7 +197,6 @@ //#include //#include - #include #include #include diff --git a/mo/src/problems/partition/moBinaryPartition.h b/mo/src/problems/partition/moBinaryPartition.h index df5fed9fa..7feaef0b3 100644 --- a/mo/src/problems/partition/moBinaryPartition.h +++ b/mo/src/problems/partition/moBinaryPartition.h @@ -75,7 +75,11 @@ class moBinaryPartition : public EO * @note In debug mode, double check that elements were actually moved. */ void select(const size_t atom) { - assert(not selected.contains(atom)); + #if __cplusplus >= 202002L + assert(not selected.contains(atom)); + #else + assert(selected.count(atom) == 0); + #endif #ifndef NDEBUG size_t has_erased = @@ -98,7 +102,11 @@ class moBinaryPartition : public EO * @note In debug mode, double check that elements were actually moved. */ void reject(const size_t atom) { - assert(not rejected.contains(atom)); + #if __cplusplus >= 202002L + assert(not rejected.contains(atom)); + #else + assert(rejected.count(atom) == 0); + #endif #ifndef NDEBUG size_t has_erased = diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h index 915831122..8f6bc601c 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighbor.h @@ -3,7 +3,6 @@ #include #include - #include "moBinaryPartition.h" /** Stable neighbor for a binary partition. diff --git a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h index f91b252da..d51325b26 100644 --- a/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h +++ b/mo/src/problems/partition/moBinaryPartitionSwapNeighborhood.h @@ -87,8 +87,13 @@ class moBinaryPartitionSwapNeighborhood : public moNeighborhood= 202002L + assert( from.rejected.contains(selected(from,i_select)) ); + assert( from.selected.contains(rejected(from,j_reject)) ); + #else + assert( from.rejected.count(selected(from,i_select)) > 0 ); + assert( from.selected.count(rejected(from,j_reject)) > 0 ); + #endif assert( selected(from,i_select) != rejected(from,j_reject) ); // Implant this move in the neighbor. diff --git a/mo/test/CMakeLists.txt b/mo/test/CMakeLists.txt index a27f97db9..184cdb651 100644 --- a/mo/test/CMakeLists.txt +++ b/mo/test/CMakeLists.txt @@ -96,6 +96,7 @@ set (TEST_LIST t-moIndexedVectorTabuList # t-moRndIndexedVectorTabuList t-moDynSpanCoolingSchedule + t-moBinaryPartition ) ###################################################################################### diff --git a/mo/test/t-moBinaryPartition.cpp b/mo/test/t-moBinaryPartition.cpp index 873d245bb..3300c83bf 100644 --- a/mo/test/t-moBinaryPartition.cpp +++ b/mo/test/t-moBinaryPartition.cpp @@ -1,7 +1,5 @@ -#include -#include -#include +#include int main() {