git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1406 331e1502-861f-0410-8da2-ba01fb791d7f

This commit is contained in:
jhumeau 2009-02-06 09:32:27 +00:00
commit e0ce1567f5
2 changed files with 37 additions and 62 deletions

View file

@ -13,7 +13,8 @@ INCLUDE_DIRECTORIES(${PARADISEO_EO_SRC_DIR}/src)
INCLUDE_DIRECTORIES(${PARADISEO_MO_SRC_DIR}/src)
INCLUDE_DIRECTORIES(${PARADISEO_MOEO_SRC_DIR}/src)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${SOURCES_DIR})
INCLUDE_DIRECTORIES(${FLOWSHOP_SRC_DIR}/src)
INCLUDE_DIRECTORIES(${SOURCES_DIR}/src)
######################################################################################
@ -23,7 +24,7 @@ INCLUDE_DIRECTORIES(${SOURCES_DIR})
### 2) Specify where CMake can find the libraries
######################################################################################
LINK_DIRECTORIES(${PARADISEO_EO_BIN_DIR}/lib ${PARADISEO_MOEO_BIN_DIR}/lib)
LINK_DIRECTORIES(${PARADISEO_EO_BIN_DIR}/lib ${PARADISEO_MOEO_BIN_DIR}/lib ${FLOWSHOP_LIB_OUTPUT_PATH})
######################################################################################
@ -48,7 +49,7 @@ ENDFOREACH (test)
# Link the librairies
FOREACH (test ${TEST_LIST})
TARGET_LINK_LIBRARIES(${test} moeo ga es eoutils eo)
TARGET_LINK_LIBRARIES(${test} moeo flowshop ga es eoutils eo)
ENDFOREACH (test)
######################################################################################

View file

@ -1,70 +1,44 @@
#include <eo>
#include <moeo>
#include <moeoPopNeighborhoodExplorer.h>
#include <moeoAllSolAllNeighborsExpl.h>
#include <moeoPopLS.h>
#include <moeoUnifiedDominanceBasedLS.h>
#include <moMove.h>
#include <FlowShop.h>
#include <exchange_move.h>
#include <exchange_move_init.h>
#include <exchange_move_next.h>
#include <FlowShopEval.h>
// for the creation of an evaluator
#include <make_eval_FlowShop.h>
// for the creation of an initializer
#include <make_genotype_FlowShop.h>
// for the creation of the variation operators
#include <make_op_FlowShop.h>
// how to initialize the population
#include <do/make_pop.h>
class ObjectiveVectorTraits : public moeoObjectiveVectorTraits
int main(int argc, char* argv[])
{
public:
static bool minimizing (int i)
{
return true;
}
static bool maximizing (int i)
{
return false;
}
static unsigned int nObjectives ()
{
return 2;
}
};
typedef moeoRealObjectiveVector < ObjectiveVectorTraits > ObjectiveVector;
class Solution : public moeoRealVector < ObjectiveVector, double, double >
{
public:
Solution() : moeoRealVector < ObjectiveVector, double, double > (1) {}
};
class dummyMove : public moMove < Solution >
{
public :
void operator () (Solution & _solution){}
} ;
int main()
{
// objective vectors
ObjectiveVector obj0, obj1, obj2, obj3, obj4, obj5, obj6;
obj0[0] = 2;
obj0[1] = 5;
obj1[0] = 3;
obj1[1] = 3;
obj2[0] = 4;
obj2[1] = 1;
obj3[0] = 5;
obj3[1] = 5;
eoParser parser(argc, argv); // for user-parameter reading
eoState state; // to keep all things allocated
ExchangeMoveNext moveNext;
ExchangeMoveInit moveInit;
ExchangeMove move;
eoEvalFuncCounter<FlowShop>& eval = do_make_eval(parser, state);
// population
eoPop < Solution > pop;
pop.resize(4);
pop[0].objectiveVector(obj0); // class 1
pop[1].objectiveVector(obj1); // class 1
pop[2].objectiveVector(obj2); // class 1
pop[3].objectiveVector(obj3); // class 3
eoTimeContinue < Solution > continuator(5);
moeoUnifiedDominanceBasedLS < dummyMove > algo(continuator);
algo(pop);
eoPop < FlowShop > pop;
eoTimeContinue < FlowShop > continuator(5);
moeoAllSolAllNeighborsExpl < ExchangeMove > explorer(moveInit,moveNext, eval);
//
moeoUnifiedDominanceBasedLS < ExchangeMove > algo(continuator, explorer);
//
// algo(pop);
std::cout << "OK c'est bon" << std::endl;
return EXIT_SUCCESS;