fix(moBinaryPartition): finalize integration in <mo>

This commit is contained in:
Johann Dreo 2024-09-10 20:26:36 +02:00
commit cf086ea9b9
6 changed files with 23 additions and 9 deletions

View file

@ -184,6 +184,10 @@
#include <problems/permutation/moTwoOptExNeighbor.h>
#include <problems/permutation/moTwoOptExNeighborhood.h>
#include <problems/partition/moBinaryPartition.h>
#include <problems/partition/moBinaryPartitionSwapNeighbor.h>
#include <problems/partition/moBinaryPartitionSwapNeighborhood.h>
//#include <problems/eval/moMaxSATincrEval.h>
//#include <problems/eval/moOneMaxIncrEval.h>
//#include <problems/eval/moQAPIncrEval.h>
@ -193,7 +197,6 @@
//#include <problems/eval/moUBQPBitsIncrEval.h>
//#include <problems/eval/moNKlandscapesIncrEval.h>
#include <sampling/moAdaptiveWalkSampling.h>
#include <sampling/moAutocorrelationSampling.h>
#include <sampling/moDensityOfStatesSampling.h>

View file

@ -75,7 +75,11 @@ class moBinaryPartition : public EO<FitT>
* @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<FitT>
* @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 =

View file

@ -3,7 +3,6 @@
#include <utility>
#include <mo>
#include "moBinaryPartition.h"
/** Stable neighbor for a binary partition.

View file

@ -87,8 +87,13 @@ class moBinaryPartitionSwapNeighborhood : public moNeighborhood<moBinaryPartitio
// << " from: " << from
// << std::endl;
assert( from.rejected.contains(selected(from,i_select)) );
assert( from.selected.contains(rejected(from,j_reject)) );
#if __cplusplus >= 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.

View file

@ -96,6 +96,7 @@ set (TEST_LIST
t-moIndexedVectorTabuList
# t-moRndIndexedVectorTabuList
t-moDynSpanCoolingSchedule
t-moBinaryPartition
)
######################################################################################

View file

@ -1,7 +1,5 @@
#include <frictionless/moBinaryPartition.h>
#include <frictionless/moBinaryPartitionSwapNeighbor.h>
#include <frictionless/moBinaryPartitionSwapNeighborhood.h>
#include <mo>
int main()
{