Debug neighborTabuList, index was not initialized
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1836 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
cefb34d3a9
commit
c51f7a8962
2 changed files with 6 additions and 23 deletions
|
|
@ -48,7 +48,7 @@ public:
|
||||||
* @param _maxSize maximum size of the tabu list
|
* @param _maxSize maximum size of the tabu list
|
||||||
* @param _howlong how many iteration a move is tabu (0 -> no limits)
|
* @param _howlong how many iteration a move is tabu (0 -> no limits)
|
||||||
*/
|
*/
|
||||||
moNeighborVectorTabuList(unsigned int _maxSize, unsigned int _howlong) : maxSize(_maxSize), howlong(_howlong) {
|
moNeighborVectorTabuList(unsigned int _maxSize, unsigned int _howlong) : maxSize(_maxSize), howlong(_howlong), index(0) {
|
||||||
tabuList.reserve(_maxSize);
|
tabuList.reserve(_maxSize);
|
||||||
tabuList.resize(0);
|
tabuList.resize(0);
|
||||||
}
|
}
|
||||||
|
|
@ -119,7 +119,7 @@ public:
|
||||||
void print(){
|
void print(){
|
||||||
std::cout << "TAbulist:" << std::endl;
|
std::cout << "TAbulist:" << std::endl;
|
||||||
for(int i=0; i<tabuList.size(); i++)
|
for(int i=0; i<tabuList.size(); i++)
|
||||||
std::cout << i << ": " << tabuList[0].first.index() << std::endl;
|
std::cout << i << ": " << tabuList[i].first.index() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,6 @@ 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));
|
||||||
|
|
@ -62,8 +60,6 @@ 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));
|
||||||
|
|
@ -71,25 +67,12 @@ 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);
|
||||||
if(test.check(sol, n1))
|
assert(!test.check(sol, n1));
|
||||||
std::cout << "n1 is in tabuList" << std::endl;
|
assert(test.check(sol, n2));
|
||||||
if(test.check(sol, n2))
|
assert(test.check(sol, n3));
|
||||||
std::cout << "n2 is in tabuList" << std::endl;
|
assert(!test.check(sol, n4));
|
||||||
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