git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1553 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
8516b58dec
commit
57007ca1e4
6 changed files with 92 additions and 206 deletions
|
|
@ -104,6 +104,7 @@ INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src)
|
||||||
INCLUDE_DIRECTORIES(${MOEO_SRC_DIR}/src)
|
INCLUDE_DIRECTORIES(${MOEO_SRC_DIR}/src)
|
||||||
INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src)
|
INCLUDE_DIRECTORIES(${MO_SRC_DIR}/src)
|
||||||
INCLUDE_DIRECTORIES(/home/humeau/workspace/MOLS/src2)
|
INCLUDE_DIRECTORIES(/home/humeau/workspace/MOLS/src2)
|
||||||
|
INCLUDE_DIRECTORIES(/home/humeau/workspace/MOLS/test)
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
|
||||||
87
contribution/branches/MOLS/test/moeoTestClass.h
Normal file
87
contribution/branches/MOLS/test/moeoTestClass.h
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
#include <eo>
|
||||||
|
#include <mo>
|
||||||
|
#include <moeo>
|
||||||
|
|
||||||
|
|
||||||
|
class ObjectiveVectorTraits : public moeoObjectiveVectorTraits
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
typedef MOEO < ObjectiveVector, double, double > Solution;
|
||||||
|
|
||||||
|
class testMove : public moMove < Solution >
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
|
||||||
|
void operator () (Solution & _solution)
|
||||||
|
{
|
||||||
|
Solution sol=_solution;
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCounter(unsigned int i){
|
||||||
|
counter=i;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int getCounter(){
|
||||||
|
return counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned int counter;
|
||||||
|
|
||||||
|
} ;
|
||||||
|
|
||||||
|
class testMoveInit : public moMoveInit <testMove>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
void operator () (testMove & _move, const Solution & _solution)
|
||||||
|
{
|
||||||
|
_move.setCounter(0);
|
||||||
|
const Solution sol(_solution);
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
class testMoveNext : public moNextMove <testMove>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
|
||||||
|
testMoveNext(unsigned int _counter=0):counter(_counter){};
|
||||||
|
|
||||||
|
bool operator () (testMove & _move, const Solution & _solution)
|
||||||
|
{
|
||||||
|
testMove move(_move);
|
||||||
|
const Solution sol(_solution);
|
||||||
|
return _move.getCounter() < 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned int counter;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
class testMoveIncrEval : public moMoveIncrEval <testMove, ObjectiveVector>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
ObjectiveVector operator () (const testMove & _move, const Solution & _solution)
|
||||||
|
{
|
||||||
|
ObjectiveVector objVec= _solution.objectiveVector();
|
||||||
|
objVec[0]+=2;
|
||||||
|
objVec[1]+=2;
|
||||||
|
return objVec;
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
@ -45,91 +45,9 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <moeoExhaustiveNeighborhoodExplorer.h>
|
#include <moeoExhaustiveNeighborhoodExplorer.h>
|
||||||
|
#include <moeoTestClass.h>
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class ObjectiveVectorTraits : public moeoObjectiveVectorTraits
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
|
|
||||||
typedef MOEO < ObjectiveVector, double, double > Solution;
|
|
||||||
|
|
||||||
class testMove : public moMove < Solution >
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
|
|
||||||
void operator () (Solution & _solution)
|
|
||||||
{
|
|
||||||
Solution sol=_solution;
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setCounter(unsigned int i){
|
|
||||||
counter=i;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int getCounter(){
|
|
||||||
return counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned int counter;
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
class testMoveInit : public moMoveInit <testMove>
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
void operator () (testMove & _move, const Solution & _solution)
|
|
||||||
{
|
|
||||||
_move.setCounter(0);
|
|
||||||
const Solution sol(_solution);
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
class testMoveNext : public moNextMove <testMove>
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
|
|
||||||
testMoveNext(unsigned int _counter=0):counter(_counter){};
|
|
||||||
|
|
||||||
bool operator () (testMove & _move, const Solution & _solution)
|
|
||||||
{
|
|
||||||
testMove move(_move);
|
|
||||||
const Solution sol(_solution);
|
|
||||||
return _move.getCounter() < 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned int counter;
|
|
||||||
} ;
|
|
||||||
|
|
||||||
class testMoveIncrEval : public moMoveIncrEval <testMove, ObjectiveVector>
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
ObjectiveVector operator () (const testMove & _move, const Solution & _solution)
|
|
||||||
{
|
|
||||||
ObjectiveVector objVec= _solution.objectiveVector();
|
|
||||||
objVec[0]+=2;
|
|
||||||
objVec[1]+=2;
|
|
||||||
return objVec;
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
|
||||||
|
|
@ -44,29 +44,9 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <moeoExhaustiveUnvisitedSelect.h>
|
#include <moeoExhaustiveUnvisitedSelect.h>
|
||||||
|
#include <moeoTestClass.h>
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class ObjectiveVectorTraits : public moeoObjectiveVectorTraits
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
|
|
||||||
typedef MOEO < ObjectiveVector, double, double > Solution;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
|
||||||
|
|
@ -44,29 +44,9 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <moeoNumberUnvisitedSelect.h>
|
#include <moeoNumberUnvisitedSelect.h>
|
||||||
|
#include <moeoTestClass.h>
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class ObjectiveVectorTraits : public moeoObjectiveVectorTraits
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
|
|
||||||
typedef MOEO < ObjectiveVector, double, double > Solution;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
|
||||||
|
|
@ -45,90 +45,10 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <moeoSubNeighborhoodExplorer.h>
|
#include <moeoSubNeighborhoodExplorer.h>
|
||||||
|
#include <moeoTestClass.h>
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class ObjectiveVectorTraits : public moeoObjectiveVectorTraits
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
|
|
||||||
typedef MOEO < ObjectiveVector, double, double > Solution;
|
|
||||||
|
|
||||||
class testMove : public moMove < Solution >
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
|
|
||||||
void operator () (Solution & _solution)
|
|
||||||
{
|
|
||||||
Solution sol=_solution;
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setCounter(unsigned int i){
|
|
||||||
counter=i;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int getCounter(){
|
|
||||||
return counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned int counter;
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
class testMoveInit : public moMoveInit <testMove>
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
void operator () (testMove & _move, const Solution & _solution)
|
|
||||||
{
|
|
||||||
_move.setCounter(0);
|
|
||||||
const Solution sol(_solution);
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
class testMoveNext : public moNextMove <testMove>
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
|
|
||||||
testMoveNext(unsigned int _counter=0):counter(_counter){};
|
|
||||||
|
|
||||||
bool operator () (testMove & _move, const Solution & _solution)
|
|
||||||
{
|
|
||||||
testMove move(_move);
|
|
||||||
const Solution sol(_solution);
|
|
||||||
return _move.getCounter() < 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned int counter;
|
|
||||||
} ;
|
|
||||||
|
|
||||||
class testMoveIncrEval : public moMoveIncrEval <testMove, ObjectiveVector>
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
ObjectiveVector operator () (const testMove & _move, const Solution & _solution)
|
|
||||||
{
|
|
||||||
ObjectiveVector objVec= _solution.objectiveVector();
|
|
||||||
objVec[0]+=2;
|
|
||||||
objVec[1]+=2;
|
|
||||||
return objVec;
|
|
||||||
}
|
|
||||||
} ;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue