test sur la tabu liste de voisins

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1835 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2010-05-27 13:52:57 +00:00
commit cefb34d3a9
2 changed files with 27 additions and 4 deletions

View file

@ -116,6 +116,12 @@ public:
index = 0;
}
void print(){
std::cout << "TAbulist:" << std::endl;
for(int i=0; i<tabuList.size(); i++)
std::cout << i << ": " << tabuList[0].first.index() << std::endl;
}
private:
//tabu list

View file

@ -53,6 +53,8 @@ int main() {
n3.index(2);
n4.index(3);
std::cout << n1.index() << std::endl;
//n1 must be tabu
test.add(sol, n1);
assert(test.check(sol, n1));
@ -60,6 +62,8 @@ int main() {
assert(!test.check(sol, n3));
assert(!test.check(sol, n4));
test.print();
//n1 and n2 must be tabu
test.add(sol, n2);
assert(test.check(sol, n1));
@ -67,12 +71,25 @@ int main() {
assert(!test.check(sol, n3));
assert(!test.check(sol, n4));
test.print();
//n3 is added, so it replace n1 -> n2 and n3 must be tabu
test.add(sol, n3);
assert(!test.check(sol, n1));
assert(test.check(sol, n2));
assert(test.check(sol, n3));
assert(!test.check(sol, n4));
if(test.check(sol, n1))
std::cout << "n1 is in tabuList" << std::endl;
if(test.check(sol, n2))
std::cout << "n2 is in tabuList" << std::endl;
if(test.check(sol, n3))
std::cout << "n3 is in tabuList" << std::endl;
if(test.check(sol, n4))
std::cout << "n4 is in tabuList" << std::endl;
test.print();
// assert(!test.check(sol, n1));
// assert(test.check(sol, n2));
// assert(test.check(sol, n3));
// assert(!test.check(sol, n4));
//clear tabu list all neighbor must not be tabu
test.init(sol);