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

This commit is contained in:
jhumeau 2010-03-23 15:31:35 +00:00
commit 63ae86a458
165 changed files with 0 additions and 38091 deletions

View file

@ -1,93 +0,0 @@
###############################################################################
##
## CMakeLists file for ParadisEO-MO/test
##
###############################################################################
######################################################################################
### 1) Include the sources
######################################################################################
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src)
INCLUDE_DIRECTORIES(${ParadisEO-MO_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
######################################################################################
######################################################################################
### 2) Specify where CMake can find the libraries
######################################################################################
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-MO_BINARY_DIR}/lib)
######################################################################################
######################################################################################
### 3) Define your targets and link the librairies
######################################################################################
SET (TEST_LIST t-moBestImprSelect
t-moFirstImprSelect
t-moFitComparator
t-moFitSolContinue
t-moGenSolContinue
t-moGeometricCoolingSchedule
t-moHC
t-moHC_2
t-moHCMoveLoopExpl
t-moILS
t-moILS_HC
t-moILS_TS
t-moILS_SA
t-moImprBestFitAspirCrit
t-moItRandNextMove
t-moLinearCoolingSchedule
t-moLSCheckPoint
t-moNoAspirCrit
t-moNoFitImprSolContinue
t-moRandImprSelect
t-moSA
t-moSimpleMoveTabuList
t-moSimpleSolutionTabuList
t-moSteadyFitSolContinue
t-moTS
t-moTS_2
t-moTSMoveLoopExpl
t-moTA
t-moVNS
)
FOREACH (test ${TEST_LIST})
SET ("T_${test}_SOURCES" "${test}.cpp")
ENDFOREACH (test)
IF(ENABLE_MINIMAL_CMAKE_TESTING)
SET (MIN_TEST_LIST t-moHC)
FOREACH (mintest ${MIN_TEST_LIST})
SET ("T_${mintest}_SOURCES" "${mintest}.cpp")
ADD_EXECUTABLE(${mintest} ${T_${mintest}_SOURCES})
ADD_TEST(${mintest} ${mintest})
ENDFOREACH (mintest)
ELSEIF(ENABLE_CMAKE_TESTING)
# Add the tests
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} ga es eoutils eo)
ENDFOREACH (test)
ENDIF(ENABLE_MINIMAL_CMAKE_TESTING)
######################################################################################

View file

@ -1,108 +0,0 @@
/*
* <t-moBestImprSelect.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moBestImprSelect.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
_solution=_solution;
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result, test_1, test_2;
int return_value, value_1, value_2;
unsigned int i, fitness;
moBestImprSelect<testMove> selection;
solution solution;
testMove move;
cout << "[ moBestImprSelect ] ==> ";
i=fitness=0;
selection.init(0);
test_1="KO";
try
{
selection(move, fitness);
}
catch(std::runtime_error e)
{
test_1="OK";
}
value_1=((test_1.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
test_2=((!selection.update(move, i))?"KO":"OK");
value_2=((test_2.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
selection(move, fitness);
move(solution);
test_result=(((test_1.compare("OK")==0)&&(test_2.compare("OK")==0))?"OK":"KO");
return_value=(((value_1==EXIT_SUCCESS)&&(value_2==EXIT_SUCCESS))?EXIT_SUCCESS:EXIT_FAILURE);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,96 +0,0 @@
/*
* <t-moFirstImprSelect.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moFirstImprSelect.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
_solution=_solution;
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
unsigned int i, fitness;
moFirstImprSelect<testMove> selection;
solution solution;
testMove move;
cout << "[ moFirstImprSelect ] ==> ";
i=fitness=0;
selection.init(10);
while ( selection.update(move, i) && i<15 )
{
i++;
}
selection(move, fitness);
move(solution);
test_result=((fitness!=11)?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,74 +0,0 @@
/*
* <t-moFitComparator.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moFitComparator.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
solution sol1, sol2;
moFitComparator<solution> comparator;
sol1.fitness(0);
sol2.fitness(1);
cout << "[ moFitComparator ] ==> ";
test_result=((comparator(sol1,sol2))?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,101 +0,0 @@
/*
* <t-moFitSolContinue.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moFitSolContinue.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result, test_1, test_2;
int return_value, value_1, value_2;
unsigned int i;
moFitSolContinue<solution> continu(10);
solution solution;
cout << "[ moFitSolContinue ] ==> ";
continu.init();
test_1="KO";
try
{
continu(solution);
}
catch(std::runtime_error e)
{
test_1="OK";
}
value_1=((test_1.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
i=0;
solution.fitness(i);
while( continu(solution) )
{
i++;
solution.fitness(i);
}
test_2=((i!=10)?"KO":"OK");
value_2=((test_2.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
test_result=(((test_1.compare("OK")==0)&&(test_2.compare("OK")==0))?"OK":"KO");
return_value=(((value_1==EXIT_SUCCESS)&&(value_2==EXIT_SUCCESS))?EXIT_SUCCESS:EXIT_FAILURE);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,92 +0,0 @@
/*
* <t-moGenSolContinue.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moGenSolContinue.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result, test_1, test_2;
int value_1, value_2, return_value;
unsigned int i;
solution sol;
moGenSolContinue<solution> continu(10);
cout << "[ moGenSolContinue ] ==> ";
i=0;
while( continu(sol) )
{
i++;
}
test_1=((i!=9)?"KO":"OK");
value_1=((test_1.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
continu.init();
i=0;
while( continu(sol) )
{
i++;
}
test_2=((i!=9)?"KO":"OK");
value_2=((test_2.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
test_result=(((test_1.compare("OK")==0)&&(test_2.compare("OK")==0))?"OK":"KO");
return_value=(((value_1==EXIT_SUCCESS)&&(value_2==EXIT_SUCCESS))?EXIT_SUCCESS:EXIT_FAILURE);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,79 +0,0 @@
/*
* <t-moExponentialCoolingSchedule.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moExponentialCoolingSchedule.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int
main()
{
int return_value;
std::string test_result;
unsigned int i;
double temperature;
moGeometricCoolingSchedule coolingSchedule( 4.0, 0.5 );
temperature=10.0;
cout << "[ moExponentialCoolingSchedule ] ==> ";
i=0;
while( coolingSchedule(temperature) )
{
i++;
}
test_result=((i!=1)?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,162 +0,0 @@
/*
* <t-moHC.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moHC.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution sol=_solution;
}
} ;
class testMoveInit : public moMoveInit <testMove>
{
public :
void operator () (testMove & _move, const solution & _solution)
{
testMove move=_move;
const solution sol(_solution);
}
} ;
class testMoveNext : public moNextMove <testMove>
{
public :
bool operator () (testMove & _move, const solution & _solution)
{
testMove move=_move;
const solution sol(_solution);
return false;
}
} ;
class testMoveIncrEval : public moMoveIncrEval <testMove>
{
public :
unsigned int operator () (const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution solution(_solution);
return 2;
}
} ;
class testMoveSelect : public moMoveSelect <testMove>
{
public :
void operator () (testMove & _move, unsigned int & _fitness)
{
testMove move;
move=_move;
_fitness=2;
}
void init(const unsigned int & _fitness)
{
unsigned int fitness;
fitness=(unsigned int)_fitness;
}
bool update(const testMove & _move, const unsigned int & _fitness)
{
testMove move;
unsigned int fitness;
move=(testMove)_move;
fitness=(unsigned int)_fitness;
return true;
}
} ;
class solutionEval : public eoEvalFunc <solution>
{
public :
void operator () (solution & _solution)
{
_solution.fitness(2);
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
solution solution;
testMoveInit init;
testMoveNext next;
testMoveIncrEval incrEval;
testMoveSelect select;
solutionEval eval;
moHC<testMove> hc(init, next, incrEval, select, eval);
cout << "[ moHC ] ==> ";
hc(solution);
test_result=((solution.fitness()!=2)?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,170 +0,0 @@
/*
* <t-moHCMoveLoopExpl.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moHCMoveLoopExpl.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution sol=_solution;
}
} ;
class testMoveInit : public moMoveInit <testMove>
{
public :
void operator () (testMove & _move, const solution & _solution)
{
testMove move=_move;
const solution sol(_solution);
}
} ;
class testMoveNext : public moNextMove <testMove>
{
public :
bool operator () (testMove & _move, const solution & _solution)
{
testMove move=_move;
const solution sol(_solution);
return false;
}
} ;
class testMoveIncrEval : public moMoveIncrEval <testMove>
{
public :
unsigned int operator () (const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution solution(_solution);
return 2;
}
} ;
class testMoveSelect : public moMoveSelect <testMove>
{
public :
void operator () (testMove & _move, unsigned int & _fitness)
{
testMove move;
move=_move;
_fitness=2;
}
void init(const unsigned int & _fitness)
{
unsigned int fitness;
fitness=(unsigned int)_fitness;
}
bool update(const testMove & _move, const unsigned int & _fitness)
{
testMove move;
unsigned int fitness;
move=(testMove)_move;
fitness=(unsigned int)_fitness;
return true;
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result, test_1, test_2;
int return_value, value_1, value_2;
solution solution_1, solution_2;
testMoveInit init;
testMoveNext next;
testMoveIncrEval incrEval;
testMoveSelect select;
moHCMoveLoopExpl<testMove> explorer(init, next, incrEval, select);
cout << "[ moHCMoveLoopExpl ] ==> ";
test_1="KO";
try
{
explorer(solution_1, solution_2);
}
catch(std::runtime_error e)
{
test_1="OK";
}
value_1=((test_1.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
solution_1.fitness(0);
solution_2.fitness(0);
explorer(solution_1, solution_2);
test_2=((solution_2.fitness()!=2)?"KO":"OK");
value_2=((test_2.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
test_result=(((test_1.compare("OK")==0)&&(test_2.compare("OK")==0))?"OK":"KO");
return_value=(((value_1==EXIT_SUCCESS)&&(value_2==EXIT_SUCCESS))?EXIT_SUCCESS:EXIT_FAILURE);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,106 +0,0 @@
/*
* <t-moHC_2.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moHC_2.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution sol=_solution;
}
} ;
class testMoveExplorer : public moMoveExpl<testMove>
{
public :
void operator () (const solution & _solution_1, solution & _solution_2)
{
const solution sol(_solution_1);
_solution_2.fitness(2);
}
};
class solutionEval : public eoEvalFunc <solution>
{
public :
void operator () (solution & _solution)
{
_solution.fitness(0);
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
solution solution;
solutionEval eval;
testMoveExplorer explorer;
moHC<testMove> hc(explorer, eval);
cout << "[ moHC_2 ] ==> ";
hc(solution);
test_result=((solution.fitness()!=2)?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,169 +0,0 @@
/*
* <t-moILS.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moILS.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution sol=_solution;
}
} ;
class solutionAlgo : public moAlgo <solution>
{
public :
bool operator () (solution & _solution)
{
solution solution(_solution);
return true;
}
} ;
class solutionContinue : public moSolContinue<solution>
{
public :
solutionContinue(): counter(0)
{}
bool operator () (const solution & _solution)
{
const solution sol(_solution);
if(counter<2)
{
counter++;
return true;
}
return false;
}
void init()
{}
private :
unsigned int counter;
} ;
class solutionComparator : public moComparator<solution>
{
public :
solutionComparator() : counter(0)
{}
bool operator () (const solution & _solution1 , const solution & _solution2)
{
const solution sol1(_solution1);
const solution sol2(_solution2);
if(counter<2)
{
counter++;
return false;
}
return true;
}
private :
unsigned int counter;
} ;
class solutionPerturbation : public eoMonOp<solution>
{
public :
bool operator () (solution & _solution)
{
_solution.fitness(2);
return true;
}
} ;
class solutionEval : public eoEvalFunc <solution>
{
public :
void operator () (solution & _solution)
{
solution solution(_solution);
_solution.fitness(2);
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
solution solution;
solutionAlgo algorithm;
solutionContinue continu;
solutionComparator comparator;
solutionPerturbation perturbation;
solutionEval eval;
moILS<testMove> ils(algorithm, continu, comparator, perturbation, eval);
cout << "[ moILS ] ==> ";
solution.fitness(0);
ils(solution);
test_result=((solution.fitness()!=2)?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,211 +0,0 @@
/*
* <t-moILS_HC.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moILS_HC.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution sol=_solution;
}
} ;
class testMoveInit : public moMoveInit <testMove>
{
public :
void operator () (testMove & _move, const solution & _solution)
{
testMove move=_move;
const solution sol(_solution);
}
} ;
class testMoveNext : public moNextMove <testMove>
{
public :
bool operator () (testMove & _move, const solution & _solution)
{
testMove move=_move;
const solution sol(_solution);
return false;
}
} ;
class testMoveIncrEval : public moMoveIncrEval <testMove>
{
public :
unsigned int operator () (const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution solution(_solution);
return 2;
}
} ;
class testMoveSelect : public moMoveSelect <testMove>
{
public :
void operator () (testMove & _move, unsigned int & _fitness)
{
testMove move;
move=_move;
_fitness=2;
}
void init(const unsigned int & _fitness)
{
unsigned int fitness;
fitness=(unsigned int)_fitness;
}
bool update(const testMove & _move, const unsigned int & _fitness)
{
testMove move;
unsigned int fitness;
move=(testMove)_move;
fitness=(unsigned int)_fitness;
return true;
}
} ;
class solutionEval : public eoEvalFunc <solution>
{
public :
void operator () (solution & _solution)
{
_solution.fitness(0);
}
} ;
class solutionContinue : public moSolContinue<solution>
{
public :
solutionContinue(): counter(0)
{}
bool operator () (const solution & _solution)
{
const solution sol(_solution);
if(counter==0)
{
counter++;
return true;
}
return false;
}
void init()
{}
private :
unsigned int counter;
} ;
class solutionComparator : public moComparator<solution>
{
public :
bool operator () (const solution & _solution1 , const solution & _solution2)
{
const solution sol1(_solution1);
const solution sol2(_solution2);
return true;
}
} ;
class solutionPerturbation : public eoMonOp<solution>
{
public :
bool operator () (solution & _solution)
{
_solution.fitness(2);
return true;
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
solution solution;
testMoveInit init;
testMoveNext next;
testMoveIncrEval incrEval;
testMoveSelect select;
solutionEval eval;
solutionContinue continu;
solutionComparator comparator;
solutionPerturbation perturbation;
moILS<testMove> ils(init, next, incrEval, select, continu, comparator, perturbation, eval);
cout << "[ moILS_HC ] ==> ";
ils(solution);
test_result=((solution.fitness()!=2)?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,190 +0,0 @@
/*
* <t-moILS_SA.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moILS_SA.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution sol=_solution;
}
} ;
class testRandMove : public moRandMove<testMove>
{
public :
void operator () (testMove & _move)
{
_move=_move;
}
};
class testMoveIncrEval : public moMoveIncrEval <testMove>
{
public :
int operator () (const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution solution(_solution);
return 2;
}
} ;
class testCooling : public moCoolingSchedule
{
public :
bool operator () (double & _temperature)
{
double temperature;
temperature=_temperature;
return false;
}
};
class solutionEval : public eoEvalFunc <solution>
{
public :
void operator () (solution & _solution)
{
const solution solution(_solution);
}
} ;
class solutionContinue : public moSolContinue<solution>
{
public :
solutionContinue(): counter(0)
{}
bool operator () (const solution & _solution)
{
const solution sol(_solution);
if(counter==0)
{
counter++;
return true;
}
return false;
}
void init()
{}
private :
unsigned int counter;
} ;
class solutionComparator : public moComparator<solution>
{
public :
solutionComparator() : counter(0)
{}
bool operator () (const solution & _solution1 , const solution & _solution2)
{
const solution solution1(_solution1);
const solution solution2(_solution2);
return true;
}
private :
unsigned int counter;
} ;
class solutionPerturbation : public eoMonOp<solution>
{
public :
bool operator () (solution & _solution)
{
_solution.fitness(2);
return true;
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
solution solution;
testRandMove rand;
testMoveIncrEval incrEval;
solutionContinue continu;
solutionContinue continu_2;
testCooling cooling;
solutionEval eval;
solutionComparator comparator;
solutionPerturbation perturbation;
moILS<testMove> ils(rand, incrEval, continu, 10.0, cooling, continu_2, comparator, perturbation, eval);
cout << "[ moILS_SA ] ==> ";
solution.fitness(0);
eval(solution);
ils(solution);
test_result=((solution.fitness()!=2)?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,223 +0,0 @@
/*
* <t-moILS_TS.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moILS_TS.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution sol=_solution;
}
} ;
class testMoveInit : public moMoveInit <testMove>
{
public :
void operator () (testMove & _move, const solution & _solution)
{
testMove move=_move;
const solution sol(_solution);
}
} ;
class testMoveNext : public moNextMove <testMove>
{
public :
bool operator () (testMove & _move, const solution & _solution)
{
testMove move=_move;
const solution sol(_solution);
return false;
}
} ;
class testMoveIncrEval : public moMoveIncrEval <testMove>
{
public :
unsigned int operator () (const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution solution(_solution);
return 2;
}
} ;
class testTabuList : public moTabuList<testMove>
{
public:
bool operator() (const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution sol(_solution);
return false;
}
void add(const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution sol(_solution);
}
void update()
{}
void init()
{}
};
class testAspirCrit : public moAspirCrit<testMove>
{
public:
bool operator() (const testMove & _move, const unsigned int & _fitness)
{
unsigned int fitness;
const testMove move(_move);
fitness=_fitness;
return false;
}
void init()
{}
};
class solutionContinue : public moSolContinue<solution>
{
public :
solutionContinue(): counter(0)
{}
bool operator () (const solution & _solution)
{
const solution sol(_solution);
if(counter==0)
{
counter++;
return true;
}
return false;
}
void init()
{}
private :
unsigned int counter;
} ;
class solutionComparator : public moComparator<solution>
{
public :
bool operator () (const solution & _solution1 , const solution & _solution2)
{
const solution sol1(_solution1);
const solution sol2(_solution2);
return true;
}
} ;
class solutionPerturbation : public eoMonOp<solution>
{
public :
bool operator () (solution & _solution)
{
_solution.fitness(2);
return true;
}
} ;
class solutionEval : public eoEvalFunc <solution>
{
public :
void operator () (solution & _solution)
{
_solution.fitness(0);
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
solution solution;
testMoveInit init;
testMoveNext next;
testMoveIncrEval incrEval;
testTabuList tabuList;
testAspirCrit aspirCrit;
solutionEval eval;
solutionContinue continu;
solutionContinue continu_2;
solutionComparator comparator;
solutionPerturbation perturbation;
moILS<testMove> ils(init, next, incrEval, tabuList, aspirCrit, continu, continu_2, comparator, perturbation, eval);
cout << "[ moILS_TS ] ==> ";
ils(solution);
test_result=((solution.fitness()!=2)?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,109 +0,0 @@
/*
* <t-moImprBestFitAspirCrit.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moImprBestFitAspirCrit.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
_solution=_solution;
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result, test_1, test_2;
int return_value, value_1, value_2;
solution solution;
unsigned int i;
moImprBestFitAspirCrit<testMove> aspirCriterion;
testMove move;
cout << "[ moImprBestFitAspirCrit ] ==> ";
aspirCriterion(move, 10);
i=0;
while ( !aspirCriterion(move,i) && i<15)
{
i++;
}
test_1=((i!=11)?"KO":"OK");
value_1=((test_1.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
aspirCriterion.init();
aspirCriterion(move, i);
i=0;
while ( !aspirCriterion(move,i) && i<15)
{
i++;
}
move(solution);
test_2=((i!=12)?"KO":"OK");
value_2=((test_2.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
test_result=(((test_1.compare("OK")==0)&&(test_2.compare("OK")==0))?"OK":"KO");
return_value=(((value_1==EXIT_SUCCESS)&&(value_2==EXIT_SUCCESS))?EXIT_SUCCESS:EXIT_FAILURE);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,114 +0,0 @@
/*
* <t-moItRandNextMove.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moItRandNextMove.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
_solution=_solution;
}
} ;
class testRandMove : public moRandMove<testMove>
{
public :
void operator () (testMove & _move)
{
_move=_move;
}
};
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result, test_1, test_2;
int value_1, value_2, return_value;
unsigned int i;
testMove move;
solution solution;
testRandMove rand;
moItRandNextMove<testMove> next(rand, 10);
cout << "[ moItRandNextMove ] ==> ";
i=0;
while( next(move, solution) && i<15 )
{
i++;
}
test_1=((i!=11)?"KO":"OK");
value_1=((test_1.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
i=0;
while( next(move, solution) && i<15 )
{
i++;
}
move(solution);
test_2=((i!=11)?"KO":"OK");
value_2=((test_2.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
test_result=(((test_1.compare("OK")==0)&&(test_2.compare("OK")==0))?"OK":"KO");
return_value=(((value_1==EXIT_SUCCESS)&&(value_2==EXIT_SUCCESS))?EXIT_SUCCESS:EXIT_FAILURE);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,116 +0,0 @@
/*
* <t-moLSCheckPoint.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moLSCheckPoint.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
_solution=_solution;
}
} ;
class testBF : public eoBF<const testMove & , const testMove::EOType &, void>
{
void operator () (const testMove & _move, const testMove::EOType & _solution)
{
const testMove move(_move);
const testMove::EOType sol(_solution);
std::ofstream os("test.txt");
os << "OK" << endl;
}
};
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result, test_1, test_2;
int value_1, value_2, return_value;
unsigned int i;
std::string result;
testBF test;
moLSCheckPoint<testMove> checkpoint;
solution solution;
testMove move;
std::ifstream is;
cout << "[ moLSCheckPoint ] ==> ";
i=0;
checkpoint.add(test);
checkpoint(move, solution);
move(solution);
is.open("test.txt");
test_1=((!is.is_open())?"KO":"OK");
value_1=((test_1.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
is >> result;
test_2=((result.compare("OK")!=0)?"KO":"OK");
value_2=((test_2.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
test_result=(((test_1.compare("OK")==0)&&(test_2.compare("OK")==0))?"OK":"KO");
return_value=(((value_1==EXIT_SUCCESS)&&(value_2==EXIT_SUCCESS))?EXIT_SUCCESS:EXIT_FAILURE);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,79 +0,0 @@
/*
* <t-moLinearCoolingSchedule.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moLinearCoolingSchedule.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
unsigned int i;
double temperature;
moLinearCoolingSchedule coolingSchedule( 1.0, 0.5 );
cout << "[ moLinearCoolingSchedule ] ==> ";
temperature=2.0;
i=0;
while( coolingSchedule(temperature) )
{
i++;
}
test_result=((i!=1)?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,85 +0,0 @@
/*
* <t-moNoAspirCrit.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moNoAspirCrit.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
_solution=_solution;
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
unsigned int i;
moNoAspirCrit<testMove> aspirCriterion;
testMove move;
solution solution;
cout << "[ moNoAspirCrit ] ==> ";
move(solution);
aspirCriterion.init();
test_result=((aspirCriterion(move, i))?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,101 +0,0 @@
/*
* <t-moNoFitImprSolContinue.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moNoFitImprSolContinue.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result, test_1, test_2;
int return_value, value_1, value_2;
unsigned int i;
moNoFitImprSolContinue<solution> continu(10);
solution solution;
cout << "[ moNoFitImprSolContinue ] ==> ";
continu.init();
test_1="KO";
try
{
continu(solution);
}
catch(std::runtime_error e)
{
test_1="OK";
}
value_1=((test_1.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
solution.fitness(0);
i=0;
while( continu(solution) )
{
i++;
solution.fitness(2);
}
test_2=((i!=11)?"KO":"OK");
value_2=((test_2.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
test_result=(((test_1.compare("OK")==0)&&(test_2.compare("OK")==0))?"OK":"KO");
return_value=(((value_1==EXIT_SUCCESS)&&(value_2==EXIT_SUCCESS))?EXIT_SUCCESS:EXIT_FAILURE);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,115 +0,0 @@
/*
* <t-moRandImprSelect.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moRandImprSelect.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
_solution=_solution;
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result, test_1, test_2, test_3;
int value_1, value_2, value_3, return_value;
unsigned int i;
moRandImprSelect<testMove> selection;
solution solution;
testMove move;
cout << "[ moRandImprSelect ] ==> ";
selection.init(0);
test_1="KO";
i=0;
try
{
selection(move, i);
}
catch(std::runtime_error e)
{
test_1="OK";
}
value_1=((test_1.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
move(solution);
test_2=((!selection.update(move, i))?"KO":"OK");
value_2=((test_2.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
selection(move, i);
i++;
test_3=((!selection.update(move, i))?"KO":"OK");
value_3=((test_3.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
selection(move, i);
test_result=(((test_1.compare("OK")==0)&&(test_2.compare("OK")==0)&&(test_3.compare("OK")==0))?"OK":"KO");
return_value=(((value_1==EXIT_SUCCESS)&&(value_2==EXIT_SUCCESS)&&(value_3==EXIT_SUCCESS))?EXIT_SUCCESS:EXIT_FAILURE);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,168 +0,0 @@
/*
* <t-moSA.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moSA.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution sol=_solution;
}
} ;
class testRandMove : public moRandMove<testMove>
{
public :
void operator () (testMove & _move)
{
_move=_move;
}
};
class testMoveIncrEval : public moMoveIncrEval <testMove>
{
public :
testMoveIncrEval() : counter(0)
{}
int operator () (const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution solution(_solution);
if(counter==0)
{
counter++;
return 2;
}
return 0;
}
private :
unsigned int counter;
} ;
class solutionContinue : public moSolContinue<solution>
{
public :
solutionContinue() : counter(0)
{}
bool operator () (const solution & _solution)
{
const solution sol(_solution);
if(counter==0)
{
counter++;
return true;
}
return false;
}
void init()
{}
private :
unsigned int counter;
} ;
class testCooling : public moCoolingSchedule
{
public :
bool operator () (double & _temperature)
{
double temperature;
temperature=_temperature;
return false;
}
};
class solutionEval : public eoEvalFunc <solution>
{
public :
void operator () (solution & _solution)
{
_solution.fitness(0);
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
solution solution;
testRandMove rand;
testMoveIncrEval incrEval;
solutionContinue continu;
testCooling cooling;
solutionEval eval;
moSA<testMove> sa(rand, incrEval, continu, 10.0, cooling, eval);
cout << "[ moSA ] ==> ";
sa(solution);
test_result=((solution.fitness()!=2)?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,104 +0,0 @@
/*
* <t-moSimpleMoveTabuList.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moSimpleMoveTabuList.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
testMove(unsigned int _value): value(_value)
{}
void operator () (solution & _solution)
{
_solution=_solution;
}
bool operator == (const testMove & _move)
{
return (value==_move.value);
}
private :
unsigned int value;
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
moSimpleMoveTabuList<testMove> tabuList(1);
solution solution;
testMove move_1(1), move_2(2);
cout << "[ moSimpleMoveTabuList ] ==> ";
tabuList.init();
tabuList.update();
tabuList.add(move_1, solution);
tabuList(move_2, solution);
move_1(solution);
tabuList.add(move_2, solution);
tabuList.add(move_2, solution);
test_result=((tabuList(move_1, solution))?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,106 +0,0 @@
/*
* <t-moSimpleSolutionTabuList.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moSimpleSolutionTabuList.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
class solution : public EO<unsigned int>
{
public:
solution(unsigned int _value): value(_value)
{}
bool operator == (const solution & _solution)
{
return (value==_solution.value);
}
private:
unsigned int value;
};
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution solution(_solution);
}
};
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
moSimpleSolutionTabuList<testMove> tabuList(1);
solution solution_1(1), solution_2(2);
testMove move;
cout << "[ moSimpleSolutionTabuList ] ==> ";
tabuList.init();
tabuList.update();
tabuList.add(move, solution_1);
move(solution_1);
tabuList.add(move, solution_2);
tabuList.add(move, solution_2);
test_result=((tabuList(move, solution_1))?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,108 +0,0 @@
/*
* <t-moSteadyFitSolContinue.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moSteadyFitSolContinue.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result, test_1, test_2;
int return_value, value_1, value_2;
unsigned int i;
solution solution_1, solution_2;
moSteadyFitSolContinue<solution> continu(10,10);
cout << "[ moSteadyFitSolContinue ] ==> ";
continu.init();
i=0;
solution_1.fitness(i);
while( continu(solution_1) && i<50)
{
i++;
if(i<11)
{
solution_1.fitness(i);
}
if(i==11)
{
test_1="KO";
try
{
continu(solution_2);
}
catch(std::runtime_error e)
{
test_1="OK";
}
value_1=((test_1.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
}
if(i==15)
{
solution_1.fitness(i);
}
}
test_2=((i!=25)?"KO":"OK");
value_2=((test_2.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
test_result=(((test_1.compare("OK")==0)&&(test_2.compare("OK")==0))?"OK":"KO");
return_value=(((value_1==EXIT_SUCCESS)&&(value_2==EXIT_SUCCESS))?EXIT_SUCCESS:EXIT_FAILURE);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,168 +0,0 @@
/*
* <t-moTA.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2007-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Salma Mesmoudi
*
* 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-moTA.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution sol=_solution;
}
} ;
class testRandMove : public moRandMove<testMove>
{
public :
void operator () (testMove & _move)
{
_move=_move;
}
};
class testMoveIncrEval : public moMoveIncrEval <testMove>
{
public :
testMoveIncrEval() : counter(0)
{}
int operator () (const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution solution(_solution);
if(counter==0)
{
counter++;
return 2;
}
return 0;
}
private :
unsigned int counter;
} ;
class solutionContinue : public moSolContinue<solution>
{
public :
solutionContinue() : counter(0)
{}
bool operator () (const solution & _solution)
{
const solution sol(_solution);
if(counter==0)
{
counter++;
return true;
}
return false;
}
void init()
{}
private :
unsigned int counter;
} ;
class testCooling : public moCoolingSchedule
{
public :
bool operator () (double & _threeshold)
{
double threeshold;
threeshold=_threeshold;
return false;
}
};
class solutionEval : public eoEvalFunc <solution>
{
public :
void operator () (solution & _solution)
{
_solution.fitness(0);
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
solution solution;
testRandMove rand;
testMoveIncrEval incrEval;
solutionContinue continu;
testCooling cooling;
solutionEval eval;
moTA<testMove> ta(rand, incrEval, continu, 10.0, cooling, eval);
cout << "[ moTA ] ==> ";
ta(solution);
test_result=((solution.fitness()!=2)?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,188 +0,0 @@
/*
* <t-moTS.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moTS.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution sol=_solution;
}
} ;
class testMoveInit : public moMoveInit <testMove>
{
public :
void operator () (testMove & _move, const solution & _solution)
{
testMove move=_move;
const solution sol(_solution);
}
} ;
class testMoveNext : public moNextMove <testMove>
{
public :
bool operator () (testMove & _move, const solution & _solution)
{
testMove move(_move);
const solution sol(_solution);
return false;
}
} ;
class testMoveIncrEval : public moMoveIncrEval <testMove>
{
public :
unsigned int operator () (const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution solution(_solution);
return 2;
}
} ;
class testTabuList : public moTabuList<testMove>
{
public:
bool operator() (const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution sol(_solution);
return false;
}
void add(const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution sol(_solution);
}
void update()
{}
void init()
{}
};
class testAspirCrit : public moAspirCrit<testMove>
{
public:
bool operator() (const testMove & _move, const unsigned int & _fitness)
{
unsigned int fitness;
const testMove move(_move);
fitness=_fitness;
return false;
}
void init()
{}
};
class solutionContinue : public moSolContinue<solution>
{
public :
bool operator () (const solution & _solution)
{
const solution sol(_solution);
return false;
}
void init()
{}
} ;
class solutionEval : public eoEvalFunc <solution>
{
public :
void operator () (solution & _solution)
{
_solution.fitness(2);
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
solution solution;
testMoveInit init;
testMoveNext next;
testMoveIncrEval incrEval;
testTabuList tabuList;
testAspirCrit aspirCrit;
solutionContinue continu;
solutionEval eval;
moTS<testMove> ts(init, next, incrEval, tabuList, aspirCrit, continu, eval);
cout << "[ moTS ] ==> ";
ts(solution);
test_result=((solution.fitness()!=2)?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,180 +0,0 @@
/*
* <t-moTSMoveLoopExpl.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moTSMoveLoopExpl.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution sol=_solution;
}
} ;
class testMoveInit : public moMoveInit <testMove>
{
public :
void operator () (testMove & _move, const solution & _solution)
{
testMove move=_move;
const solution sol(_solution);
}
} ;
class testMoveNext : public moNextMove <testMove>
{
public :
bool operator () (testMove & _move, const solution & _solution)
{
testMove move(_move);
const solution sol(_solution);
return false;
}
} ;
class testMoveIncrEval : public moMoveIncrEval <testMove>
{
public :
unsigned int operator () (const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution solution(_solution);
return 2;
}
} ;
class testTabuList : public moTabuList<testMove>
{
public:
bool operator() (const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution sol(_solution);
return false;
}
void add(const testMove & _move, const solution & _solution)
{
const testMove move(_move);
const solution sol(_solution);
}
void update()
{}
void init()
{}
};
class testAspirCrit : public moAspirCrit<testMove>
{
public:
bool operator() (const testMove & _move, const unsigned int & _fitness)
{
unsigned int fitness;
const testMove move(_move);
fitness=_fitness;
return false;
}
void init()
{}
};
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result, test_1, test_2;
int return_value, value_1, value_2;
solution solution_1 ,solution_2;
testMoveInit init;
testMoveNext next;
testMoveIncrEval incrEval;
testTabuList tabuList;
testAspirCrit aspirCrit;
moTSMoveLoopExpl<testMove> explorer(init, next, incrEval, tabuList, aspirCrit);
cout << "[ moTSMoveLoopExpl ] ==> ";
test_1="KO";
try
{
explorer(solution_1, solution_2);
}
catch(std::runtime_error e)
{
test_1="OK";
}
value_1=((test_1.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
solution_1.fitness(0);
explorer(solution_1, solution_2);
test_2=((solution_2.fitness()!=2)?"KO":"OK");
value_2=((test_2.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
test_result=(((test_1.compare("OK")==0)&&(test_2.compare("OK")==0))?"OK":"KO");
return_value=(((value_1==EXIT_SUCCESS)&&(value_2==EXIT_SUCCESS))?EXIT_SUCCESS:EXIT_FAILURE);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,123 +0,0 @@
/*
* <t-moTS_2.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2008
*
* Sébastien Cahon, Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
*
* 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-moTS_2.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution sol=_solution;
}
} ;
class testMoveExplorer : public moMoveExpl<testMove>
{
public :
void operator () (const solution & _solution_1, solution & _solution_2)
{
const solution solution(_solution_1);
_solution_2.fitness(2);
}
};
class solutionContinue : public moSolContinue<solution>
{
public :
bool operator () (const solution & _solution)
{
const solution sol(_solution);
return false;
}
void init()
{}
} ;
class solutionEval : public eoEvalFunc <solution>
{
public :
void operator () (solution & _solution)
{
_solution.fitness(0);
}
} ;
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
int return_value;
solution solution;
testMoveExplorer explorer;
solutionContinue continu;
solutionEval eval;
testMove move;
moTS<testMove> ts(explorer, continu, eval);
cout << "[ moTS_2 ] ==> ";
ts(solution);
move(solution);
test_result=((solution.fitness()!=2)?"KO":"OK");
return_value=((test_result.compare("KO")==0)?EXIT_FAILURE:EXIT_SUCCESS);
cout << test_result << endl;
return return_value;
}
//-----------------------------------------------------------------------------

View file

@ -1,140 +0,0 @@
/*
* <t-moVNS.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2007-2008
* (C) OPAC Team, LIFL, 2002-2008
*
* Salma Mesmoudi (salma.mesmoudi@inria.fr), Jean-Charles Boisson (Jean-Charles.Boisson@lifl.fr)
* Jeremie Humeau (jeremie.humeau@inria.fr)
*
* 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-moVNS.cpp
//-----------------------------------------------------------------------------
#include <eo> // EO
#include <mo> // MO
#include <cassert>
using std::cout;
using std::endl;
//-----------------------------------------------------------------------------
typedef EO<unsigned int> solution;
typedef eoScalarFitness< float, std::greater<float> > tspFitness ;
typedef eoVector <tspFitness, unsigned int> Route ;
int cpt=0;
int tableau[7]={10.0, 9.0, 8.0, 8.0, 7.0, 7.0, 7.0};
class testMove : public moMove <solution>
{
public :
void operator () (solution & _solution)
{
solution sol=_solution;
}
} ;
class solutionAlgo : public moAlgo <solution>
{
public :
bool operator () (solution & _solution)
{
solution solution(_solution);
return true;
}
} ;
class Voisinage : public eoMonOp<Route>
{
public :
bool operator () (Route & _solution)
{
_solution.invalidate();
//_solution.fitness();
return true;
}
} ;
class Explorer : public moExpl<Route>
{
public:
Explorer(eoMonOp<Route> & expl): moExpl<Route>( expl)
{
}
};
class solutionEval : public eoEvalFunc <Route>
{
public :
void operator () (Route & _solution)
{
_solution.fitness(tableau[cpt]);
cpt++;
}
};
//-----------------------------------------------------------------------------
int
main()
{
std::string test_result;
//solution solution;
Route so ;
Voisinage sol1;
Voisinage sol2;
Explorer explorer(sol1);
explorer.addExplorer(sol2);
solutionEval eval;
moVNS<Route> vns(explorer, eval);
cout << "[moVNS] ==> ";
so.fitness(20.0);
vns(so);
assert(so.fitness()==7.0);
cout << "OK" << endl;
return EXIT_SUCCESS;
}
//-----------------------------------------------------------------------------