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:
liefooga 2011-03-11 13:58:48 +00:00
commit 8280cf082b
1346 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,31 @@
SET (TEST_LIST
t-moeoExhaustiveUnvisitedSelect
t-moeoNumberUnvisitedSelect
t-moeoExhaustiveNeighborhoodExplorer
t-moeoSimpleSubNeighborhoodExplorer
t-moeoFirstImprovingNeighborhoodExplorer
t-moeoRecursiveFirstImprovingNeighborhoodExplorer
t-moeoUnifiedDominanceBasedLS
t-moeoDMLSGenUpdater
t-moeoDMLSMonOp
t-moeoPLS1
t-moeoPLS2
)
FOREACH (test ${TEST_LIST})
SET ("T_${test}_SOURCES" "${test}.cpp")
ENDFOREACH (test)
FOREACH (test ${TEST_LIST})
ADD_EXECUTABLE(${test} ${T_${test}_SOURCES})
ADD_TEST(${test} ${test})
ENDFOREACH (test)
# Link the librairies
FOREACH (test ${TEST_LIST})
TARGET_LINK_LIBRARIES(${test} moeo ga es eoutils eo)
ENDFOREACH (test)
######################################################################################

View file

@ -0,0 +1,170 @@
#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 testEval : public eoEvalFunc<Solution>
{
public:
void operator()(Solution & _solution){
ObjectiveVector objVec;
objVec[0]=500;
objVec[1]=0;
_solution.objectiveVector(objVec);
}
};
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;
}
} ;
class testMoveIncrEval2 : public moMoveIncrEval <testMove, ObjectiveVector>
{
public :
testMoveIncrEval2(unsigned int _counter=1):counter(_counter){};
ObjectiveVector operator () (const testMove & _move, const Solution & _solution)
{
ObjectiveVector objVec= _solution.objectiveVector();
objVec[0]+=counter;
objVec[1]+=counter;
counter++;
return objVec;
}
private:
unsigned int counter;
} ;
class testMoveIncrEval3 : public moMoveIncrEval <testMove, ObjectiveVector>
{
public :
ObjectiveVector operator () (const testMove & _move, const Solution & _solution)
{
ObjectiveVector objVec= _solution.objectiveVector();
if(objVec[0]>0)
objVec[0]--;
else
objVec[0]=500;
if(objVec[1]<500)
objVec[1]++;
else
objVec[1]=500;
return objVec;
}
} ;
class testMoveIncrEval4 : public moMoveIncrEval <testMove, ObjectiveVector>
{
public :
testMoveIncrEval4(unsigned int _counter=0):counter(_counter){};
ObjectiveVector operator () (const testMove & _move, const Solution & _solution)
{
ObjectiveVector objVec= _solution.objectiveVector();
switch (counter){
case 0:
objVec[0]++;
objVec[1]++;
break;
case 1:
objVec[0]++;
objVec[1]--;
break;
case 2:
objVec[0]--;
objVec[1]++;
break;
default:
if(objVec[0]>0){
objVec[0]--;
objVec[1]--;
}
break;
}
counter++;
return objVec;
}
private:
unsigned int counter;
} ;

View file

@ -0,0 +1,101 @@
/*
* <t-moeoDMLSGenUpdater.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie 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
*
*/
//-----------------------------------------------------------------------------
// t-moeoDMLSGenUpdater.cpp
//-----------------------------------------------------------------------------
#include <eo>
#include <moeo>
#include <assert.h>
#include <set>
#include <iostream>
#include <moeoExhaustiveUnvisitedSelect.h>
#include <moeoTestClass.h>
#include <moeoUnifiedDominanceBasedLS.h>
#include <eoTenTimeContinue.h>
#include <moeoExhaustiveNeighborhoodExplorer.h>
#include <moeoDMLSGenUpdater.h>
#include <eoGenContinue.h>
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int main()
{
std::cout << "[moeoDMLSGenUpdater] => ";
moeoExhaustiveUnvisitedSelect < Solution > select;
testEval eval;
testMoveInit init;
testMoveNext next;
testMoveIncrEval2 incr;
testMoveIncrEval3 incr2;
moeoExhaustiveNeighborhoodExplorer < testMove > explorer(init, next, incr);
moeoUnboundedArchive <Solution> arch;
moeoUnboundedArchive <Solution> arch2;
eoGenContinue <Solution> cont(10);
moeoUnifiedDominanceBasedLS <testMove> algo(cont, eval, arch, explorer, select);
eoGenContinue < Solution > cont2(10);
moeoDMLSGenUpdater < testMove > updater(algo, arch, arch2, cont2);
moeoDMLSGenUpdater < testMove > updater2(eval, explorer, select, arch2, cont2);
moeoDMLSGenUpdater < testMove > updater3(eval, arch, explorer, select, arch2, cont2, 10, true);
// objective vectors
eoPop<Solution> pop;
for(unsigned int i=0;i<9; i++){
updater();
assert(cont2.value()==i+1);
}
updater();
updater();
std::cout << cont2.value();
assert(cont2.value()==1);
std::cout << "OK" << std::endl;
return EXIT_SUCCESS;
}
//-----------------------------------------------------------------------------

View file

@ -0,0 +1,92 @@
/*
* <t-moeoDMLSMonOp.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie 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
*
*/
//-----------------------------------------------------------------------------
// t-moeoDMLSMonOp.cpp
//-----------------------------------------------------------------------------
#include <eo>
#include <moeo>
#include <assert.h>
#include <set>
#include <iostream>
#include <moeoExhaustiveUnvisitedSelect.h>
#include <moeoTestClass.h>
#include <moeoUnifiedDominanceBasedLS.h>
#include <eoTenTimeContinue.h>
#include <moeoExhaustiveNeighborhoodExplorer.h>
#include <moeoDMLSMonOp.h>
#include <eoGenContinue.h>
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int main()
{
std::cout << "[moeoDMLSMonOp] => ";
moeoExhaustiveUnvisitedSelect < Solution > select;
testEval eval;
testMoveInit init;
testMoveNext next;
testMoveIncrEval2 incr;
testMoveIncrEval3 incr2;
moeoExhaustiveNeighborhoodExplorer < testMove > explorer(init, next, incr);
moeoUnboundedArchive <Solution> arch;
eoGenContinue <Solution> cont(10);
moeoUnifiedDominanceBasedLS <testMove> algo(cont, eval, arch, explorer, select);
moeoDMLSMonOp < testMove > updater(algo, arch);
moeoDMLSMonOp < testMove > updater2(eval, explorer, select);
moeoDMLSMonOp < testMove > updater3(eval, arch, explorer, select, 10, true);
// objective vectors
Solution moeo;
ObjectiveVector obj;
obj[0]=500;
obj[1]=500;
moeo.objectiveVector(obj);
updater(moeo);
std::cout << "OK" << std::endl;
return EXIT_SUCCESS;
}
//-----------------------------------------------------------------------------

View file

@ -0,0 +1,112 @@
/*
* <t-moeoExhaustiveNeighborhoodExplorer.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie 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
*
*/
//-----------------------------------------------------------------------------
// t-moeoExhaustiveNeighborhoodExplorer.cpp
//-----------------------------------------------------------------------------
#include <eo>
#include <mo>
#include <moeo>
#include <assert.h>
#include <set>
#include <iostream>
#include <moeoExhaustiveNeighborhoodExplorer.h>
#include <moeoTestClass.h>
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int main()
{
std::cout << "[moeoExhaustiveNeighborhoodExplorer]\n\n";
// objective vectors
ObjectiveVector obj0, obj1;
obj0[0]=0;
obj0[1]=1;
obj1[0]=10;
obj1[1]=11;
eoPop < Solution > src;
eoPop < Solution > dest;
std::vector < unsigned int > select;
src.resize(5);
src[2].objectiveVector(obj0);
src[4].objectiveVector(obj1);
src[0].flag(0);
src[1].flag(0);
src[2].flag(0);
src[3].flag(0);
src[4].flag(0);
dest.resize(0);
select.resize(2);
select[0]=2;
select[1]=4;
testMoveInit init;
testMoveNext next;
testMoveIncrEval incr;
moeoExhaustiveNeighborhoodExplorer < testMove > explorer(init, next, incr);
explorer(src, select, dest);
assert(dest.size()==10);
assert(src[0].flag()==0);
assert(src[1].flag()==0);
assert(src[2].flag()==1);
assert(src[3].flag()==0);
assert(src[4].flag()==1);
for(int i=0 ; i< 10 ; i++)
assert(dest[i].flag()==0);
assert(dest[0].objectiveVector()[0]==2);
assert(dest[1].objectiveVector()[1]==3);
assert(dest[2].objectiveVector()[0]==2);
assert(dest[3].objectiveVector()[1]==3);
assert(dest[4].objectiveVector()[0]==2);
assert(dest[5].objectiveVector()[0]==12);
assert(dest[6].objectiveVector()[1]==13);
assert(dest[7].objectiveVector()[0]==12);
assert(dest[8].objectiveVector()[1]==13);
assert(dest[9].objectiveVector()[0]==12);
std::cout << "OK" << std::endl;
return EXIT_SUCCESS;
}
//-----------------------------------------------------------------------------

View file

@ -0,0 +1,79 @@
/*
* <t-moeoExhaustiveUnvisitedSelect.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie 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
*
*/
//-----------------------------------------------------------------------------
// t-moeoExhaustiveUnvisitedSelect.cpp
//-----------------------------------------------------------------------------
#include <eo>
#include <moeo>
#include <assert.h>
#include <set>
#include <iostream>
#include <moeoExhaustiveUnvisitedSelect.h>
#include <moeoTestClass.h>
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int main()
{
std::cout << "[moeoExhaustiveUnvisitedSelect]\n\n";
// objective vectors
eoPop < Solution > pop;
pop.resize(5);
pop[0].flag(1);
pop[1].flag(0);
pop[2].flag(0);
pop[3].flag(1);
pop[4].flag(0);
moeoExhaustiveUnvisitedSelect < Solution > select;
std::vector <unsigned int> res;
res=select(pop);
assert(res.size()==3);
assert(res[0]==1);
assert(res[1]==2);
assert(res[2]==4);
std::cout << "OK" << std::endl;
return EXIT_SUCCESS;
}
//-----------------------------------------------------------------------------

View file

@ -0,0 +1,108 @@
/*
* <t-moeoFirstImprovingNeighborhoodExplorer.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie 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
*
*/
//-----------------------------------------------------------------------------
// t-moeoFirstImprovingNeighborhoodExplorer.cpp
//-----------------------------------------------------------------------------
#include <eo>
#include <mo>
#include <moeo>
#include <assert.h>
#include <iostream>
#include <moeoFirstImprovingNeighborhoodExplorer.h>
#include <moeoTestClass.h>
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int main()
{
std::cout << "[moeoFirstImprovingNeighborhoodExplorer] => ";
// objective vectors
ObjectiveVector obj0;
obj0[0]=10;
obj0[1]=10;
eoPop < Solution > src;
eoPop < Solution > dest;
std::vector < unsigned int > select;
src.resize(1);
src[0].objectiveVector(obj0);
src[0].flag(0);
dest.resize(0);
select.resize(1);
select[0]=0;
testMoveInit init;
testMoveNext next;
testMoveIncrEval4 incr;
testMoveIncrEval3 incr2;
moeoFirstImprovingNeighborhoodExplorer < testMove > explorer(init, next, incr);
explorer(src, select, dest);
assert(dest.size()==3);
assert(src[0].flag()==0);
for(int i=0 ; i< 3 ; i++)
assert(dest[i].flag()==0);
assert(dest[0].objectiveVector()[0]==11);
assert(dest[0].objectiveVector()[1]==9);
assert(dest[1].objectiveVector()[0]==9);
assert(dest[1].objectiveVector()[1]==11);
assert(dest[2].objectiveVector()[0]==9);
assert(dest[2].objectiveVector()[1]==9);
moeoFirstImprovingNeighborhoodExplorer < testMove > explorer2(init, next, incr2);
dest.resize(0);
explorer2(src, select, dest);
assert(dest.size()==5);
assert(src[0].flag()==1);
for(int i=0 ; i< 5 ; i++){
assert(dest[i].flag()==0);
assert(dest[i].objectiveVector()[0]==9);
assert(dest[i].objectiveVector()[1]==11);
}
std::cout << "OK" << std::endl;
return EXIT_SUCCESS;
}
//-----------------------------------------------------------------------------

View file

@ -0,0 +1,98 @@
/*
* <t-moeoNumberUnvisitedSelect.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie 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
*
*/
//-----------------------------------------------------------------------------
// t-moeoNumberUnvisitedSelect.cpp
//-----------------------------------------------------------------------------
#include <eo>
#include <moeo>
#include <assert.h>
#include <set>
#include <iostream>
#include <moeoNumberUnvisitedSelect.h>
#include <moeoTestClass.h>
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int main()
{
std::cout << "[moeoNumberUnvisitedSelect]\n\n";
// objective vectors
eoPop < Solution > pop;
pop.resize(5);
pop[0].flag(1);
pop[1].flag(0);
pop[2].flag(0);
pop[3].flag(1);
pop[4].flag(0);
moeoNumberUnvisitedSelect < Solution > select(2);
std::vector <unsigned int> res;
//test general
res=select(pop);
assert(res.size()==2);
assert(res[0]==1 || res[0]==2 || res[0]==4);
assert(res[1]==1 || res[1]==2 || res[1]==4);
assert(res[0] != res[1]);
//test au bornes
moeoNumberUnvisitedSelect < Solution > select2(6);
res.resize(0);
res=select2(pop);
assert(res.size()==3);
assert(res[0]==1 || res[0]==2 || res[0]==4);
assert(res[1]==1 || res[1]==2 || res[1]==4);
assert(res[2]==1 || res[2]==2 || res[2]==4);
assert(res[0] != res[1]);
assert(res[0] != res[2]);
assert(res[1] != res[2]);
moeoNumberUnvisitedSelect < Solution > select3(0);
res.resize(0);
res=select3(pop);
assert(res.size()==0);
std::cout << "OK" << std::endl;
return EXIT_SUCCESS;
}
//-----------------------------------------------------------------------------

View file

@ -0,0 +1,83 @@
/*
* <t-moeoPLS1.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie 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
*
*/
//-----------------------------------------------------------------------------
// t-moeoPLS1.cpp
//-----------------------------------------------------------------------------
#include <eo>
#include <moeo>
#include <assert.h>
#include <set>
#include <iostream>
#include <moeoExhaustiveUnvisitedSelect.h>
#include <moeoTestClass.h>
#include <moeoPLS1.h>
#include <eoTenTimeContinue.h>
#include <moeoExhaustiveNeighborhoodExplorer.h>
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int main()
{
std::cout << "[moeoPLS1] => ";
testEval eval;
testMoveInit init;
testMoveNext next;
testMoveIncrEval2 incr;
moeoUnboundedArchive <Solution> arch;
eoCtrlCContinue <Solution> cont;
moeoPLS1 <testMove> algo(cont, eval, arch, init, next, incr);
// objective vectors
eoPop < Solution > pop;
pop.resize(2);
pop[0].flag(0);
pop[1].flag(0);
algo(pop);
assert(arch.size()==1);
assert(arch[0].flag()==1);
std::cout << "OK" << std::endl;
return EXIT_SUCCESS;
}
//-----------------------------------------------------------------------------

View file

@ -0,0 +1,83 @@
/*
* <t-moeoPLS2.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie 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
*
*/
//-----------------------------------------------------------------------------
// t-moeoPLS2.cpp
//-----------------------------------------------------------------------------
#include <eo>
#include <moeo>
#include <assert.h>
#include <set>
#include <iostream>
#include <moeoExhaustiveUnvisitedSelect.h>
#include <moeoTestClass.h>
#include <moeoPLS2.h>
#include <eoTenTimeContinue.h>
#include <moeoExhaustiveNeighborhoodExplorer.h>
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int main()
{
std::cout << "[moeoPLS2] => ";
testEval eval;
testMoveInit init;
testMoveNext next;
testMoveIncrEval2 incr;
moeoUnboundedArchive <Solution> arch;
eoCtrlCContinue <Solution> cont;
moeoPLS2 <testMove> algo(cont, eval, arch, init, next, incr);
// objective vectors
eoPop < Solution > pop;
pop.resize(2);
pop[0].flag(0);
pop[1].flag(0);
algo(pop);
assert(arch.size()==1);
assert(arch[0].flag()==1);
std::cout << "OK" << std::endl;
return EXIT_SUCCESS;
}
//-----------------------------------------------------------------------------

View file

@ -0,0 +1,137 @@
/*
* <t-moeoSubNeighborhoodExplorer.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie 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
*
*/
//-----------------------------------------------------------------------------
// t-moeoSubNeighborhoodExplorer.cpp
//-----------------------------------------------------------------------------
#include <eo>
#include <mo>
#include <moeo>
#include <assert.h>
#include <set>
#include <iostream>
#include <moeoSimpleSubNeighborhoodExplorer.h>
#include <moeoTestClass.h>
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int main()
{
std::cout << "[moeoSimpleSubNeighborhoodExplorer]\n\n";
// objective vectors
ObjectiveVector obj0, obj1;
obj0[0]=0;
obj0[1]=1;
obj1[0]=10;
obj1[1]=11;
eoPop < Solution > src;
eoPop < Solution > dest;
std::vector < unsigned int > select;
src.resize(5);
src[2].objectiveVector(obj0);
src[4].objectiveVector(obj1);
src[0].flag(0);
src[1].flag(0);
src[2].flag(0);
src[3].flag(0);
src[4].flag(0);
dest.resize(0);
select.resize(2);
select[0]=2;
select[1]=4;
testMoveInit init;
testMoveNext next;
testMoveIncrEval incr;
moeoSimpleSubNeighborhoodExplorer < testMove > explorer(init, next, incr, 6);
explorer(src, select, dest);
assert(dest.size()==10);
assert(src[0].flag()==0);
assert(src[1].flag()==0);
assert(src[2].flag()==1);
assert(src[3].flag()==0);
assert(src[4].flag()==1);
for(int i=0 ; i< 10 ; i++)
assert(dest[i].flag()==0);
assert(dest[0].objectiveVector()[0]==2);
assert(dest[1].objectiveVector()[1]==3);
assert(dest[2].objectiveVector()[0]==2);
assert(dest[3].objectiveVector()[1]==3);
assert(dest[4].objectiveVector()[0]==2);
assert(dest[5].objectiveVector()[0]==12);
assert(dest[6].objectiveVector()[1]==13);
assert(dest[7].objectiveVector()[0]==12);
assert(dest[8].objectiveVector()[1]==13);
assert(dest[9].objectiveVector()[0]==12);
src[2].flag(0);
src[4].flag(0);
dest.resize(0);
moeoSimpleSubNeighborhoodExplorer < testMove > explorer2(init, next, incr, 3);
explorer2(src, select, dest);
assert(dest.size()==6);
assert(src[0].flag()==0);
assert(src[1].flag()==0);
assert(src[2].flag()==0);
assert(src[3].flag()==0);
assert(src[4].flag()==0);
for(int i=0 ; i< 6 ; i++)
assert(dest[i].flag()==0);
assert(dest[0].objectiveVector()[0]==2);
assert(dest[1].objectiveVector()[1]==3);
assert(dest[2].objectiveVector()[0]==2);
assert(dest[3].objectiveVector()[0]==12);
assert(dest[4].objectiveVector()[1]==13);
assert(dest[5].objectiveVector()[0]==12);
std::cout << "OK" << std::endl;
return EXIT_SUCCESS;
}
//-----------------------------------------------------------------------------

View file

@ -0,0 +1,99 @@
/*
* <t-moeoUnifiedDominanceBasedLS.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Lille-Nord Europe, 2006-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Arnaud Liefooghe
* Jeremie 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
*
*/
//-----------------------------------------------------------------------------
// t-moeoUnifiedDominanceBasedLS.cpp
//-----------------------------------------------------------------------------
#include <eo>
#include <moeo>
#include <assert.h>
#include <set>
#include <iostream>
#include <moeoExhaustiveUnvisitedSelect.h>
#include <moeoTestClass.h>
#include <moeoUnifiedDominanceBasedLS.h>
#include <eoTenTimeContinue.h>
#include <moeoExhaustiveNeighborhoodExplorer.h>
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int main()
{
std::cout << "[moeoUnifiedDominanceBasedLS] => ";
moeoExhaustiveUnvisitedSelect < Solution > select;
testEval eval;
testMoveInit init;
testMoveNext next;
testMoveIncrEval2 incr;
testMoveIncrEval3 incr2;
moeoExhaustiveNeighborhoodExplorer < testMove > explorer(init, next, incr);
moeoUnboundedArchive <Solution> arch;
eoCtrlCContinue <Solution> cont;
moeoUnifiedDominanceBasedLS <testMove> algo(cont, eval, arch, explorer, select);
// objective vectors
eoPop < Solution > pop;
pop.resize(2);
pop[0].flag(0);
pop[1].flag(0);
algo(pop);
assert(arch.size()==1);
assert(arch[0].flag()==1);
arch.resize(0);
moeoExhaustiveNeighborhoodExplorer < testMove > explorer2(init, next, incr2);
moeoUnifiedDominanceBasedLS <testMove> algo2(cont, eval, arch, explorer2, select);
algo2(pop);
assert(arch.size()==501);
assert(arch[0].objectiveVector()[0]==500);
assert(arch[0].objectiveVector()[1]==0);
assert(arch[500].objectiveVector()[1]==500);
assert(arch[500].objectiveVector()[0]==0);
std::cout << "OK" << std::endl;
return EXIT_SUCCESS;
}
//-----------------------------------------------------------------------------