moved utilities and contribution in branchez
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2183 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
6c3383d718
commit
8280cf082b
1346 changed files with 0 additions and 0 deletions
11
branches/contribution/branches/MOLS/.project
Normal file
11
branches/contribution/branches/MOLS/.project
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>MOLS</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
124
branches/contribution/branches/MOLS/CMakeLists.txt
Normal file
124
branches/contribution/branches/MOLS/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
######################################################################################
|
||||
### CMake basic configuration
|
||||
######################################################################################
|
||||
|
||||
# check cmake version compatibility
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
|
||||
# regular expression checking
|
||||
INCLUDE_REGULAR_EXPRESSION("^.*$" "^$")
|
||||
|
||||
# set a language for the entire project.
|
||||
ENABLE_LANGUAGE(CXX)
|
||||
ENABLE_LANGUAGE(C)
|
||||
|
||||
#####################################################################################
|
||||
### Include required modules & utilities
|
||||
#####################################################################################
|
||||
INCLUDE(CMakeBackwardCompatibilityCXX)
|
||||
|
||||
INCLUDE(FindDoxygen)
|
||||
|
||||
INCLUDE(CheckLibraryExists)
|
||||
|
||||
INCLUDE(Dart OPTIONAL)
|
||||
|
||||
# Set a special flag if the environment is windows (should do the same in a config.g file)
|
||||
IF (WIN32)
|
||||
ADD_DEFINITIONS(-D_WINDOWS=1)
|
||||
ENDIF (WIN32)
|
||||
######################################################################################
|
||||
|
||||
|
||||
#####################################################################################
|
||||
### Manage the build type
|
||||
#####################################################################################
|
||||
|
||||
# the user should choose the build type on windows environments,excepted under cygwin (default=none)
|
||||
SET(CMAKE_DEFAULT_BUILD_TYPE "Debug" CACHE STRING "Variable that stores the default CMake build type" FORCE)
|
||||
|
||||
FIND_PROGRAM(MEMORYCHECK_COMMAND
|
||||
NAMES purify valgrind
|
||||
PATHS
|
||||
"/usr/local/bin /usr/bin [HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
|
||||
DOC "Path to the memory checking command, used for memory error detection.")
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET( CMAKE_BUILD_TYPE
|
||||
${CMAKE_DEFAULT_BUILD_TYPE} CACHE STRING
|
||||
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
|
||||
FORCE)
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
IF(WIN32 AND NOT CYGWIN)
|
||||
IF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
IF(NOT WITH_SHARED_LIBS)
|
||||
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008")
|
||||
SET(CMAKE_CXX_FLAGS "/nologo /Gy")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "/W3 /MTd /Z7 /Od")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "/w /MT /O2 /wd4530")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
|
||||
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008")
|
||||
ENDIF(NOT WITH_SHARED_LIBS)
|
||||
ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
ELSE(WIN32 AND NOT CYGWIN)
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -fprofile-arcs -ftest-coverage -Wall -Wextra -Wno-unused-parameter")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -O6")
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
ENDIF(WIN32 AND NOT CYGWIN)
|
||||
|
||||
IF(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
ADD_DEFINITIONS(-DCMAKE_VERBOSE_MAKEFILE=ON)
|
||||
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
|
||||
#####################################################################################
|
||||
|
||||
######################################################################################
|
||||
### compilation of examples?
|
||||
######################################################################################
|
||||
|
||||
SET(ENABLE_CMAKE_EXAMPLE TRUE CACHE BOOL "Enable copy of benchs and parameters file?")
|
||||
|
||||
#######################################################################################
|
||||
### Paths to EO, MO and MOEO must be specified above.
|
||||
#######################################################################################
|
||||
|
||||
SET(PARADISEO_DIR "/home/humeau/Bureau/paradiseo-1.2.1" CACHE PATH "ParadisEO directory" FORCE)
|
||||
|
||||
SET(EO_SRC_DIR "${PARADISEO_DIR}/paradiseo-eo" CACHE PATH "ParadisEO-EO source directory" FORCE)
|
||||
SET(EO_BIN_DIR "${PARADISEO_DIR}/paradiseo-eo/build" CACHE PATH "ParadisEO-EO binary directory" FORCE)
|
||||
|
||||
SET(MO_SRC_DIR "${PARADISEO_DIR}/paradiseo-mo" CACHE PATH "ParadisMO-MO source directory" FORCE)
|
||||
SET(MO_BIN_DIR "${PARADISEO_DIR}/paradiseo-mo/build" CACHE PATH "ParadisMO-MO binary directory" FORCE)
|
||||
|
||||
SET(MOEO_SRC_DIR "${PARADISEO_DIR}/paradiseo-moeo" CACHE PATH "ParadisMOEO-MOEO source directory" FORCE)
|
||||
SET(MOEO_BIN_DIR "${PARADISEO_DIR}/paradiseo-moeo/build" CACHE PATH "ParadisMOEO-MOEO binary directory" FORCE)
|
||||
|
||||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(${MOEO_SRC_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(/home/humeau/workspace/MOLS/src2)
|
||||
INCLUDE_DIRECTORIES(/home/humeau/workspace/MOLS/test)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
######################################################################################
|
||||
### 2) Specify where CMake can find the libraries
|
||||
######################################################################################
|
||||
|
||||
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${MOEO_BIN_DIR}/lib)
|
||||
|
||||
######################################################################################
|
||||
### 3) Define your targets and link the librairies
|
||||
######################################################################################
|
||||
|
||||
ADD_SUBDIRECTORY(src2)
|
||||
ADD_SUBDIRECTORY(test)
|
||||
ADD_SUBDIRECTORY(doc)
|
||||
318
branches/contribution/branches/MOLS/COSEARCH/fspEA.cpp
Executable file
318
branches/contribution/branches/MOLS/COSEARCH/fspEA.cpp
Executable file
|
|
@ -0,0 +1,318 @@
|
|||
//eo
|
||||
#include <eo>
|
||||
#include <eoSwapMutation.h>
|
||||
|
||||
//general
|
||||
#include <string>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <unistd.h>
|
||||
|
||||
// moeo
|
||||
#include <moeo>
|
||||
#include <do/make_continue_moeo.h>
|
||||
#include <do/make_checkpoint_moeo.h>
|
||||
|
||||
// fsp
|
||||
#include <fsp>
|
||||
|
||||
//peo
|
||||
#include <peo>
|
||||
#include <peoAsyncDataTransfer.h>
|
||||
#include <peoSyncDataTransfer.h>
|
||||
#include <core/star_topo.h>
|
||||
#include <peoParallelAlgorithmWrapper.h>
|
||||
#include <core/eoVector_mesg.h>
|
||||
|
||||
//DMLS
|
||||
|
||||
|
||||
#include <moeoTransfer.h>
|
||||
|
||||
void make_help(eoParser & _parser);
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
try{
|
||||
|
||||
eoParser parser(argc, argv); // for user-parameter reading
|
||||
eoState state; // to keep all things allocated
|
||||
|
||||
/*** number of objectives ***/
|
||||
fspObjectiveVectorTraits::nObj = 2;
|
||||
|
||||
/*** parameters ***/
|
||||
eoValueParam<uint32_t>& _seedParam = parser.createParam(uint32_t(0), "seed", "Random number seed", 'S');
|
||||
std::string _file = parser.createParam(std::string(), "file", "", '\0', "Representation", true).value();
|
||||
double _crossRate = parser.createParam((double) 0.05, "crossRate", "Rate for 2-PT crossover", 0, "Variation Operators").value();
|
||||
double _mutRate = parser.createParam((double) 1.0, "mutRate", "Rate for shift mutation", 0, "Variation Operators").value();
|
||||
unsigned int _popSize = parser.createParam((unsigned int)(100), "popSize", "Population Size", 'P', "Evolution Engine").value();
|
||||
std::string _strategy = parser.createParam(std::string(), "explorer", "OneOne - OneAll - AllOne - AllAll - OneFirst - AllFirst - OneND - AllND", '\0', "Evolution Engine", true).value();
|
||||
unsigned int _nbKick = parser.createParam((unsigned int)(10), "nbKick", "Number of kick", 'K', "Evolution Engine").value();
|
||||
|
||||
// seed
|
||||
if (_seedParam.value() == 0)
|
||||
_seedParam.value() = time(0);
|
||||
rng.reseed(_seedParam.value());
|
||||
|
||||
/*** the representation-dependent things ***/
|
||||
|
||||
// load data
|
||||
fspData data(_file);
|
||||
// size
|
||||
unsigned int size = data.getN(); // nb jobs
|
||||
// init
|
||||
fspInit init(size, 0);
|
||||
// eval
|
||||
fspEval simpleEval(data.getM(), data.getN(), data.getP(), data.getD());
|
||||
eoEvalFuncCounter<FSP> eval(simpleEval);
|
||||
// cross
|
||||
fspCross cross;
|
||||
// mut
|
||||
fspMut mut;
|
||||
// op
|
||||
eoSGAGenOp<FSP> op(cross, _crossRate, mut, _mutRate);
|
||||
|
||||
/*** the representation-independent things ***/
|
||||
|
||||
// move init
|
||||
fspMoveInit moveInit;
|
||||
// move next
|
||||
fspMoveNext moveNext;
|
||||
// move incr eval
|
||||
fspMoveIncrEval moveIncrEval(data.getM(), data.getN(), data.getP(), data.getD());
|
||||
|
||||
|
||||
bool multiply=true;
|
||||
moeoPopNeighborhoodExplorer<fspMove> * explorer;
|
||||
moeoUnvisitedSelect<FSP> * selector;
|
||||
if (_strategy == std::string("OneOne"))
|
||||
{
|
||||
selector = new moeoNumberUnvisitedSelect<FSP> (1);
|
||||
explorer = new moeoSimpleSubNeighborhoodExplorer<fspMove> (moveInit, moveNext, moveIncrEval, 1);
|
||||
}
|
||||
else if (_strategy == std::string("OneAll"))
|
||||
{
|
||||
selector = new moeoNumberUnvisitedSelect<FSP> (1);
|
||||
explorer = new moeoExhaustiveNeighborhoodExplorer<fspMove> (moveInit, moveNext, moveIncrEval);
|
||||
}
|
||||
else if (_strategy == std::string("AllOne"))
|
||||
{
|
||||
selector = new moeoExhaustiveUnvisitedSelect<FSP>;
|
||||
explorer = new moeoSimpleSubNeighborhoodExplorer<fspMove> (moveInit, moveNext, moveIncrEval, 1);
|
||||
multiply=false;
|
||||
}
|
||||
else if (_strategy == std::string("AllAll"))
|
||||
{
|
||||
selector = new moeoExhaustiveUnvisitedSelect<FSP>;
|
||||
explorer = new moeoExhaustiveNeighborhoodExplorer<fspMove> (moveInit, moveNext, moveIncrEval);
|
||||
}
|
||||
else if (_strategy == std::string("OneFirst"))
|
||||
{
|
||||
selector = new moeoNumberUnvisitedSelect<FSP> (1);
|
||||
explorer = new moeoFirstImprovingNeighborhoodExplorer<fspMove> (moveInit, moveNext, moveIncrEval);
|
||||
}
|
||||
else if (_strategy == std::string("AllFirst"))
|
||||
{
|
||||
selector = new moeoExhaustiveUnvisitedSelect<FSP>;
|
||||
explorer = new moeoFirstImprovingNeighborhoodExplorer<fspMove> (moveInit, moveNext, moveIncrEval);
|
||||
}
|
||||
else if (_strategy == std::string("OneND"))
|
||||
{
|
||||
selector = new moeoNumberUnvisitedSelect<FSP> (1);
|
||||
explorer = new moeoNoDesimprovingNeighborhoodExplorer<fspMove> (moveInit, moveNext, moveIncrEval);
|
||||
}
|
||||
else if (_strategy == std::string("AllND"))
|
||||
{
|
||||
selector = new moeoExhaustiveUnvisitedSelect<FSP>;
|
||||
explorer = new moeoNoDesimprovingNeighborhoodExplorer<fspMove> (moveInit, moveNext, moveIncrEval);
|
||||
multiply=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid explorer strategy: ") + _strategy;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
state.storeFunctor(selector);
|
||||
state.storeFunctor(explorer);
|
||||
|
||||
//peo :: init (argc, argv);
|
||||
|
||||
eoPop<FSP> popIBEA;
|
||||
eoPop<FSP> popLS;
|
||||
eoPop<FSP> popCentral;
|
||||
eoPop<FSP> popCentral2;
|
||||
popCentral.resize(0);
|
||||
popCentral2.resize(0);
|
||||
// initialization of the population
|
||||
popIBEA.append(_popSize, init);
|
||||
popLS.append(1, init);
|
||||
// definition of an unbounded archive
|
||||
moeoNewBoundedArchive<FSP> archCentral(100);
|
||||
moeoNewBoundedArchive<FSP> archCentral2(100);
|
||||
moeoNewBoundedArchive<FSP> archLS(100);
|
||||
moeoUnboundedArchive<FSP> archIBEA;
|
||||
|
||||
// stopping criteria
|
||||
eoContinue<FSP> & stop = do_make_continue_moeo(parser, state, eval);
|
||||
|
||||
eoGenContinue<FSP> stop1(5000000);
|
||||
eoGenContinue<FSP> stop2(5000000);
|
||||
eoGenContinue<FSP> stop3(5000000);
|
||||
|
||||
// checkpointing
|
||||
eoCheckPoint<FSP> & checkpoint1 = do_make_checkpoint_moeo(parser, state, eval, stop1, popIBEA, archIBEA);
|
||||
eoCheckPoint<FSP> & checkpoint2 = do_make_checkpoint_moeo(parser, state, eval, stop2, popLS, archLS);
|
||||
eoCheckPoint<FSP> & checkpoint3 = do_make_checkpoint_moeo(parser, state, eval, stop3, popCentral, archCentral);
|
||||
|
||||
moeoArchiveObjectiveVectorSavingUpdater < FSP > * save_updater1 = new moeoArchiveObjectiveVectorSavingUpdater < FSP > (archIBEA, "archIBEA");
|
||||
state.storeFunctor(save_updater1);
|
||||
checkpoint1.add(*save_updater1);
|
||||
|
||||
moeoArchiveObjectiveVectorSavingUpdater < FSP > * save_updater2 = new moeoArchiveObjectiveVectorSavingUpdater < FSP > (archLS, "archLS");
|
||||
state.storeFunctor(save_updater2);
|
||||
checkpoint2.add(*save_updater2);
|
||||
|
||||
moeoArchiveObjectiveVectorSavingUpdater < FSP > * save_updater3 = new moeoArchiveObjectiveVectorSavingUpdater < FSP > (archCentral, "archCentral");
|
||||
state.storeFunctor(save_updater3);
|
||||
checkpoint3.add(*save_updater3);
|
||||
|
||||
// metric
|
||||
moeoAdditiveEpsilonBinaryMetric<fspObjectiveVector> metric;
|
||||
// algorithms
|
||||
moeoIBEA<FSP> algo1 (checkpoint1, eval, op, metric);
|
||||
//moeoSEEA<FSP> algo1 (checkpoint1, eval, op, arch1);
|
||||
moeoUnifiedDominanceBasedLS <fspMove> algo2(checkpoint2, eval, archLS, *explorer, *selector);
|
||||
|
||||
//moeoUnifiedDominanceBasedLS <tspMove> algo3(checkpoint3, eval, arch3, *explorer, *selector);
|
||||
//moeoSEEA<FSP> algo3 (checkpoint3, eval, op, arch3);
|
||||
//moeoSEEA<FSP> algo4 (checkpoint4, eval, op, arch4);
|
||||
//moeoIBEA<FSP> algo3 (checkpoint3, eval, op, metric);
|
||||
//moeoNSGAII<FSP> algo3 (checkpoint3, eval, op);
|
||||
|
||||
//PEO:initialisation
|
||||
|
||||
|
||||
|
||||
//Topolgy
|
||||
RingTopology ring1, ring2;
|
||||
StarTopology star;
|
||||
|
||||
|
||||
|
||||
|
||||
eoSwapMutation <FSP> swap;
|
||||
|
||||
|
||||
|
||||
CentralAggregation<FSP> test;
|
||||
IBEAAggregation<FSP> test2;
|
||||
LSAggregation<FSP> test3(swap, eval, _nbKick);
|
||||
ArchToArchAggregation<FSP> test4;
|
||||
|
||||
apply<FSP>(eval, popIBEA);
|
||||
popIBEA.sort();
|
||||
apply<FSP>(eval, popLS);
|
||||
popLS.sort();
|
||||
|
||||
|
||||
|
||||
/* peoSyncDataTransfer transfer1(archCentral, ring1, test);
|
||||
centralArchive<FSP> centre1(archCentral, popCentral, transfer1, checkpoint3);
|
||||
|
||||
|
||||
peoSyncDataTransfer transfer2(archCentral, ring2, test);
|
||||
centralArchive<FSP> centre2(archCentral, popCentral, transfer2, checkpoint3);
|
||||
|
||||
|
||||
|
||||
|
||||
peoSyncDataTransfer transfer3(popIBEA, ring1, test2);
|
||||
eoGenContinue <FSP> cont2(500);
|
||||
|
||||
gestionTransfer<FSP> gest2(cont2, transfer3, archIBEA);
|
||||
//centralArchive centre1(arch1, pop1, transfer1);
|
||||
checkpoint1.add(gest2);
|
||||
|
||||
|
||||
|
||||
|
||||
peoSyncDataTransfer transfer4(archLS, ring2, test3);
|
||||
eoAmeliorationContinue <FSP> cont(archLS, 1, false);
|
||||
//eoGenContinue <FSP> cont(10000);
|
||||
gestionTransfer2<FSP> gest(cont, transfer4, archLS);
|
||||
checkpoint2.add(gest);*/
|
||||
|
||||
|
||||
// std::vector<peoSyncDataTransfer> vect;
|
||||
|
||||
|
||||
// initDebugging();
|
||||
//setDebugMode(true);
|
||||
|
||||
testPEO<FSP> hop(argc, argv, algo1, algo2, popIBEA, popLS, archCentral, test, test, test2, test3, checkpoint1, checkpoint2, checkpoint3);
|
||||
|
||||
|
||||
hop();
|
||||
|
||||
|
||||
|
||||
// Start the parallel EA
|
||||
/*eoPop<FSP> dummyPop;
|
||||
dummyPop.resize(0);
|
||||
|
||||
eoPop<FSP> dummyPop2;
|
||||
dummyPop2.resize(0);*/
|
||||
|
||||
//Wrapp algorithms
|
||||
|
||||
/* peoParallelAlgorithmWrapper parallelEA_1(centre1, dummyPop);
|
||||
transfer1.setOwner( parallelEA_1 );
|
||||
|
||||
|
||||
peoParallelAlgorithmWrapper parallelEA_2(algo1, popIBEA);
|
||||
transfer3.setOwner( parallelEA_2 );
|
||||
|
||||
|
||||
peoParallelAlgorithmWrapper parallelEA_3(centre2, dummyPop2);
|
||||
transfer2.setOwner( parallelEA_3 );
|
||||
|
||||
|
||||
peoParallelAlgorithmWrapper parallelEA_4(algo2, popLS);
|
||||
transfer4.setOwner( parallelEA_4 );*/
|
||||
|
||||
|
||||
/* if (getNodeRank()==1)
|
||||
{
|
||||
|
||||
cout << "Initial Population IBEA\n" << popIBEA << endl;
|
||||
}
|
||||
|
||||
if (getNodeRank()==2)
|
||||
{
|
||||
|
||||
cout << "Initial Population LS\n" << popLS << endl;
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//run
|
||||
//peo :: run( );
|
||||
//peo :: finalize( );
|
||||
//endDebugging();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (exception& e){
|
||||
cout << e.what() << endl;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
388
branches/contribution/branches/MOLS/COSEARCH/moeoTransfer.h
Normal file
388
branches/contribution/branches/MOLS/COSEARCH/moeoTransfer.h
Normal file
|
|
@ -0,0 +1,388 @@
|
|||
//eo
|
||||
#include <eo>
|
||||
|
||||
// moeo
|
||||
#include <moeo>
|
||||
|
||||
//general
|
||||
#include <string>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
|
||||
//peo
|
||||
#include <peo>
|
||||
#include <peoAsyncDataTransfer.h>
|
||||
#include <peoSyncDataTransfer.h>
|
||||
|
||||
#include <dmls.h>
|
||||
|
||||
|
||||
template <class A1, class A2, class R>
|
||||
class generalAggregation: public eoBF<A1, A2, R>{};
|
||||
|
||||
template <class EOT, class A, class R>
|
||||
class AbstractEntityToPopAggregation: public generalAggregation<eoPop<EOT>&, A, R>{};
|
||||
|
||||
template <class EOT, class A, class R>
|
||||
class AbstractEntityToArchiveAggregation: public generalAggregation<moeoArchive<EOT>&, A, R>{};
|
||||
|
||||
template <class EOT>
|
||||
class PopToPopAggregation: public AbstractEntityToPopAggregation<EOT, eoPop<EOT>&, void>{};
|
||||
|
||||
template <class EOT>
|
||||
class ArchiveToPopAggregation: public AbstractEntityToPopAggregation<EOT, moeoArchive<EOT>&, void>{};
|
||||
|
||||
template <class EOT>
|
||||
class PopToArchiveAggregation: public AbstractEntityToArchiveAggregation<EOT, eoPop<EOT>&, void>{};
|
||||
|
||||
template <class EOT>
|
||||
class ArchiveToArchiveAggregation: public AbstractEntityToArchiveAggregation<EOT, moeoArchive<EOT>&, void>{};
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
template <class EOT>
|
||||
class gestionTransfer: public eoUpdater{
|
||||
|
||||
public:
|
||||
gestionTransfer(eoGenContinue < EOT > & _continuator,
|
||||
peoDataTransfer & _asyncDataTransfer,
|
||||
moeoArchive<EOT>& _archive):continuator(_continuator), asyncDataTransfer(_asyncDataTransfer), archive(_archive){}
|
||||
|
||||
void operator()(){
|
||||
if(!continuator(archive)){
|
||||
asyncDataTransfer();
|
||||
continuator.totalGenerations(continuator.totalGenerations());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
eoGenContinue < EOT > & continuator;
|
||||
peoDataTransfer& asyncDataTransfer;
|
||||
moeoArchive<EOT>& archive;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
template <class EOT>
|
||||
class gestionTransfer2: public eoUpdater{
|
||||
|
||||
public:
|
||||
gestionTransfer2(eoContinue < EOT > & _continuator,
|
||||
peoSyncDataTransfer & _asyncDataTransfer,
|
||||
moeoArchive<EOT>& _archive):continuator(_continuator), asyncDataTransfer(_asyncDataTransfer), archive(_archive){}
|
||||
|
||||
void operator()(){
|
||||
if(!continuator(archive)){
|
||||
asyncDataTransfer();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
eoContinue < EOT > & continuator;
|
||||
peoSyncDataTransfer& asyncDataTransfer;
|
||||
moeoArchive<EOT>& archive;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
/*template <class EOT>
|
||||
class IBEAAggregationRnd: public ArchiveToPopAggregation<EOT>{
|
||||
|
||||
public:
|
||||
void operator()(eoPop< EOT >& _pop, moeoArchive< EOT >& _archive) {
|
||||
UF_random_generator<unsigned int> rndGen;
|
||||
std::vector<unsigned int> tab;
|
||||
unsigned int resizeValue;
|
||||
unsigned int popCorrectSize= _pop.size();
|
||||
|
||||
if (_pop.size() - _archive.size()>0){
|
||||
resizeValue=_pop.size() - _archive.size();
|
||||
_pop.shuffle();
|
||||
}
|
||||
else
|
||||
resizeValue=0;
|
||||
|
||||
for(unsigned int i=0; i<_archive.size(); i++)
|
||||
tab.push_back(i);
|
||||
std::random_shuffle(tab.begin(), tab.end(), rndGen);
|
||||
|
||||
_pop.resize(resizeValue);
|
||||
|
||||
for (unsigned int i=0; i<(popCorrectSize-resizeValue); i++)
|
||||
{
|
||||
_pop.push_back(_archive[tab[i]]);
|
||||
}
|
||||
for (unsigned int i=0; i<_pop.size(); i++)
|
||||
{
|
||||
_pop[i].fitness(0.0);
|
||||
_pop[i].diversity(0.0);
|
||||
}
|
||||
}
|
||||
};*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
template <class EOT>
|
||||
class IBEAAggregation: public ArchiveToPopAggregation<EOT>{
|
||||
public:
|
||||
void operator()(eoPop< EOT >& _pop, moeoArchive< EOT >& _archive) {
|
||||
unsigned int popSize= _pop.size();
|
||||
_pop.reserve(popSize + _archive.size());
|
||||
for (unsigned int i=0; i<_archive.size(); i++)
|
||||
{
|
||||
_pop.push_back(_archive[i]);
|
||||
_pop[i+popSize].fitness(0.0);
|
||||
//_pop[i].diversity(0.0);
|
||||
}
|
||||
diversityAssignment(_pop);
|
||||
std::sort(_pop.begin(), _pop.end(), cmp);
|
||||
_pop.resize(popSize);
|
||||
}
|
||||
|
||||
private:
|
||||
moeoCrowdingDiversityAssignment<EOT> diversityAssignment;
|
||||
moeoDiversityThenFitnessComparator<EOT> cmp;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
/*template <class EOT>
|
||||
class IBEAAggregationQuiMarchePas{
|
||||
public:
|
||||
void operator()(eoPop< EOT >& _pop, moeoArchive< EOT >& _archive) {
|
||||
UF_random_generator<unsigned int> rndGen;
|
||||
std::vector<unsigned int> tab;
|
||||
unsigned int resizeValue;
|
||||
unsigned int popCorrectSize= _pop.size();
|
||||
|
||||
|
||||
if (_pop.size() <= _archive.size())
|
||||
_pop.resize(0);
|
||||
|
||||
for (unsigned int i=0; i<_archive.size(); i++)
|
||||
{
|
||||
_pop.push_back(_archive[i]);
|
||||
_pop[i].fitness(0.0);
|
||||
_pop[i].diversity(0.0);
|
||||
}
|
||||
|
||||
}
|
||||
};*/
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
template <class EOT>
|
||||
class LSAggregation: public ArchiveToArchiveAggregation<EOT>{
|
||||
public:
|
||||
|
||||
LSAggregation(eoMonOp <EOT> & _op, eoEvalFunc<EOT>& _eval, unsigned int _nbKick): ArchiveToArchiveAggregation<EOT>(),op(_op), eval(_eval), nbKick(_nbKick){}
|
||||
|
||||
void operator()(moeoArchive< EOT >& _archive1, moeoArchive <EOT >& _archive2) {
|
||||
unsigned int archSize=_archive2.size();
|
||||
if(archSize>0){
|
||||
_archive1.resize(0);
|
||||
_archive1.push_back(_archive2[rng.random(archSize)]);
|
||||
// std::cout << "kick : " << nbKick << std::endl;
|
||||
//si la solution n'a pas encore été visité
|
||||
if(_archive1[0].flag()==1){
|
||||
std::cout << "kick pour du vrai" << std::endl;
|
||||
//on la kick
|
||||
for(unsigned int i=0; i<nbKick; i++){
|
||||
//std::cout << _archive1[0] << std::endl;
|
||||
op(_archive1[0]);
|
||||
}
|
||||
eval(_archive1[0]);
|
||||
_archive1[0].flag(0);
|
||||
}
|
||||
for (unsigned int i=0; i<_archive1.size(); i++)
|
||||
{
|
||||
|
||||
_archive1[i].fitness(0.0);
|
||||
_archive1[i].diversity(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
eoMonOp<EOT> & op;
|
||||
eoEvalFunc<EOT> & eval;
|
||||
unsigned int nbKick;
|
||||
|
||||
};
|
||||
|
||||
|
||||
//Aggregation pour archiver une pop
|
||||
template <class EOT>
|
||||
class CentralAggregation: public PopToArchiveAggregation<EOT>{
|
||||
public:
|
||||
void operator()(moeoArchive< EOT >& _archive, eoPop< EOT >& _pop) {
|
||||
_archive(_pop);
|
||||
}
|
||||
};
|
||||
|
||||
//aggregation pour archiver une archive
|
||||
template <class EOT>
|
||||
class ArchToArchAggregation{
|
||||
public:
|
||||
void operator()(moeoArchive< EOT >& _archive1, moeoArchive< EOT >& _archive2) {
|
||||
_archive1(_archive2);
|
||||
}
|
||||
};
|
||||
|
||||
template <class EOT>
|
||||
class gestArchive{
|
||||
|
||||
public:
|
||||
gestArchive(moeoArchive <EOT>& _archive,
|
||||
eoPop <EOT>& _pop,
|
||||
peoSyncDataTransfer & _syncDataTransfer,
|
||||
eoContinue <EOT>& _cont):
|
||||
archive(_archive), pop(_pop), syncDataTransfer(_syncDataTransfer), cont(_cont){}
|
||||
|
||||
void operator()(eoPop <EOT>& population) {
|
||||
while(true){
|
||||
// pop.resize(0);
|
||||
//for(unsigned int i=0; i<archive.size(); i++)
|
||||
// pop.push_back(archive[i]);
|
||||
syncDataTransfer();//appel pour faire l'echange
|
||||
// archive(pop);
|
||||
// pop.resize(0);
|
||||
// for(unsigned int i=0; i<archive.size(); i++)
|
||||
// pop.push_back(archive[i]);
|
||||
cont(archive);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
moeoArchive <EOT>& archive;
|
||||
eoPop <EOT>& pop;
|
||||
peoSyncDataTransfer& syncDataTransfer;
|
||||
eoContinue <EOT>& cont;
|
||||
};
|
||||
|
||||
|
||||
template <class EOT>
|
||||
class testPEO{
|
||||
|
||||
public:
|
||||
testPEO(int _argc,
|
||||
char** _argv,
|
||||
moeoPopAlgo<EOT> & _algo1,
|
||||
moeoPopAlgo<EOT> & _algo2,
|
||||
eoPop<EOT> & _pop1,
|
||||
eoPop<EOT> & _pop2,
|
||||
moeoNewBoundedArchive<EOT> & _centralArchive,
|
||||
AbstractEntityToArchiveAggregation<EOT, eoPop<EOT> &, void>& _algo1ToArchive,
|
||||
AbstractEntityToArchiveAggregation<EOT, eoPop<EOT> &, void>& _algo2ToArchive,
|
||||
generalAggregation <eoPop<EOT> &, moeoArchive<EOT> &, void>& _archiveToAlgo1,
|
||||
generalAggregation <moeoArchive<EOT> &, moeoArchive<EOT> &, void>& _archiveToAlgo2,
|
||||
eoCheckPoint<EOT> & _checkAlgo1,
|
||||
eoCheckPoint<EOT> & _checkAlgo2,
|
||||
eoCheckPoint<EOT> & _checkArchive):
|
||||
argc(_argc),
|
||||
argv(_argv),
|
||||
algo1(_algo1),
|
||||
algo2(_algo2),
|
||||
pop1(_pop1),
|
||||
pop2(_pop2),
|
||||
centralArchive(_centralArchive),
|
||||
algo1ToArchive(_algo1ToArchive),
|
||||
algo2ToArchive(_algo2ToArchive),
|
||||
archiveToAlgo1(_archiveToAlgo1),
|
||||
archiveToAlgo2(_archiveToAlgo2),
|
||||
checkAlgo1(_checkAlgo1),
|
||||
checkAlgo2(_checkAlgo2),
|
||||
checkArchive(_checkArchive){}
|
||||
|
||||
void operator()(){
|
||||
|
||||
//PEO Initialization
|
||||
peo :: init (argc, argv);
|
||||
|
||||
//Two RingTopolgy
|
||||
RingTopology ring1, ring2;
|
||||
|
||||
|
||||
//DataTransfer for the fisrt ring
|
||||
peoSyncDataTransfer transfer1(centralArchive, ring1, algo1ToArchive);
|
||||
peoSyncDataTransfer transfer2(pop1, ring1, archiveToAlgo1);
|
||||
|
||||
//DataTransfer for the second ring
|
||||
peoSyncDataTransfer transfer3(centralArchive, ring2, algo2ToArchive);
|
||||
peoSyncDataTransfer transfer4(pop2, ring2, archiveToAlgo2);
|
||||
|
||||
//Transfer Algo1 -> archiveCentral (Ring1)
|
||||
gestArchive<EOT> toCenter1(centralArchive, pop1, transfer1, checkArchive);
|
||||
|
||||
//Transfer archiveCentral -> Algo1 (Ring1)
|
||||
eoGenContinue <EOT> genContinuator1(100);
|
||||
gestionTransfer<EOT> exitCenter1(genContinuator1, transfer2, centralArchive);
|
||||
checkAlgo1.add(exitCenter1);
|
||||
|
||||
//Transfer Algo2 -> archiveCentral (Ring2)
|
||||
gestArchive<EOT> toCenter2(centralArchive, pop2, transfer3, checkArchive);
|
||||
|
||||
//Transfer archiveCentral -> Algo2 (Ring2)
|
||||
eoGenContinue <EOT> genContinuator2(200);
|
||||
gestionTransfer<EOT> exitCenter2(genContinuator2, transfer4, centralArchive);
|
||||
checkAlgo2.add(exitCenter2);
|
||||
|
||||
//dummyPop
|
||||
eoPop<EOT> dummyPop;
|
||||
|
||||
//Wrapping of algotithm
|
||||
peoParallelAlgorithmWrapper parallelEA_1(toCenter1, dummyPop);
|
||||
transfer1.setOwner( parallelEA_1 );
|
||||
|
||||
|
||||
peoParallelAlgorithmWrapper parallelEA_2(algo1, pop1);
|
||||
transfer2.setOwner( parallelEA_2 );
|
||||
|
||||
|
||||
peoParallelAlgorithmWrapper parallelEA_3(toCenter2, dummyPop);
|
||||
transfer3.setOwner( parallelEA_3 );
|
||||
|
||||
|
||||
peoParallelAlgorithmWrapper parallelEA_4(algo2, pop2);
|
||||
transfer4.setOwner( parallelEA_4 );
|
||||
|
||||
|
||||
//run
|
||||
peo :: run( );
|
||||
peo :: finalize( );
|
||||
endDebugging();
|
||||
}
|
||||
|
||||
private:
|
||||
int argc;
|
||||
char** argv;
|
||||
moeoPopAlgo<EOT> & algo1;
|
||||
moeoPopAlgo<EOT> & algo2;
|
||||
eoPop<EOT> & pop1;
|
||||
eoPop<EOT> & pop2;
|
||||
moeoNewBoundedArchive <EOT> & centralArchive;
|
||||
AbstractEntityToArchiveAggregation<EOT, eoPop<EOT> &, void> & algo1ToArchive;
|
||||
AbstractEntityToArchiveAggregation<EOT, eoPop<EOT> &, void> & algo2ToArchive;
|
||||
generalAggregation <eoPop<EOT> &, moeoArchive<EOT> &, void> & archiveToAlgo1;
|
||||
generalAggregation <moeoArchive<EOT> &, moeoArchive<EOT> &, void> & archiveToAlgo2;
|
||||
eoCheckPoint<EOT> & checkAlgo1;
|
||||
eoCheckPoint<EOT> & checkAlgo2;
|
||||
eoCheckPoint<EOT> & checkArchive;
|
||||
|
||||
|
||||
};
|
||||
7
branches/contribution/branches/MOLS/CTestConfig.cmake
Normal file
7
branches/contribution/branches/MOLS/CTestConfig.cmake
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
set(CTEST_PROJECT_NAME "ParadisEO")
|
||||
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
|
||||
|
||||
set(CTEST_DROP_METHOD "http")
|
||||
set(CTEST_DROP_SITE "cdash.inria.fr")
|
||||
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=ParadisEO")
|
||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||
26
branches/contribution/branches/MOLS/doc/CMakeLists.txt
Normal file
26
branches/contribution/branches/MOLS/doc/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
##########################################################################################
|
||||
### MOEO Doc generation using Doxygen
|
||||
##########################################################################################
|
||||
|
||||
IF (DOXYGEN_FOUND)
|
||||
|
||||
SET(DOC_DIR ${CMAKE_BINARY_DIR}/doc CACHE PATH "MOEO documentation directory")
|
||||
SET(MOEO_DOC_CONFIG_FILE "moeo.doxyfile" CACHE PATH "MOEO documentation configuration file")
|
||||
# define the doc target
|
||||
IF (DOXYGEN_EXECUTABLE)
|
||||
ADD_CUSTOM_TARGET(doc
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${MOEO_DOC_CONFIG_FILE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
ENDIF (DOXYGEN_EXECUTABLE)
|
||||
|
||||
# configure doxyfile file
|
||||
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/doc/${MOEO_DOC_CONFIG_FILE}.cmake"
|
||||
"${CMAKE_BINARY_DIR}/doc/${MOEO_DOC_CONFIG_FILE}")
|
||||
|
||||
ELSE (DOXYGEN_FOUND)
|
||||
MESSAGE(STATUS "Unable to generate the documentation, Doxygen package not found")
|
||||
ENDIF (DOXYGEN_FOUND)
|
||||
|
||||
##########################################################################################
|
||||
57
branches/contribution/branches/MOLS/doc/index.h
Normal file
57
branches/contribution/branches/MOLS/doc/index.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/** @mainpage Welcome to the DMLS plug-in for ParadisEO 1.2
|
||||
|
||||
@section Introduction
|
||||
|
||||
This plug-in provides classes for the flexible design of Dominance-based Multi-objective Local Search (DMLS) algorithms under ParadisEO. The implementation is based on a fine-grained decomposition following the unified model proposed in the corresponding paper ("A Preliminary Investigation to unify Dominance-based Local Search Approaches for Multiobjective Combinatorial Optimization").
|
||||
|
||||
@section Authors
|
||||
Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
@section Installation
|
||||
|
||||
The installation procedure of the package is detailed in the "README.txt" file located in the top-directory of the source-tree.
|
||||
|
||||
|
||||
@section Design
|
||||
|
||||
For an introduction to the design of ParadisEO,
|
||||
you can look at the <a href="http://paradiseo.gforge.inria.fr">ParadisEO website</a>.
|
||||
|
||||
|
||||
@section LICENSE
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
|
||||
*/
|
||||
|
||||
/** @page webpages Related webpages
|
||||
|
||||
- ParadisEO <a href="http://paradiseo.gforge.inria.fr">homepage</a>
|
||||
- INRIA GForge <a href="http://gforge.inria.fr/projects/paradiseo/">project page</a>
|
||||
- Fore any questions, please contact paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
237
branches/contribution/branches/MOLS/doc/moeo.doxyfile.cmake
Normal file
237
branches/contribution/branches/MOLS/doc/moeo.doxyfile.cmake
Normal file
|
|
@ -0,0 +1,237 @@
|
|||
# Doxyfile 1.5.1
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = @PACKAGE_NAME@
|
||||
PROJECT_NUMBER = @PACKAGE_VERSION@
|
||||
OUTPUT_DIRECTORY = @CMAKE_BINARY_DIR@/doc
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = NO
|
||||
STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = YES
|
||||
WARNINGS = NO
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = @CMAKE_SOURCE_DIR@
|
||||
FILE_PATTERNS = *.cpp \
|
||||
*.h \
|
||||
NEWS README
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 3
|
||||
IGNORE_PREFIX = moeo
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = YES
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = @EO_BIN_DIR@/doc/eo.doxytag=http://eodev.sourceforge.net/eo/doc/html
|
||||
GENERATE_TAGFILE = @CMAKE_BINARY_DIR@/doc/moeo.doxytag
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* <moeoCombinedLS.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOCOMBINEDLS_H_
|
||||
#define MOEOCOMBINEDLS_H_
|
||||
|
||||
#include <vector>
|
||||
#include <algo/moeoLS.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
|
||||
/**
|
||||
* This class allows to embed a set of local searches that are sequentially applied,
|
||||
* and so working and updating the same archive of non-dominated solutions.
|
||||
*/
|
||||
template < class MOEOT, class Type >
|
||||
class moeoCombinedLS : public moeoLS < MOEOT, Type >
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Ctor
|
||||
* @param _first_mols the first multi-objective local search to add
|
||||
*/
|
||||
moeoCombinedLS(moeoLS < MOEOT, Type > & _first_mols)
|
||||
{
|
||||
combinedLS.push_back (& _first_mols);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new local search to combine
|
||||
* @param _mols the multi-objective local search to add
|
||||
*/
|
||||
void add(moeoLS < MOEOT, Type > & _mols)
|
||||
{
|
||||
combinedLS.push_back(& _mols);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives a new solution in order to explore the neigborhood.
|
||||
* The new non-dominated solutions are added to the archive
|
||||
* @param _type the object to apply the local search to
|
||||
* @param _arch the archive of non-dominated solutions
|
||||
*/
|
||||
void operator () (Type _type, moeoArchive < MOEOT > & _arch)
|
||||
{
|
||||
for (unsigned int i=0; i<combinedLS.size(); i++)
|
||||
combinedLS[i] -> operator()(_type, _arch);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** the vector that contains the combined LS */
|
||||
std::vector< moeoLS < MOEOT, Type > * > combinedLS;
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOCOMBINEDLS_H_*/
|
||||
101
branches/contribution/branches/MOLS/src/IBMOLS/moeoHybridLS.h
Normal file
101
branches/contribution/branches/MOLS/src/IBMOLS/moeoHybridLS.h
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* <moeoHybridLS.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOHYBRIDLS_H_
|
||||
#define MOEOHYBRIDLS_H_
|
||||
|
||||
#include <eoContinue.h>
|
||||
#include <eoPop.h>
|
||||
#include <eoSelect.h>
|
||||
#include <utils/eoUpdater.h>
|
||||
#include <algo/moeoLS.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
|
||||
/**
|
||||
* This class allows to apply a multi-objective local search to a number of selected individuals contained in the archive
|
||||
* at every generation until a stopping criteria is verified.
|
||||
*/
|
||||
template < class MOEOT >
|
||||
class moeoHybridLS : public eoUpdater
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Ctor
|
||||
* @param _term stopping criteria
|
||||
* @param _select selector
|
||||
* @param _mols a multi-objective local search
|
||||
* @param _arch the archive
|
||||
*/
|
||||
moeoHybridLS (eoContinue < MOEOT > & _term, eoSelect < MOEOT > & _select, moeoLS < MOEOT, MOEOT > & _mols, moeoArchive < MOEOT > & _arch) :
|
||||
term(_term), select(_select), mols(_mols), arch(_arch)
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Applies the multi-objective local search to selected individuals contained in the archive if the stopping criteria is not verified
|
||||
*/
|
||||
void operator () ()
|
||||
{
|
||||
if (! term (arch))
|
||||
{
|
||||
// selection of solutions
|
||||
eoPop < MOEOT > selectedSolutions;
|
||||
select(arch, selectedSolutions);
|
||||
// apply the local search to every selected solution
|
||||
for (unsigned int i=0; i<selectedSolutions.size(); i++)
|
||||
{
|
||||
mols(selectedSolutions[i], arch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** stopping criteria */
|
||||
eoContinue < MOEOT > & term;
|
||||
/** selector */
|
||||
eoSelect < MOEOT > & select;
|
||||
/** multi-objective local search */
|
||||
moeoLS < MOEOT, MOEOT > & mols;
|
||||
/** archive */
|
||||
moeoArchive < MOEOT > & arch;
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOHYBRIDLS_H_*/
|
||||
523
branches/contribution/branches/MOLS/src/IBMOLS/moeoIBMOLS.h
Executable file
523
branches/contribution/branches/MOLS/src/IBMOLS/moeoIBMOLS.h
Executable file
|
|
@ -0,0 +1,523 @@
|
|||
/*
|
||||
* <moeoIBMOLS.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOIBMOLS_H_
|
||||
#define MOEOIBMOLS_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <eoContinue.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <eoPop.h>
|
||||
#include <moMove.h>
|
||||
#include <moMoveInit.h>
|
||||
#include <moNextMove.h>
|
||||
#include <moeoPopLS.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <archive/moeoUnboundedArchive.h>
|
||||
#include <fitness/moeoBinaryIndicatorBasedFitnessAssignment.h>
|
||||
#include <moMoveIncrEval.h>
|
||||
|
||||
/**
|
||||
* Indicator-Based Multi-Objective Local Search (IBMOLS) as described in
|
||||
* Basseur M., Burke K. : "Indicator-Based Multi-Objective Local Search" (2007).
|
||||
*/
|
||||
template < class MOEOT, class Move >
|
||||
class moeoIBMOLS : public moeoPopLS < Move>
|
||||
{
|
||||
public:
|
||||
|
||||
/** The type of objective vector */
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
|
||||
/**
|
||||
* Ctor.
|
||||
* @param _moveInit the move initializer
|
||||
* @param _nextMove the neighborhood explorer
|
||||
* @param _eval the full evaluation
|
||||
* @param _moveIncrEval the incremental evaluation
|
||||
* @param _fitnessAssignment the fitness assignment strategy
|
||||
* @param _continuator the stopping criteria
|
||||
* @param _arch the archive
|
||||
*/
|
||||
moeoIBMOLS(
|
||||
moMoveInit < Move > & _moveInit,
|
||||
moNextMove < Move > & _nextMove,
|
||||
eoEvalFunc < MOEOT > & _eval,
|
||||
moMoveIncrEval < Move , ObjectiveVector > & _moveIncrEval,
|
||||
moeoBinaryIndicatorBasedFitnessAssignment < MOEOT > & _fitnessAssignment,
|
||||
eoContinue < MOEOT > & _continuator,
|
||||
moeoArchive < MOEOT > & _arch
|
||||
) :
|
||||
moveInit(_moveInit),
|
||||
nextMove(_nextMove),
|
||||
eval(_eval),
|
||||
moveIncrEval(_moveIncrEval),
|
||||
fitnessAssignment (_fitnessAssignment),
|
||||
continuator (_continuator),
|
||||
arch(_arch)
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Apply the local search until a local archive does not change or
|
||||
* another stopping criteria is met and update the archive _arch with new non-dominated solutions.
|
||||
* @param _pop the initial population
|
||||
*/
|
||||
void operator() (eoPop < MOEOT > & _pop)
|
||||
{
|
||||
// evaluation of the objective values
|
||||
|
||||
for (unsigned int i=0; i<_pop.size(); i++)
|
||||
{
|
||||
eval(_pop[i]);
|
||||
}
|
||||
|
||||
// fitness assignment for the whole population
|
||||
fitnessAssignment(_pop);
|
||||
// creation of a local archive
|
||||
moeoUnboundedArchive < MOEOT > archive;
|
||||
// creation of another local archive (for the stopping criteria)
|
||||
moeoUnboundedArchive < MOEOT > previousArchive;
|
||||
// update the archive with the initial population
|
||||
archive(_pop);
|
||||
do
|
||||
{
|
||||
previousArchive(archive);
|
||||
oneStep(_pop);
|
||||
archive(_pop);
|
||||
}
|
||||
while ( (! archive.equals(previousArchive)) && (continuator(arch)) );
|
||||
arch(archive);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** the move initializer */
|
||||
moMoveInit < Move > & moveInit;
|
||||
/** the neighborhood explorer */
|
||||
moNextMove < Move > & nextMove;
|
||||
/** the full evaluation */
|
||||
eoEvalFunc < MOEOT > & eval;
|
||||
/** the incremental evaluation */
|
||||
moMoveIncrEval < Move, ObjectiveVector > & moveIncrEval;
|
||||
/** the fitness assignment strategy */
|
||||
moeoBinaryIndicatorBasedFitnessAssignment < MOEOT > & fitnessAssignment;
|
||||
/** the stopping criteria */
|
||||
eoContinue < MOEOT > & continuator;
|
||||
/** archive */
|
||||
moeoArchive < MOEOT > & arch;
|
||||
|
||||
/**
|
||||
* Apply one step of the local search to the population _pop
|
||||
* @param _pop the population
|
||||
*/
|
||||
void oneStep (eoPop < MOEOT > & _pop)
|
||||
{
|
||||
// the move
|
||||
Move move;
|
||||
// the objective vector and the fitness of the current solution
|
||||
ObjectiveVector x_objVec;
|
||||
double x_fitness;
|
||||
// the index, the objective vector and the fitness of the worst solution in the population (-1 implies that the worst is the newly created one)
|
||||
int worst_idx;
|
||||
ObjectiveVector worst_objVec;
|
||||
double worst_fitness;
|
||||
////////////////////////////////////////////
|
||||
// the indexes and the objective vectors of the extreme non-dominated points
|
||||
int ext_0_idx, ext_1_idx;
|
||||
ObjectiveVector ext_0_objVec, ext_1_objVec;
|
||||
unsigned int ind;
|
||||
////////////////////////////////////////////
|
||||
// the index of the current solution to be explored
|
||||
unsigned int i=0;
|
||||
// initilization of the move for the first individual
|
||||
moveInit(move, _pop[i]);
|
||||
while (i<_pop.size() && continuator(_pop))
|
||||
{
|
||||
// x = one neigbour of pop[i]
|
||||
// evaluate x in the objective space
|
||||
x_objVec = moveIncrEval(move, _pop[i]);
|
||||
// update every fitness values to take x into account and compute the fitness of x
|
||||
x_fitness = fitnessAssignment.updateByAdding(_pop, x_objVec);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// extreme solutions (min only!)
|
||||
// ext_0_idx = -1;
|
||||
// ext_0_objVec = x_objVec;
|
||||
// ext_1_idx = -1;
|
||||
// ext_1_objVec = x_objVec;
|
||||
// for (unsigned int k=0; k<_pop.size(); k++)
|
||||
// {
|
||||
// // ext_0
|
||||
// if (_pop[k].objectiveVector()[0] < ext_0_objVec[0])
|
||||
// {
|
||||
// ext_0_idx = k;
|
||||
// ext_0_objVec = _pop[k].objectiveVector();
|
||||
// }
|
||||
// else if ( (_pop[k].objectiveVector()[0] == ext_0_objVec[0]) && (_pop[k].objectiveVector()[1] < ext_0_objVec[1]) )
|
||||
// {
|
||||
// ext_0_idx = k;
|
||||
// ext_0_objVec = _pop[k].objectiveVector();
|
||||
// }
|
||||
// // ext_1
|
||||
// else if (_pop[k].objectiveVector()[1] < ext_1_objVec[1])
|
||||
// {
|
||||
// ext_1_idx = k;
|
||||
// ext_1_objVec = _pop[k].objectiveVector();
|
||||
// }
|
||||
// else if ( (_pop[k].objectiveVector()[1] == ext_1_objVec[1]) && (_pop[k].objectiveVector()[0] < ext_1_objVec[0]) )
|
||||
// {
|
||||
// ext_1_idx = k;
|
||||
// ext_1_objVec = _pop[k].objectiveVector();
|
||||
// }
|
||||
// }
|
||||
// // worst init
|
||||
// if (ext_0_idx == -1)
|
||||
// {
|
||||
// ind = 0;
|
||||
// while (ind == ext_1_idx)
|
||||
// {
|
||||
// ind++;
|
||||
// }
|
||||
// worst_idx = ind;
|
||||
// worst_objVec = _pop[ind].objectiveVector();
|
||||
// worst_fitness = _pop[ind].fitness();
|
||||
// }
|
||||
// else if (ext_1_idx == -1)
|
||||
// {
|
||||
// ind = 0;
|
||||
// while (ind == ext_0_idx)
|
||||
// {
|
||||
// ind++;
|
||||
// }
|
||||
// worst_idx = ind;
|
||||
// worst_objVec = _pop[ind].objectiveVector();
|
||||
// worst_fitness = _pop[ind].fitness();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// worst_idx = -1;
|
||||
// worst_objVec = x_objVec;
|
||||
// worst_fitness = x_fitness;
|
||||
// }
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// who is the worst ?
|
||||
for (unsigned int j=0; j<_pop.size(); j++)
|
||||
{
|
||||
if ( (j!=ext_0_idx) && (j!=ext_1_idx) )
|
||||
{
|
||||
if (_pop[j].fitness() < worst_fitness)
|
||||
{
|
||||
worst_idx = j;
|
||||
worst_objVec = _pop[j].objectiveVector();
|
||||
worst_fitness = _pop[j].fitness();
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the worst solution is the new one
|
||||
if (worst_idx == -1)
|
||||
{
|
||||
// if all its neighbours have been explored,
|
||||
// let's explore the neighborhoud of the next individual
|
||||
if (! nextMove(move, _pop[i]))
|
||||
{
|
||||
i++;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the worst solution is located before _pop[i]
|
||||
else if (worst_idx <= i)
|
||||
{
|
||||
// the new solution takes place insteed of _pop[worst_idx]
|
||||
_pop[worst_idx] = _pop[i];
|
||||
move(_pop[worst_idx]);
|
||||
_pop[worst_idx].objectiveVector(x_objVec);
|
||||
_pop[worst_idx].fitness(x_fitness);
|
||||
// let's explore the neighborhoud of the next individual
|
||||
i++;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
// if the worst solution is located after _pop[i]
|
||||
else if (worst_idx > i)
|
||||
{
|
||||
// the new solution takes place insteed of _pop[i+1] and _pop[worst_idx] is deleted
|
||||
_pop[worst_idx] = _pop[i+1];
|
||||
_pop[i+1] = _pop[i];
|
||||
move(_pop[i+1]);
|
||||
_pop[i+1].objectiveVector(x_objVec);
|
||||
_pop[i+1].fitness(x_fitness);
|
||||
// let's explore the neighborhoud of the individual _pop[i+2]
|
||||
i += 2;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
// update fitness values
|
||||
fitnessAssignment.updateByDeleting(_pop, worst_objVec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// INUTILE !!!!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Apply one step of the local search to the population _pop
|
||||
* @param _pop the population
|
||||
*/
|
||||
void new_oneStep (eoPop < MOEOT > & _pop)
|
||||
{
|
||||
// the move
|
||||
Move move;
|
||||
// the objective vector and the fitness of the current solution
|
||||
ObjectiveVector x_objVec;
|
||||
double x_fitness;
|
||||
// the index, the objective vector and the fitness of the worst solution in the population (-1 implies that the worst is the newly created one)
|
||||
int worst_idx;
|
||||
ObjectiveVector worst_objVec;
|
||||
double worst_fitness;
|
||||
////////////////////////////////////////////
|
||||
// the index of the extreme non-dominated points
|
||||
int ext_0_idx, ext_1_idx;
|
||||
unsigned int ind;
|
||||
////////////////////////////////////////////
|
||||
// the index current of the current solution to be explored
|
||||
unsigned int i=0;
|
||||
// initilization of the move for the first individual
|
||||
moveInit(move, _pop[i]);
|
||||
while (i<_pop.size() && continuator(_pop))
|
||||
{
|
||||
// x = one neigbour of pop[i]
|
||||
// evaluate x in the objective space
|
||||
x_objVec = moveIncrEval(move, _pop[i]);
|
||||
// update every fitness values to take x into account and compute the fitness of x
|
||||
x_fitness = fitnessAssignment.updateByAdding(_pop, x_objVec);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// extremes solutions
|
||||
OneObjectiveComparator comp0(0);
|
||||
ext_0_idx = std::min_element(_pop.begin(), _pop.end(), comp0) - _pop.begin();
|
||||
OneObjectiveComparator comp1(1);
|
||||
ext_1_idx = std::min_element(_pop.begin(), _pop.end(), comp1) - _pop.begin();
|
||||
// new = extreme ?
|
||||
if (x_objVec[0] < _pop[ext_0_idx].objectiveVector()[0])
|
||||
{
|
||||
ext_0_idx = -1;
|
||||
}
|
||||
else if ( (x_objVec[0] == _pop[ext_0_idx].objectiveVector()[0]) && (x_objVec[1] < _pop[ext_0_idx].objectiveVector()[1]) )
|
||||
{
|
||||
ext_0_idx = -1;
|
||||
}
|
||||
else if (x_objVec[1] < _pop[ext_1_idx].objectiveVector()[1])
|
||||
{
|
||||
ext_1_idx = -1;
|
||||
}
|
||||
else if ( (x_objVec[1] == _pop[ext_1_idx].objectiveVector()[1]) && (x_objVec[0] < _pop[ext_1_idx].objectiveVector()[0]) )
|
||||
{
|
||||
ext_1_idx = -1;
|
||||
}
|
||||
// worst init
|
||||
if (ext_0_idx == -1)
|
||||
{
|
||||
ind = 0;
|
||||
while (ind == ext_1_idx)
|
||||
{
|
||||
ind++;
|
||||
}
|
||||
worst_idx = ind;
|
||||
worst_objVec = _pop[ind].objectiveVector();
|
||||
worst_fitness = _pop[ind].fitness();
|
||||
}
|
||||
else if (ext_1_idx == -1)
|
||||
{
|
||||
ind = 0;
|
||||
while (ind == ext_0_idx)
|
||||
{
|
||||
ind++;
|
||||
}
|
||||
worst_idx = ind;
|
||||
worst_objVec = _pop[ind].objectiveVector();
|
||||
worst_fitness = _pop[ind].fitness();
|
||||
}
|
||||
else
|
||||
{
|
||||
worst_idx = -1;
|
||||
worst_objVec = x_objVec;
|
||||
worst_fitness = x_fitness;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// who is the worst ?
|
||||
for (unsigned int j=0; j<_pop.size(); j++)
|
||||
{
|
||||
if ( (j!=ext_0_idx) && (j!=ext_1_idx) )
|
||||
{
|
||||
if (_pop[j].fitness() < worst_fitness)
|
||||
{
|
||||
worst_idx = j;
|
||||
worst_objVec = _pop[j].objectiveVector();
|
||||
worst_fitness = _pop[j].fitness();
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the worst solution is the new one
|
||||
if (worst_idx == -1)
|
||||
{
|
||||
// if all its neighbours have been explored,
|
||||
// let's explore the neighborhoud of the next individual
|
||||
if (! nextMove(move, _pop[i]))
|
||||
{
|
||||
i++;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the worst solution is located before _pop[i]
|
||||
else if (worst_idx <= i)
|
||||
{
|
||||
// the new solution takes place insteed of _pop[worst_idx]
|
||||
_pop[worst_idx] = _pop[i];
|
||||
move(_pop[worst_idx]);
|
||||
_pop[worst_idx].objectiveVector(x_objVec);
|
||||
_pop[worst_idx].fitness(x_fitness);
|
||||
// let's explore the neighborhoud of the next individual
|
||||
i++;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
// if the worst solution is located after _pop[i]
|
||||
else if (worst_idx > i)
|
||||
{
|
||||
// the new solution takes place insteed of _pop[i+1] and _pop[worst_idx] is deleted
|
||||
_pop[worst_idx] = _pop[i+1];
|
||||
_pop[i+1] = _pop[i];
|
||||
move(_pop[i+1]);
|
||||
_pop[i+1].objectiveVector(x_objVec);
|
||||
_pop[i+1].fitness(x_fitness);
|
||||
// let's explore the neighborhoud of the individual _pop[i+2]
|
||||
i += 2;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
// update fitness values
|
||||
fitnessAssignment.updateByDeleting(_pop, worst_objVec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
class OneObjectiveComparator : public moeoComparator < MOEOT >
|
||||
{
|
||||
public:
|
||||
OneObjectiveComparator(unsigned int _obj) : obj(_obj)
|
||||
{
|
||||
if (obj > MOEOT::ObjectiveVector::nObjectives())
|
||||
{
|
||||
throw std::runtime_error("Problem with the index of objective in OneObjectiveComparator");
|
||||
}
|
||||
}
|
||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||
{
|
||||
if (_moeo1.objectiveVector()[obj] < _moeo2.objectiveVector()[obj])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (_moeo1.objectiveVector()[obj] == _moeo2.objectiveVector()[obj]) && (_moeo1.objectiveVector()[(obj+1)%2] < _moeo2.objectiveVector()[(obj+1)%2]);
|
||||
}
|
||||
}
|
||||
private:
|
||||
unsigned int obj;
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOIBMOLS_H_*/
|
||||
519
branches/contribution/branches/MOLS/src/IBMOLS/moeoIBMOLSsave.h
Executable file
519
branches/contribution/branches/MOLS/src/IBMOLS/moeoIBMOLSsave.h
Executable file
|
|
@ -0,0 +1,519 @@
|
|||
/*
|
||||
* <moeoIBMOLS.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOIBMOLS_H_
|
||||
#define MOEOIBMOLS_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <eoContinue.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <eoPop.h>
|
||||
#include <moMove.h>
|
||||
#include <moMoveInit.h>
|
||||
#include <moNextMove.h>
|
||||
#include <algo/moeoLS.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <fitness/moeoBinaryIndicatorBasedFitnessAssignment.h>
|
||||
#include <move/moeoMoveIncrEval.h>
|
||||
|
||||
/**
|
||||
* Indicator-Based Multi-Objective Local Search (IBMOLS) as described in
|
||||
* Basseur M., Burke K. : "Indicator-Based Multi-Objective Local Search" (2007).
|
||||
*/
|
||||
template < class MOEOT, class Move >
|
||||
class moeoIBMOLS : public moeoLS < MOEOT, eoPop < MOEOT > & >
|
||||
{
|
||||
public:
|
||||
|
||||
/** The type of objective vector */
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
|
||||
/**
|
||||
* Ctor.
|
||||
* @param _moveInit the move initializer
|
||||
* @param _nextMove the neighborhood explorer
|
||||
* @param _eval the full evaluation
|
||||
* @param _moveIncrEval the incremental evaluation
|
||||
* @param _fitnessAssignment the fitness assignment strategy
|
||||
* @param _continuator the stopping criteria
|
||||
*/
|
||||
moeoIBMOLS(
|
||||
moMoveInit < Move > & _moveInit,
|
||||
moNextMove < Move > & _nextMove,
|
||||
eoEvalFunc < MOEOT > & _eval,
|
||||
moeoMoveIncrEval < Move > & _moveIncrEval,
|
||||
moeoBinaryIndicatorBasedFitnessAssignment < MOEOT > & _fitnessAssignment,
|
||||
eoContinue < MOEOT > & _continuator
|
||||
) :
|
||||
moveInit(_moveInit),
|
||||
nextMove(_nextMove),
|
||||
eval(_eval),
|
||||
moveIncrEval(_moveIncrEval),
|
||||
fitnessAssignment (_fitnessAssignment),
|
||||
continuator (_continuator)
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Apply the local search until a local archive does not change or
|
||||
* another stopping criteria is met and update the archive _arch with new non-dominated solutions.
|
||||
* @param _pop the initial population
|
||||
* @param _arch the (updated) archive
|
||||
*/
|
||||
void operator() (eoPop < MOEOT > & _pop, moeoArchive < MOEOT > & _arch)
|
||||
{
|
||||
// evaluation of the objective values
|
||||
/*
|
||||
for (unsigned int i=0; i<_pop.size(); i++)
|
||||
{
|
||||
eval(_pop[i]);
|
||||
}
|
||||
*/
|
||||
// fitness assignment for the whole population
|
||||
fitnessAssignment(_pop);
|
||||
// creation of a local archive
|
||||
moeoArchive < MOEOT > archive;
|
||||
// creation of another local archive (for the stopping criteria)
|
||||
moeoArchive < MOEOT > previousArchive;
|
||||
// update the archive with the initial population
|
||||
archive.update(_pop);
|
||||
do
|
||||
{
|
||||
previousArchive.update(archive);
|
||||
oneStep(_pop);
|
||||
archive.update(_pop);
|
||||
}
|
||||
while ( (! archive.equals(previousArchive)) && (continuator(_arch)) );
|
||||
_arch.update(archive);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** the move initializer */
|
||||
moMoveInit < Move > & moveInit;
|
||||
/** the neighborhood explorer */
|
||||
moNextMove < Move > & nextMove;
|
||||
/** the full evaluation */
|
||||
eoEvalFunc < MOEOT > & eval;
|
||||
/** the incremental evaluation */
|
||||
moeoMoveIncrEval < Move > & moveIncrEval;
|
||||
/** the fitness assignment strategy */
|
||||
moeoBinaryIndicatorBasedFitnessAssignment < MOEOT > & fitnessAssignment;
|
||||
/** the stopping criteria */
|
||||
eoContinue < MOEOT > & continuator;
|
||||
|
||||
|
||||
/**
|
||||
* Apply one step of the local search to the population _pop
|
||||
* @param _pop the population
|
||||
*/
|
||||
void oneStep (eoPop < MOEOT > & _pop)
|
||||
{
|
||||
// the move
|
||||
Move move;
|
||||
// the objective vector and the fitness of the current solution
|
||||
ObjectiveVector x_objVec;
|
||||
double x_fitness;
|
||||
// the index, the objective vector and the fitness of the worst solution in the population (-1 implies that the worst is the newly created one)
|
||||
int worst_idx;
|
||||
ObjectiveVector worst_objVec;
|
||||
double worst_fitness;
|
||||
////////////////////////////////////////////
|
||||
// the indexes and the objective vectors of the extreme non-dominated points
|
||||
int ext_0_idx, ext_1_idx;
|
||||
ObjectiveVector ext_0_objVec, ext_1_objVec;
|
||||
unsigned int ind;
|
||||
////////////////////////////////////////////
|
||||
// the index of the current solution to be explored
|
||||
unsigned int i=0;
|
||||
// initilization of the move for the first individual
|
||||
moveInit(move, _pop[i]);
|
||||
while (i<_pop.size() && continuator(_pop))
|
||||
{
|
||||
// x = one neigbour of pop[i]
|
||||
// evaluate x in the objective space
|
||||
x_objVec = moveIncrEval(move, _pop[i]);
|
||||
// update every fitness values to take x into account and compute the fitness of x
|
||||
x_fitness = fitnessAssignment.updateByAdding(_pop, x_objVec);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// extreme solutions (min only!)
|
||||
ext_0_idx = -1;
|
||||
ext_0_objVec = x_objVec;
|
||||
ext_1_idx = -1;
|
||||
ext_1_objVec = x_objVec;
|
||||
for (unsigned int k=0; k<_pop.size(); k++)
|
||||
{
|
||||
// ext_0
|
||||
if (_pop[k].objectiveVector()[0] < ext_0_objVec[0])
|
||||
{
|
||||
ext_0_idx = k;
|
||||
ext_0_objVec = _pop[k].objectiveVector();
|
||||
}
|
||||
else if ( (_pop[k].objectiveVector()[0] == ext_0_objVec[0]) && (_pop[k].objectiveVector()[1] < ext_0_objVec[1]) )
|
||||
{
|
||||
ext_0_idx = k;
|
||||
ext_0_objVec = _pop[k].objectiveVector();
|
||||
}
|
||||
// ext_1
|
||||
else if (_pop[k].objectiveVector()[1] < ext_1_objVec[1])
|
||||
{
|
||||
ext_1_idx = k;
|
||||
ext_1_objVec = _pop[k].objectiveVector();
|
||||
}
|
||||
else if ( (_pop[k].objectiveVector()[1] == ext_1_objVec[1]) && (_pop[k].objectiveVector()[0] < ext_1_objVec[0]) )
|
||||
{
|
||||
ext_1_idx = k;
|
||||
ext_1_objVec = _pop[k].objectiveVector();
|
||||
}
|
||||
}
|
||||
// worst init
|
||||
if (ext_0_idx == -1)
|
||||
{
|
||||
ind = 0;
|
||||
while (ind == ext_1_idx)
|
||||
{
|
||||
ind++;
|
||||
}
|
||||
worst_idx = ind;
|
||||
worst_objVec = _pop[ind].objectiveVector();
|
||||
worst_fitness = _pop[ind].fitness();
|
||||
}
|
||||
else if (ext_1_idx == -1)
|
||||
{
|
||||
ind = 0;
|
||||
while (ind == ext_0_idx)
|
||||
{
|
||||
ind++;
|
||||
}
|
||||
worst_idx = ind;
|
||||
worst_objVec = _pop[ind].objectiveVector();
|
||||
worst_fitness = _pop[ind].fitness();
|
||||
}
|
||||
else
|
||||
{
|
||||
worst_idx = -1;
|
||||
worst_objVec = x_objVec;
|
||||
worst_fitness = x_fitness;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// who is the worst ?
|
||||
for (unsigned int j=0; j<_pop.size(); j++)
|
||||
{
|
||||
if ( (j!=ext_0_idx) && (j!=ext_1_idx) )
|
||||
{
|
||||
if (_pop[j].fitness() < worst_fitness)
|
||||
{
|
||||
worst_idx = j;
|
||||
worst_objVec = _pop[j].objectiveVector();
|
||||
worst_fitness = _pop[j].fitness();
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the worst solution is the new one
|
||||
if (worst_idx == -1)
|
||||
{
|
||||
// if all its neighbours have been explored,
|
||||
// let's explore the neighborhoud of the next individual
|
||||
if (! nextMove(move, _pop[i]))
|
||||
{
|
||||
i++;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the worst solution is located before _pop[i]
|
||||
else if (worst_idx <= i)
|
||||
{
|
||||
// the new solution takes place insteed of _pop[worst_idx]
|
||||
_pop[worst_idx] = _pop[i];
|
||||
move(_pop[worst_idx]);
|
||||
_pop[worst_idx].objectiveVector(x_objVec);
|
||||
_pop[worst_idx].fitness(x_fitness);
|
||||
// let's explore the neighborhoud of the next individual
|
||||
i++;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
// if the worst solution is located after _pop[i]
|
||||
else if (worst_idx > i)
|
||||
{
|
||||
// the new solution takes place insteed of _pop[i+1] and _pop[worst_idx] is deleted
|
||||
_pop[worst_idx] = _pop[i+1];
|
||||
_pop[i+1] = _pop[i];
|
||||
move(_pop[i+1]);
|
||||
_pop[i+1].objectiveVector(x_objVec);
|
||||
_pop[i+1].fitness(x_fitness);
|
||||
// let's explore the neighborhoud of the individual _pop[i+2]
|
||||
i += 2;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
// update fitness values
|
||||
fitnessAssignment.updateByDeleting(_pop, worst_objVec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// INUTILE !!!!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Apply one step of the local search to the population _pop
|
||||
* @param _pop the population
|
||||
*/
|
||||
void new_oneStep (eoPop < MOEOT > & _pop)
|
||||
{
|
||||
// the move
|
||||
Move move;
|
||||
// the objective vector and the fitness of the current solution
|
||||
ObjectiveVector x_objVec;
|
||||
double x_fitness;
|
||||
// the index, the objective vector and the fitness of the worst solution in the population (-1 implies that the worst is the newly created one)
|
||||
int worst_idx;
|
||||
ObjectiveVector worst_objVec;
|
||||
double worst_fitness;
|
||||
////////////////////////////////////////////
|
||||
// the index of the extreme non-dominated points
|
||||
int ext_0_idx, ext_1_idx;
|
||||
unsigned int ind;
|
||||
////////////////////////////////////////////
|
||||
// the index current of the current solution to be explored
|
||||
unsigned int i=0;
|
||||
// initilization of the move for the first individual
|
||||
moveInit(move, _pop[i]);
|
||||
while (i<_pop.size() && continuator(_pop))
|
||||
{
|
||||
// x = one neigbour of pop[i]
|
||||
// evaluate x in the objective space
|
||||
x_objVec = moveIncrEval(move, _pop[i]);
|
||||
// update every fitness values to take x into account and compute the fitness of x
|
||||
x_fitness = fitnessAssignment.updateByAdding(_pop, x_objVec);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// extremes solutions
|
||||
OneObjectiveComparator comp0(0);
|
||||
ext_0_idx = std::min_element(_pop.begin(), _pop.end(), comp0) - _pop.begin();
|
||||
OneObjectiveComparator comp1(1);
|
||||
ext_1_idx = std::min_element(_pop.begin(), _pop.end(), comp1) - _pop.begin();
|
||||
// new = extreme ?
|
||||
if (x_objVec[0] < _pop[ext_0_idx].objectiveVector()[0])
|
||||
{
|
||||
ext_0_idx = -1;
|
||||
}
|
||||
else if ( (x_objVec[0] == _pop[ext_0_idx].objectiveVector()[0]) && (x_objVec[1] < _pop[ext_0_idx].objectiveVector()[1]) )
|
||||
{
|
||||
ext_0_idx = -1;
|
||||
}
|
||||
else if (x_objVec[1] < _pop[ext_1_idx].objectiveVector()[1])
|
||||
{
|
||||
ext_1_idx = -1;
|
||||
}
|
||||
else if ( (x_objVec[1] == _pop[ext_1_idx].objectiveVector()[1]) && (x_objVec[0] < _pop[ext_1_idx].objectiveVector()[0]) )
|
||||
{
|
||||
ext_1_idx = -1;
|
||||
}
|
||||
// worst init
|
||||
if (ext_0_idx == -1)
|
||||
{
|
||||
ind = 0;
|
||||
while (ind == ext_1_idx)
|
||||
{
|
||||
ind++;
|
||||
}
|
||||
worst_idx = ind;
|
||||
worst_objVec = _pop[ind].objectiveVector();
|
||||
worst_fitness = _pop[ind].fitness();
|
||||
}
|
||||
else if (ext_1_idx == -1)
|
||||
{
|
||||
ind = 0;
|
||||
while (ind == ext_0_idx)
|
||||
{
|
||||
ind++;
|
||||
}
|
||||
worst_idx = ind;
|
||||
worst_objVec = _pop[ind].objectiveVector();
|
||||
worst_fitness = _pop[ind].fitness();
|
||||
}
|
||||
else
|
||||
{
|
||||
worst_idx = -1;
|
||||
worst_objVec = x_objVec;
|
||||
worst_fitness = x_fitness;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// who is the worst ?
|
||||
for (unsigned int j=0; j<_pop.size(); j++)
|
||||
{
|
||||
if ( (j!=ext_0_idx) && (j!=ext_1_idx) )
|
||||
{
|
||||
if (_pop[j].fitness() < worst_fitness)
|
||||
{
|
||||
worst_idx = j;
|
||||
worst_objVec = _pop[j].objectiveVector();
|
||||
worst_fitness = _pop[j].fitness();
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the worst solution is the new one
|
||||
if (worst_idx == -1)
|
||||
{
|
||||
// if all its neighbours have been explored,
|
||||
// let's explore the neighborhoud of the next individual
|
||||
if (! nextMove(move, _pop[i]))
|
||||
{
|
||||
i++;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the worst solution is located before _pop[i]
|
||||
else if (worst_idx <= i)
|
||||
{
|
||||
// the new solution takes place insteed of _pop[worst_idx]
|
||||
_pop[worst_idx] = _pop[i];
|
||||
move(_pop[worst_idx]);
|
||||
_pop[worst_idx].objectiveVector(x_objVec);
|
||||
_pop[worst_idx].fitness(x_fitness);
|
||||
// let's explore the neighborhoud of the next individual
|
||||
i++;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
// if the worst solution is located after _pop[i]
|
||||
else if (worst_idx > i)
|
||||
{
|
||||
// the new solution takes place insteed of _pop[i+1] and _pop[worst_idx] is deleted
|
||||
_pop[worst_idx] = _pop[i+1];
|
||||
_pop[i+1] = _pop[i];
|
||||
move(_pop[i+1]);
|
||||
_pop[i+1].objectiveVector(x_objVec);
|
||||
_pop[i+1].fitness(x_fitness);
|
||||
// let's explore the neighborhoud of the individual _pop[i+2]
|
||||
i += 2;
|
||||
if (i<_pop.size())
|
||||
{
|
||||
// initilization of the move for the next individual
|
||||
moveInit(move, _pop[i]);
|
||||
}
|
||||
}
|
||||
// update fitness values
|
||||
fitnessAssignment.updateByDeleting(_pop, worst_objVec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
class OneObjectiveComparator : public moeoComparator < MOEOT >
|
||||
{
|
||||
public:
|
||||
OneObjectiveComparator(unsigned int _obj) : obj(_obj)
|
||||
{
|
||||
if (obj > MOEOT::ObjectiveVector::nObjectives())
|
||||
{
|
||||
throw std::runtime_error("Problem with the index of objective in OneObjectiveComparator");
|
||||
}
|
||||
}
|
||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||
{
|
||||
if (_moeo1.objectiveVector()[obj] < _moeo2.objectiveVector()[obj])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (_moeo1.objectiveVector()[obj] == _moeo2.objectiveVector()[obj]) && (_moeo1.objectiveVector()[(obj+1)%2] < _moeo2.objectiveVector()[(obj+1)%2]);
|
||||
}
|
||||
}
|
||||
private:
|
||||
unsigned int obj;
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOIBMOLS_H_*/
|
||||
246
branches/contribution/branches/MOLS/src/IBMOLS/moeoIteratedIBMOLS.h
Executable file
246
branches/contribution/branches/MOLS/src/IBMOLS/moeoIteratedIBMOLS.h
Executable file
|
|
@ -0,0 +1,246 @@
|
|||
/*
|
||||
* <moeoIteratedIBMOLS.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOITERATEDIBMOLS_H_
|
||||
#define MOEOITERATEDIBMOLS_H_
|
||||
|
||||
#include <eoContinue.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <eoOp.h>
|
||||
#include <eoPop.h>
|
||||
#include <utils/rnd_generators.h>
|
||||
#include <moMove.h>
|
||||
#include <moMoveInit.h>
|
||||
#include <moNextMove.h>
|
||||
#include <moeoIBMOLS.h>
|
||||
#include <moeoPopLS.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <fitness/moeoBinaryIndicatorBasedFitnessAssignment.h>
|
||||
#include <moMoveIncrEval.h>
|
||||
|
||||
|
||||
|
||||
//#include <rsCrossQuad.h>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Iterated version of IBMOLS as described in
|
||||
* Basseur M., Burke K. : "Indicator-Based Multi-Objective Local Search" (2007).
|
||||
*/
|
||||
template < class MOEOT, class Move >
|
||||
class moeoIteratedIBMOLS : public moeoPopLS < Move>
|
||||
{
|
||||
public:
|
||||
|
||||
/** The type of objective vector */
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
|
||||
/**
|
||||
* Ctor.
|
||||
* @param _moveInit the move initializer
|
||||
* @param _nextMove the neighborhood explorer
|
||||
* @param _eval the full evaluation
|
||||
* @param _moveIncrEval the incremental evaluation
|
||||
* @param _fitnessAssignment the fitness assignment strategy
|
||||
* @param _continuator the stopping criteria
|
||||
* @param _arch the archive
|
||||
* @param _monOp the monary operator
|
||||
* @param _randomMonOp the random monary operator (or random initializer)
|
||||
* @param _nNoiseIterations the number of iterations to apply the random noise
|
||||
*/
|
||||
moeoIteratedIBMOLS(
|
||||
moMoveInit < Move > & _moveInit,
|
||||
moNextMove < Move > & _nextMove,
|
||||
eoEvalFunc < MOEOT > & _eval,
|
||||
moMoveIncrEval < Move, ObjectiveVector > & _moveIncrEval,
|
||||
moeoBinaryIndicatorBasedFitnessAssignment < MOEOT > & _fitnessAssignment,
|
||||
eoContinue < MOEOT > & _continuator,
|
||||
moeoArchive < MOEOT > & _arch,
|
||||
eoMonOp < MOEOT > & _monOp,
|
||||
eoMonOp < MOEOT > & _randomMonOp,
|
||||
unsigned int _nNoiseIterations=1
|
||||
) :
|
||||
ibmols(_moveInit, _nextMove, _eval, _moveIncrEval, _fitnessAssignment, _continuator, _arch),
|
||||
eval(_eval),
|
||||
continuator(_continuator),
|
||||
arch(_arch),
|
||||
monOp(_monOp),
|
||||
randomMonOp(_randomMonOp),
|
||||
nNoiseIterations(_nNoiseIterations)
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Apply the local search iteratively until the stopping criteria is met.
|
||||
* @param _pop the initial population
|
||||
*/
|
||||
void operator() (eoPop < MOEOT > & _pop)
|
||||
{
|
||||
for (unsigned int i=0; i<_pop.size(); i++)
|
||||
{
|
||||
eval(_pop[i]);
|
||||
}
|
||||
|
||||
arch(_pop);
|
||||
ibmols(_pop);
|
||||
while (continuator(arch))
|
||||
{
|
||||
// generate new solutions from the archive
|
||||
generateNewSolutions(_pop);
|
||||
// apply the local search (the global archive is updated in the sub-function)
|
||||
ibmols(_pop);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** the local search to iterate */
|
||||
moeoIBMOLS < MOEOT, Move > ibmols;
|
||||
/** the full evaluation */
|
||||
eoEvalFunc < MOEOT > & eval;
|
||||
/** the stopping criteria */
|
||||
eoContinue < MOEOT > & continuator;
|
||||
/** archive */
|
||||
moeoArchive < MOEOT > & arch;
|
||||
/** the monary operator */
|
||||
eoMonOp < MOEOT > & monOp;
|
||||
/** the random monary operator (or random initializer) */
|
||||
eoMonOp < MOEOT > & randomMonOp;
|
||||
/** the number of iterations to apply the random noise */
|
||||
unsigned int nNoiseIterations;
|
||||
|
||||
|
||||
/**
|
||||
* Creates new population randomly initialized and/or initialized from the archive _arch.
|
||||
* @param _pop the output population
|
||||
*/
|
||||
void generateNewSolutions(eoPop < MOEOT > & _pop)
|
||||
{
|
||||
// shuffle vector for the random selection of individuals
|
||||
std::vector<unsigned int> shuffle;
|
||||
shuffle.resize(std::max(_pop.size(), arch.size()));
|
||||
// init shuffle
|
||||
for (unsigned int i=0; i<shuffle.size(); i++)
|
||||
{
|
||||
shuffle[i] = i;
|
||||
}
|
||||
// randomize shuffle
|
||||
UF_random_generator <unsigned int> gen;
|
||||
std::random_shuffle(shuffle.begin(), shuffle.end(), gen);
|
||||
// start the creation of new solutions
|
||||
for (unsigned int i=0; i<_pop.size(); i++)
|
||||
{
|
||||
if (shuffle[i] < arch.size()) // the given archive contains the individual i
|
||||
{
|
||||
// add it to the resulting pop
|
||||
_pop[i] = arch[shuffle[i]];
|
||||
// apply noise
|
||||
for (unsigned int j=0; j<nNoiseIterations; j++)
|
||||
{
|
||||
monOp(_pop[i]);
|
||||
}
|
||||
}
|
||||
else // a random solution needs to be added
|
||||
{
|
||||
// random initialization
|
||||
randomMonOp(_pop[i]);
|
||||
}
|
||||
// evaluation of the new individual
|
||||
_pop[i].invalidate();
|
||||
eval(_pop[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// A DEVELOPPER RAPIDEMENT POUR TESTER AVEC CROSSOVER //
|
||||
/*
|
||||
void generateNewSolutions2(eoPop < MOEOT > & _pop, const moeoArchive < MOEOT > & _arch)
|
||||
{
|
||||
// here, we must have a QuadOp !
|
||||
//eoQuadOp < MOEOT > quadOp;
|
||||
rsCrossQuad quadOp;
|
||||
// shuffle vector for the random selection of individuals
|
||||
vector<unsigned int> shuffle;
|
||||
shuffle.resize(_arch.size());
|
||||
// init shuffle
|
||||
for (unsigned int i=0; i<shuffle.size(); i++)
|
||||
{
|
||||
shuffle[i] = i;
|
||||
}
|
||||
// randomize shuffle
|
||||
UF_random_generator <unsigned int int> gen;
|
||||
std::random_shuffle(shuffle.begin(), shuffle.end(), gen);
|
||||
// start the creation of new solutions
|
||||
unsigned int i=0;
|
||||
while ((i<_pop.size()-1) && (i<_arch.size()-1))
|
||||
{
|
||||
_pop[i] = _arch[shuffle[i]];
|
||||
_pop[i+1] = _arch[shuffle[i+1]];
|
||||
// then, apply the operator nIterationsNoise times
|
||||
for (unsigned int j=0; j<nNoiseIterations; j++)
|
||||
{
|
||||
quadOp(_pop[i], _pop[i+1]);
|
||||
}
|
||||
eval(_pop[i]);
|
||||
eval(_pop[i+1]);
|
||||
i=i+2;
|
||||
}
|
||||
// do we have to add some random solutions ?
|
||||
while (i<_pop.size())
|
||||
{
|
||||
randomMonOp(_pop[i]);
|
||||
eval(_pop[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEOITERATEDIBMOLS_H_*/
|
||||
53
branches/contribution/branches/MOLS/src/IBMOLS/moeoLS.h
Normal file
53
branches/contribution/branches/MOLS/src/IBMOLS/moeoLS.h
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* <moeoLS.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOLS_H_
|
||||
#define MOEOLS_H_
|
||||
|
||||
#include <eoFunctor.h>
|
||||
#include <algo/moeoAlgo.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
|
||||
/**
|
||||
* Abstract class for local searches applied to multi-objective optimization.
|
||||
* Starting from a Type (i.e.: an individual, a pop, an archive...), it produces a set of new non-dominated solutions.
|
||||
*/
|
||||
template < class MOEOT, class Type >
|
||||
class moeoLS: public moeoAlgo, public eoBF < Type, moeoArchive < MOEOT > &, void >
|
||||
{};
|
||||
|
||||
#endif /*MOEOLS_H_*/
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* <moeoMoveIncrEval.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
#ifndef _MOEOMOVEINCREVAL_H
|
||||
#define _MOEOMOVEINCREVAL_H
|
||||
|
||||
#include <eoFunctor.h>
|
||||
|
||||
template < class Move >
|
||||
class moeoMoveIncrEval : public eoBF < const Move &, const typename Move::EOType &, typename Move::EOType::ObjectiveVector >
|
||||
{};
|
||||
|
||||
#endif
|
||||
51
branches/contribution/branches/MOLS/src/IBMOLS/moeoPopLS.h
Executable file
51
branches/contribution/branches/MOLS/src/IBMOLS/moeoPopLS.h
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* <moeoPopLS.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
* Jérémie Humeau
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEOPOPLS_H_
|
||||
#define MOEOPOPLS_H_
|
||||
|
||||
#include <algo/moeoPopAlgo.h>
|
||||
|
||||
/**
|
||||
* Abstract class for Population based multi-objective local search.
|
||||
*/
|
||||
template < class Move >
|
||||
class moeoPopLS : public moeoPopAlgo < typename Move::EOType >
|
||||
{};
|
||||
|
||||
#endif /*MOEOPOPLS_H_*/
|
||||
98
branches/contribution/branches/MOLS/src/eoTenTimeContinue.h
Executable file
98
branches/contribution/branches/MOLS/src/eoTenTimeContinue.h
Executable file
|
|
@ -0,0 +1,98 @@
|
|||
#ifndef _eoTenTimeContinue_h
|
||||
#define _eoTenTimeContinue_h
|
||||
|
||||
#include <time.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <eoContinue.h>
|
||||
|
||||
template< class EOT>
|
||||
class eoTenTimeContinue: public eoContinue<EOT>
|
||||
{
|
||||
public:
|
||||
|
||||
eoTenTimeContinue(unsigned int _maxTime, std::string _fileName, moeoArchive<EOT> & _arch) :
|
||||
start(time(0)), maxTime(_maxTime), id(1), fileName(_fileName), arch(_arch) {}
|
||||
|
||||
|
||||
// _pop must be an archive
|
||||
virtual bool operator() (const eoPop<EOT> & _pop)
|
||||
{
|
||||
unsigned int diff = (unsigned int) difftime(time(0), start);
|
||||
if (diff >= (id * maxTime/10) )
|
||||
{
|
||||
time_t begin=time(0);
|
||||
save(_pop);
|
||||
id++;
|
||||
start= start - (time(0)-begin);
|
||||
//operator()(_pop);
|
||||
}
|
||||
if (diff >= maxTime)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual std::string className(void) const
|
||||
{
|
||||
return "eoTenTimeContinue";
|
||||
}
|
||||
|
||||
|
||||
void readFrom (std :: istream & __is)
|
||||
{
|
||||
|
||||
__is >> start;
|
||||
}
|
||||
|
||||
|
||||
void printOn (std :: ostream & __os) const
|
||||
{
|
||||
|
||||
__os << start << ' ' << std :: endl;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
time_t start;
|
||||
unsigned int maxTime;
|
||||
unsigned int id;
|
||||
std::string fileName;
|
||||
moeoArchive<EOT> & arch;
|
||||
|
||||
|
||||
void save(const eoPop<EOT> & _pop)
|
||||
{
|
||||
// update the archive
|
||||
arch(_pop);
|
||||
// save the archive contents in a file
|
||||
std::string tmp = fileName;
|
||||
std::ostringstream os;
|
||||
os << id;
|
||||
tmp += '.';
|
||||
tmp += os.str();
|
||||
std::ofstream outfile(tmp.c_str());
|
||||
// std::cout << "save " << tmp << " - " << difftime(time(0), start) << std::endl;
|
||||
unsigned int nObj = EOT::ObjectiveVector::nObjectives();
|
||||
for (unsigned int i=0; i<arch.size(); i++)
|
||||
{
|
||||
for (unsigned int j=0; j<nObj; j++)
|
||||
{
|
||||
outfile << arch[i].objectiveVector()[j];
|
||||
if (j != nObj -1)
|
||||
{
|
||||
outfile << ' ';
|
||||
}
|
||||
}
|
||||
outfile << std::endl;
|
||||
}
|
||||
outfile.close();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
107
branches/contribution/branches/MOLS/src/moeoAllSolAllNeighborsExpl.h
Executable file
107
branches/contribution/branches/MOLS/src/moeoAllSolAllNeighborsExpl.h
Executable file
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* <moeoAllSolAllNeighborsExpl.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
* Jérémie Humeau
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _MOEOALLSOLALLNEIGHBORSEXPL_H
|
||||
#define _MOEOALLSOLALLNEIGHBORSEXPL_H
|
||||
|
||||
#include <eo>
|
||||
#include <moeo>
|
||||
#include <moMove.h>
|
||||
#include <moMoveInit.h>
|
||||
#include <moNextMove.h>
|
||||
#include <moMoveIncrEval.h>
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
template < class Move >
|
||||
class moeoAllSolAllNeighborsExpl : public moeoPopNeighborhoodExplorer < Move >
|
||||
{
|
||||
typedef typename Move::EOType MOEOT;
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
public:
|
||||
|
||||
moeoAllSolAllNeighborsExpl(
|
||||
moMoveInit < Move > & _moveInit,
|
||||
moNextMove < Move > & _nextMove,
|
||||
moMoveIncrEval < Move, ObjectiveVector > & _incrEval)
|
||||
: moveInit(_moveInit), nextMove(_nextMove), incrEval(_incrEval){}
|
||||
|
||||
void operator()(eoPop < MOEOT > & _src, eoPop < MOEOT > & _dest)
|
||||
{
|
||||
Move move;
|
||||
ObjectiveVector objVec;
|
||||
for (unsigned int i=0; i<_src.size(); i++)
|
||||
{
|
||||
if (_src[i].flag() == 0)
|
||||
{
|
||||
moveInit(move, _src[i]);
|
||||
do
|
||||
{
|
||||
objVec = incrEval(move, _src[i]);
|
||||
if (! comparator (objVec, _src[i].objectiveVector()))
|
||||
{
|
||||
if (objVec != _src[i].objectiveVector())
|
||||
{
|
||||
_dest.push_back(_src[i]);
|
||||
move(_dest.back());
|
||||
_dest.back().objectiveVector(objVec);
|
||||
_dest.back().flag(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (nextMove(move, _src[i]));
|
||||
_src[i].flag(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
/** the move initializer */
|
||||
moMoveInit < Move > & moveInit;
|
||||
/** the neighborhood explorer */
|
||||
moNextMove < Move > & nextMove;
|
||||
/** the incremental evaluation */
|
||||
moMoveIncrEval < Move, ObjectiveVector > & incrEval;
|
||||
/** comparator */
|
||||
moeoParetoObjectiveVectorComparator<ObjectiveVector> comparator;
|
||||
|
||||
};
|
||||
|
||||
#endif /*_MOEOALLSOLALLNEIGHBORSEXPL_H_*/
|
||||
167
branches/contribution/branches/MOLS/src/moeoAllSolOneNeighborExpl.h
Executable file
167
branches/contribution/branches/MOLS/src/moeoAllSolOneNeighborExpl.h
Executable file
|
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
* <moeoAllSolOneNeighborExpl.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
* Jérémie Humeau
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _MOEOALLSOLONENEIGHBOREXPL_H
|
||||
#define _MOEOALLSOLONENEIGHBOREXPL_H
|
||||
|
||||
#include <eo>
|
||||
#include <moeo>
|
||||
#include <moMove.h>
|
||||
#include <moMoveInit.h>
|
||||
#include <moNextMove.h>
|
||||
#include <moMoveIncrEval.h>
|
||||
#include <queue>
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
template < class Move >
|
||||
class moeoAllSolOneNeighborExpl : public moeoPopNeighborhoodExplorer < Move >
|
||||
{
|
||||
typedef typename Move::EOType MOEOT;
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
public:
|
||||
|
||||
moeoAllSolOneNeighborExpl(
|
||||
moMoveInit < Move > & _moveInit,
|
||||
moNextMove < Move > & _nextMove,
|
||||
moMoveIncrEval < Move, ObjectiveVector > & _incrEval)
|
||||
: moveInit(_moveInit), nextMove(_nextMove), incrEval(_incrEval){}
|
||||
|
||||
|
||||
void operator()(eoPop < MOEOT > & _src, eoPop < MOEOT > & _dest)
|
||||
{
|
||||
int id=0;
|
||||
for (unsigned int i=0; i<_src.size(); i++)
|
||||
{
|
||||
//solution without move
|
||||
if (_src[i].flag() == 0 )
|
||||
{
|
||||
//No move are available -> create a new Move
|
||||
if (availableMove.empty())
|
||||
{
|
||||
//create a new move
|
||||
Move newMove;
|
||||
//add it to moveVector
|
||||
moveVector.push_back(newMove);
|
||||
//get the moveVector size
|
||||
id = moveVector.size();
|
||||
//add a flag to _src
|
||||
_src[i].flag(-id);
|
||||
//Init the move
|
||||
moveInit(moveVector[id-1], _src[i]);
|
||||
// Apply move or not
|
||||
m(_src, _dest, i, moveVector[id-1]);
|
||||
//If it the last move set solution as visited (flag >0) and set the move as available
|
||||
if (!nextMove(moveVector[id-1], _src[i]))
|
||||
{
|
||||
_src[i].flag(1);
|
||||
availableMove.push(id-1);
|
||||
}
|
||||
}
|
||||
//A move is available -> get it
|
||||
else
|
||||
{
|
||||
//get the id of an available move
|
||||
id = availableMove.back();
|
||||
//remove it from available move
|
||||
availableMove.pop();
|
||||
//add a flag to _src
|
||||
_src[i].flag(-1 * (id+1));
|
||||
//Init the move
|
||||
moveInit(moveVector[id], _src[i]);
|
||||
// Apply move or not
|
||||
m(_src, _dest, i, moveVector[id]);
|
||||
if (!nextMove(moveVector[id], _src[i]))
|
||||
{
|
||||
_src[i].flag(1);
|
||||
availableMove.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
//solution which have already a move -> do next move
|
||||
else if (_src[i].flag() < 0)
|
||||
{
|
||||
id= (_src[i].flag() + 1) * -1;
|
||||
m(_src, _dest, i, moveVector[id]);
|
||||
if (!nextMove(moveVector[id], _src[i]))
|
||||
{
|
||||
_src[i].flag(1);
|
||||
availableMove.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void m(eoPop < MOEOT > & _src, eoPop < MOEOT > & _dest, unsigned int i, Move & move)
|
||||
{
|
||||
ObjectiveVector objVec = incrEval(move, _src[i]);
|
||||
// add the moved sol ?
|
||||
if (! comparator (objVec, _src[i].objectiveVector()))
|
||||
{
|
||||
if (objVec != _src[i].objectiveVector())
|
||||
{
|
||||
_dest.push_back(_src[i]);
|
||||
move(_dest.back());
|
||||
_dest.back().objectiveVector(objVec);
|
||||
_dest.back().flag(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** queue of available move */
|
||||
std::queue < unsigned int > availableMove;
|
||||
/** the move vector*/
|
||||
std::vector < Move > moveVector;
|
||||
/** the move initializer */
|
||||
moMoveInit < Move > & moveInit;
|
||||
/** the neighborhood explorer */
|
||||
moNextMove < Move > & nextMove;
|
||||
/** the incremental evaluation */
|
||||
moMoveIncrEval < Move, ObjectiveVector > & incrEval;
|
||||
/** comparator */
|
||||
moeoParetoObjectiveVectorComparator<ObjectiveVector> comparator;
|
||||
|
||||
};
|
||||
|
||||
#endif /*_MOEOALLSOLONENEIGHBOREXPL_H_*/
|
||||
226
branches/contribution/branches/MOLS/src/moeoNewArchive.h
Executable file
226
branches/contribution/branches/MOLS/src/moeoNewArchive.h
Executable file
|
|
@ -0,0 +1,226 @@
|
|||
/*
|
||||
* <moeoArchive.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Arnaud Liefooghe
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MOEONEWARCHIVE_H_
|
||||
#define MOEONEWARCHIVE_H_
|
||||
|
||||
#include <comparator/moeoObjectiveVectorComparator.h>
|
||||
#include <comparator/moeoParetoObjectiveVectorComparator.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
|
||||
template < class MOEOT >
|
||||
class moeoNewArchive : public moeoArchive < MOEOT >
|
||||
{
|
||||
public:
|
||||
|
||||
using moeoArchive < MOEOT > :: size;
|
||||
using moeoArchive < MOEOT > :: operator[];
|
||||
using moeoArchive < MOEOT > :: back;
|
||||
using moeoArchive < MOEOT > :: pop_back;
|
||||
|
||||
|
||||
/**
|
||||
* The type of an objective vector for a solution
|
||||
*/
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
|
||||
/**
|
||||
* Default ctor.
|
||||
* The moeoObjectiveVectorComparator used to compare solutions is based on Pareto dominance
|
||||
*/
|
||||
moeoNewArchive() : moeoArchive < MOEOT >(), comparator(paretoComparator)
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Ctor
|
||||
* @param _comparator the moeoObjectiveVectorComparator used to compare solutions
|
||||
*/
|
||||
moeoNewArchive(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator) : eoPop < MOEOT >(), comparator(_comparator)
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the current archive dominates _objectiveVector according to the moeoObjectiveVectorComparator given in the constructor
|
||||
* @param _objectiveVector the objective vector to compare with the current archive
|
||||
*/
|
||||
bool dominates (const ObjectiveVector & _objectiveVector) const
|
||||
{
|
||||
for (unsigned int i = 0; i<size(); i++)
|
||||
{
|
||||
// if _objectiveVector is dominated by the ith individual of the archive...
|
||||
if ( comparator(_objectiveVector, operator[](i).objectiveVector()) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the current archive already contains a solution with the same objective values than _objectiveVector
|
||||
* @param _objectiveVector the objective vector to compare with the current archive
|
||||
*/
|
||||
bool contains (const ObjectiveVector & _objectiveVector) const
|
||||
{
|
||||
for (unsigned int i = 0; i<size(); i++)
|
||||
{
|
||||
if (operator[](i).objectiveVector() == _objectiveVector)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the archive with a given individual _moeo
|
||||
* @param _moeo the given individual
|
||||
* @return true if _moeo is added to the archive
|
||||
*/
|
||||
bool operator()(const MOEOT & _moeo)
|
||||
{
|
||||
return update(_moeo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the archive with a given population _pop
|
||||
* @param _pop the given population
|
||||
* @return true if a _pop[i] is added to the archive
|
||||
*/
|
||||
bool operator()(const eoPop < MOEOT > & _pop)
|
||||
{
|
||||
bool res = false;
|
||||
for (unsigned int i=0; i<_pop.size(); i++)
|
||||
{
|
||||
res = (*this).update(_pop[i]) || res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the current archive contains the same objective vectors than the given archive _arch
|
||||
* @param _arch the given archive
|
||||
*/
|
||||
bool equals (const moeoArchive < MOEOT > & _arch)
|
||||
{
|
||||
for (unsigned int i=0; i<size(); i++)
|
||||
{
|
||||
if (! _arch.contains(operator[](i).objectiveVector()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (unsigned int i=0; i<_arch.size() ; i++)
|
||||
{
|
||||
if (! contains(_arch[i].objectiveVector()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** The moeoObjectiveVectorComparator used to compare solutions */
|
||||
moeoObjectiveVectorComparator < ObjectiveVector > & comparator;
|
||||
/** A moeoObjectiveVectorComparator based on Pareto dominance (used as default) */
|
||||
moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator;
|
||||
|
||||
|
||||
/**
|
||||
* Updates the archive with a given individual _moeo *** NEW ***
|
||||
* @param _moeo the given individual
|
||||
*/
|
||||
bool update(const MOEOT & _moeo)
|
||||
{
|
||||
// first step: removing the dominated solutions from the archive
|
||||
for (unsigned int j=0; j<size();)
|
||||
{
|
||||
// if the jth solution contained in the archive is dominated by _moeo
|
||||
if ( comparator(operator[](j).objectiveVector(), _moeo.objectiveVector()) )
|
||||
{
|
||||
operator[](j) = back();
|
||||
pop_back();
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// else if (_moeo.objectiveVector() == operator[](j).objectiveVector())
|
||||
// {
|
||||
// operator[](j) = back();
|
||||
// pop_back();
|
||||
// }
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
else
|
||||
{
|
||||
j++;
|
||||
}
|
||||
}
|
||||
// second step: is _moeo dominated?
|
||||
bool dom = false;
|
||||
for (unsigned int j=0; j<size(); j++)
|
||||
{
|
||||
// if _moeo is dominated by the jth solution contained in the archive
|
||||
if ( comparator(_moeo.objectiveVector(), operator[](j).objectiveVector()) )
|
||||
{
|
||||
dom = true;
|
||||
break;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
else if ( _moeo.objectiveVector() == operator[](j).objectiveVector() )
|
||||
{
|
||||
dom = true;
|
||||
break;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
if (!dom)
|
||||
{
|
||||
push_back(_moeo);
|
||||
}
|
||||
return !dom;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /*MOEONEWARCHIVE_H_ */
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue