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:
parent
6dca6d0ed4
commit
cefb34d3a9
2 changed files with 27 additions and 4 deletions
|
|
@ -116,6 +116,12 @@ public:
|
||||||
index = 0;
|
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:
|
private:
|
||||||
//tabu list
|
//tabu list
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ int main() {
|
||||||
n3.index(2);
|
n3.index(2);
|
||||||
n4.index(3);
|
n4.index(3);
|
||||||
|
|
||||||
|
std::cout << n1.index() << std::endl;
|
||||||
|
|
||||||
//n1 must be tabu
|
//n1 must be tabu
|
||||||
test.add(sol, n1);
|
test.add(sol, n1);
|
||||||
assert(test.check(sol, n1));
|
assert(test.check(sol, n1));
|
||||||
|
|
@ -60,6 +62,8 @@ int main() {
|
||||||
assert(!test.check(sol, n3));
|
assert(!test.check(sol, n3));
|
||||||
assert(!test.check(sol, n4));
|
assert(!test.check(sol, n4));
|
||||||
|
|
||||||
|
test.print();
|
||||||
|
|
||||||
//n1 and n2 must be tabu
|
//n1 and n2 must be tabu
|
||||||
test.add(sol, n2);
|
test.add(sol, n2);
|
||||||
assert(test.check(sol, n1));
|
assert(test.check(sol, n1));
|
||||||
|
|
@ -67,12 +71,25 @@ int main() {
|
||||||
assert(!test.check(sol, n3));
|
assert(!test.check(sol, n3));
|
||||||
assert(!test.check(sol, n4));
|
assert(!test.check(sol, n4));
|
||||||
|
|
||||||
|
test.print();
|
||||||
|
|
||||||
//n3 is added, so it replace n1 -> n2 and n3 must be tabu
|
//n3 is added, so it replace n1 -> n2 and n3 must be tabu
|
||||||
test.add(sol, n3);
|
test.add(sol, n3);
|
||||||
assert(!test.check(sol, n1));
|
if(test.check(sol, n1))
|
||||||
assert(test.check(sol, n2));
|
std::cout << "n1 is in tabuList" << std::endl;
|
||||||
assert(test.check(sol, n3));
|
if(test.check(sol, n2))
|
||||||
assert(!test.check(sol, n4));
|
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
|
//clear tabu list all neighbor must not be tabu
|
||||||
test.init(sol);
|
test.init(sol);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue