tests added
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1701 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
5c3260d712
commit
44f971d492
8 changed files with 202 additions and 55 deletions
|
|
@ -47,10 +47,12 @@ SET (TEST_LIST
|
|||
t-moCounterMonitorSaver
|
||||
t-moSolutionStat
|
||||
t-moCheckpoint
|
||||
t-moDummyMemory
|
||||
t-moSimpleHCexplorer
|
||||
t-moSimpleHCneutralExplorer
|
||||
t-moHCneutralExplorer
|
||||
t-moFirstImprExplorer
|
||||
t-moRandomWalkExplorer
|
||||
|
||||
)
|
||||
|
||||
|
|
|
|||
63
branches/newMo/test/t-moDummyMemory.cpp
Normal file
63
branches/newMo/test/t-moDummyMemory.cpp
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
<t-moDummyMemory.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
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".
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include <memory/moDummyIntensification.h>
|
||||
#include <memory/moDummyDiversification.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moDummyMemory] => START" << std::endl;
|
||||
|
||||
eoBit<eoMinimizingFitness> sol(4);
|
||||
bitNeighbor n;
|
||||
moDummyDiversification<bitNeighbor> test1;
|
||||
test1.init(sol);
|
||||
test1.add(sol, n);
|
||||
test1.update(sol, n);
|
||||
test1.clearMemory();
|
||||
assert(!test1(sol));
|
||||
|
||||
moDummyIntensification<bitNeighbor> test2;
|
||||
test2.init(sol);
|
||||
test2.add(sol, n);
|
||||
test2.update(sol, n);
|
||||
test2.clearMemory();
|
||||
assert(!test2(sol));
|
||||
|
||||
|
||||
std::cout << "[t-moDummyMemory] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
77
branches/newMo/test/t-moRandomWalkExplorer.cpp
Normal file
77
branches/newMo/test/t-moRandomWalkExplorer.cpp
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
<t-moRandomWalkExplorer.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
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".
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include <explorer/moRandomWalkExplorer.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moRandomWalkExplorer] => START" << std::endl;
|
||||
|
||||
eoBit<eoMinimizingFitness> sol(4, true);
|
||||
sol.fitness(4);
|
||||
bitNeighborhood nh(4);
|
||||
evalOneMax eval(4);
|
||||
|
||||
moRandomWalkExplorer<bitNeighborhood> test(nh, eval, 3);
|
||||
|
||||
test.initParam(sol);
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==3);
|
||||
test.updateParam(sol);
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==4);
|
||||
test.updateParam(sol);
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==3);
|
||||
assert(!sol[0]);
|
||||
test.updateParam(sol);
|
||||
assert(!test.isContinue(sol));
|
||||
|
||||
std::cout << "[t-moRandomWalkExplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue