Fix warnings in debug
This commit is contained in:
parent
4266aaf5ee
commit
49190367af
10 changed files with 43 additions and 45 deletions
|
|
@ -135,9 +135,9 @@ protected:
|
||||||
*/
|
*/
|
||||||
virtual void send(eoSelect<EOT>& _select);
|
virtual void send(eoSelect<EOT>& _select);
|
||||||
|
|
||||||
|
EOAlgo<EOT> algo;
|
||||||
eoEvalFunc<EOT>& eval;
|
eoEvalFunc<EOT>& eval;
|
||||||
eoPop<EOT>& pop;
|
eoPop<EOT>& pop;
|
||||||
EOAlgo<EOT> algo;
|
|
||||||
std::queue<eoPop<bEOT>> listImigrants;
|
std::queue<eoPop<bEOT>> listImigrants;
|
||||||
IntPolicy<EOT>& intPolicy;
|
IntPolicy<EOT>& intPolicy;
|
||||||
MigPolicy<EOT>& migPolicy;
|
MigPolicy<EOT>& migPolicy;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
void paradiseo::smp::Complete::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
void paradiseo::smp::Complete::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
||||||
{
|
{
|
||||||
if(nbNode!=matrix.size())
|
if(nbNode != matrix.size())
|
||||||
{
|
{
|
||||||
matrix.clear();
|
matrix.clear();
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ void paradiseo::smp::Complete::operator()(unsigned nbNode, std::vector<std::vect
|
||||||
std::vector<bool> line;
|
std::vector<bool> line;
|
||||||
line.assign(nbNode,true);
|
line.assign(nbNode,true);
|
||||||
matrix.assign(nbNode, line);
|
matrix.assign(nbNode, line);
|
||||||
for(int i=0;i<nbNode;i++)
|
for(unsigned i = 0; i < nbNode; i++)
|
||||||
matrix[i][i]=false;
|
matrix[i][i]=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
paradiseo::smp::CustomBooleanTopology::CustomBooleanTopology(std::string filename)
|
paradiseo::smp::CustomBooleanTopology::CustomBooleanTopology(std::string filename)
|
||||||
{
|
{
|
||||||
std :: ifstream f(filename);
|
std::ifstream f(filename);
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
int temp;
|
int temp;
|
||||||
|
|
@ -56,7 +56,7 @@ paradiseo::smp::CustomBooleanTopology::CustomBooleanTopology(std::string filenam
|
||||||
std::istringstream tokenizer(line);
|
std::istringstream tokenizer(line);
|
||||||
std::string token;
|
std::string token;
|
||||||
|
|
||||||
while(tokenizer>> temp >> std::skipws)
|
while(tokenizer >> temp >> std::skipws)
|
||||||
{
|
{
|
||||||
//white spaces are skipped, and the integer is converted to boolean, to be stored
|
//white spaces are skipped, and the integer is converted to boolean, to be stored
|
||||||
isNeighbor = (bool) temp;
|
isNeighbor = (bool) temp;
|
||||||
|
|
@ -67,12 +67,12 @@ paradiseo::smp::CustomBooleanTopology::CustomBooleanTopology(std::string filenam
|
||||||
if(isFirst)
|
if(isFirst)
|
||||||
{
|
{
|
||||||
size = lineVector.size();
|
size = lineVector.size();
|
||||||
isFirst=false;
|
isFirst = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//for each vector non empty, if the size is not equal to the others, error
|
//for each vector non empty, if the size is not equal to the others, error
|
||||||
if(lineVector.size() != size && !lineVector.empty())
|
if(lineVector.size() != size && !lineVector.empty())
|
||||||
throw std::runtime_error("Mistake in the topology, line "+ std::to_string(_matrix.size()+1) );
|
throw std::runtime_error("Mistake in the topology, line " + std::to_string(_matrix.size()+1) );
|
||||||
|
|
||||||
if(!lineVector.empty())
|
if(!lineVector.empty())
|
||||||
_matrix.push_back(lineVector);
|
_matrix.push_back(lineVector);
|
||||||
|
|
@ -81,7 +81,7 @@ paradiseo::smp::CustomBooleanTopology::CustomBooleanTopology(std::string filenam
|
||||||
//for each vector, verify if the size is equal to the size of the final matrix
|
//for each vector, verify if the size is equal to the size of the final matrix
|
||||||
for(auto& line : _matrix)
|
for(auto& line : _matrix)
|
||||||
if(line.size() != _matrix.size())
|
if(line.size() != _matrix.size())
|
||||||
throw std::runtime_error("Mistake in the topology, matrix is not square" );
|
throw std::runtime_error("Mistake in the topology, matrix is not squared" );
|
||||||
|
|
||||||
f.close () ;
|
f.close () ;
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +94,7 @@ paradiseo::smp::CustomBooleanTopology::CustomBooleanTopology(std::string filenam
|
||||||
std::vector<unsigned> paradiseo::smp::CustomBooleanTopology::getIdNeighbors(unsigned idNode) const
|
std::vector<unsigned> paradiseo::smp::CustomBooleanTopology::getIdNeighbors(unsigned idNode) const
|
||||||
{
|
{
|
||||||
std::vector<unsigned> neighbors;
|
std::vector<unsigned> neighbors;
|
||||||
for(unsigned j=0; j<_matrix.size();j++)
|
for(unsigned j = 0; j < _matrix.size();j++)
|
||||||
if(_matrix[idNode][j])
|
if(_matrix[idNode][j])
|
||||||
neighbors.push_back(j);
|
neighbors.push_back(j);
|
||||||
|
|
||||||
|
|
@ -103,17 +103,17 @@ std::vector<unsigned> paradiseo::smp::CustomBooleanTopology::getIdNeighbors(unsi
|
||||||
|
|
||||||
void paradiseo::smp::CustomBooleanTopology::construct(unsigned nbNode)
|
void paradiseo::smp::CustomBooleanTopology::construct(unsigned nbNode)
|
||||||
{
|
{
|
||||||
assert(nbNode==_matrix.size());
|
assert(nbNode == _matrix.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void paradiseo::smp::CustomBooleanTopology::isolateNode(unsigned idNode)
|
void paradiseo::smp::CustomBooleanTopology::isolateNode(unsigned idNode)
|
||||||
{
|
{
|
||||||
for(int i=0;i<_matrix.size();i++)
|
for(unsigned i = 0; i < _matrix.size(); i++)
|
||||||
{
|
{
|
||||||
//Line of idNode to false : no connection FROM this node
|
//Line of idNode to false : no connection FROM this node
|
||||||
_matrix[idNode][i]=false;
|
_matrix[idNode][i] = false;
|
||||||
|
|
||||||
//Column of idNode to false : no connection TO this node
|
//Column of idNode to false : no connection TO this node
|
||||||
_matrix[i][idNode]=false;
|
_matrix[i][idNode] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ void paradiseo::smp::CustomStochasticTopology::construct(unsigned nbNode)
|
||||||
|
|
||||||
void paradiseo::smp::CustomStochasticTopology::isolateNode(unsigned idNode)
|
void paradiseo::smp::CustomStochasticTopology::isolateNode(unsigned idNode)
|
||||||
{
|
{
|
||||||
for(int i=0;i<_matrix.size();i++)
|
for(unsigned i = 0; i < _matrix.size(); i++)
|
||||||
{
|
{
|
||||||
//Line of idNode to false : no connection FROM this node
|
//Line of idNode to false : no connection FROM this node
|
||||||
_matrix[idNode][i]=0;
|
_matrix[idNode][i]=0;
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,13 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
void paradiseo::smp::Hypercubic::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
void paradiseo::smp::Hypercubic::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
||||||
{
|
{
|
||||||
if(nbNode!=matrix.size())
|
if(nbNode != matrix.size())
|
||||||
{
|
{
|
||||||
//Check if the number of node is coherent with an hypercube
|
// Check if the number of node is coherent with an hypercube
|
||||||
assert((nbNode & (nbNode-1)) == 0);
|
assert((nbNode & (nbNode-1)) == 0);
|
||||||
|
|
||||||
unsigned power=0,i,j;
|
unsigned power = 0, i, j;
|
||||||
while((nbNode & 1<<power) == 0)
|
while((nbNode & 1 << power) == 0)
|
||||||
power++;
|
power++;
|
||||||
|
|
||||||
matrix.clear();
|
matrix.clear();
|
||||||
|
|
@ -51,14 +51,14 @@ void paradiseo::smp::Hypercubic::operator()(unsigned nbNode, std::vector<std::ve
|
||||||
|
|
||||||
//Construction
|
//Construction
|
||||||
matrix[0][0] = false;
|
matrix[0][0] = false;
|
||||||
for (unsigned dim = 1; dim <= power; dim ++)
|
for(unsigned dim = 1; dim <= power; dim ++)
|
||||||
{
|
{
|
||||||
int stepNbNode = 1<< (dim-1); //represents the number of nodes for the current step.
|
unsigned stepNbNode = 1 << (dim-1); //represents the number of nodes for the current step.
|
||||||
for(i=0; i <stepNbNode; i++)
|
for(i = 0; i < stepNbNode; i++)
|
||||||
for(j=0; j< stepNbNode;j++)
|
for(j = 0; j < stepNbNode; j++)
|
||||||
{
|
{
|
||||||
matrix[i+stepNbNode][j+stepNbNode]=matrix[i][j];//Diagonal part
|
matrix[i+stepNbNode][j+stepNbNode]=matrix[i][j]; //Diagonal part
|
||||||
matrix[i][j+stepNbNode]= matrix[i+stepNbNode][j] = (i == j);//Identity
|
matrix[i][j+stepNbNode]= matrix[i+stepNbNode][j] = (i == j); //Identity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,31 +33,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
void paradiseo::smp::Mesh::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
void paradiseo::smp::Mesh::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
||||||
{
|
{
|
||||||
int i=0, j, height, width;
|
unsigned i = 0, j, height, width;
|
||||||
std::vector<unsigned> listFact = paradiseo::smp::Mesh::factorization(nbNode);
|
std::vector<unsigned> listFact = paradiseo::smp::Mesh::factorization(nbNode);
|
||||||
int nbFact = listFact.size();
|
|
||||||
|
|
||||||
//Compute width and height
|
//Compute width and height
|
||||||
//find the ratio height/width of the grid that matches best the variable _ratio
|
//find the ratio height/width of the grid that matches best the variable _ratio
|
||||||
while (i<listFact.size()-1 && (double)listFact[i]*listFact[i]/nbNode<_ratio)
|
while (i < listFact.size() - 1 && (double)listFact[i]*listFact[i] / nbNode < _ratio)
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
/*
|
// listFact[i] contains first factor which produces a ratio above the variable _ratio,
|
||||||
listFact[i] contains first factor which produces a ratio above the variable _ratio,
|
// or the last element if there is no ratio that can go over the variable _ratio.
|
||||||
or the last element if there is no ratio that can go over the variable _ratio.
|
double r1 = (double)listFact[i] * listFact[i] / nbNode;
|
||||||
*/
|
double r2 = (double)listFact[i-1] * listFact[i-1] / nbNode;
|
||||||
double r1 = (double)listFact[i]*listFact[i]/nbNode;
|
|
||||||
double r2 = (double)listFact[i-1]*listFact[i-1]/nbNode;
|
|
||||||
|
|
||||||
//which ratio (r1,r2) matches _ratio best?
|
// Which ratio (r1,r2) matches _ratio best?
|
||||||
if (std::abs(r2-_ratio) <= _ratio-r1)
|
if (std::abs(r2 - _ratio) <= _ratio - r1)
|
||||||
height = listFact[i-1];
|
height = listFact[i-1];
|
||||||
else
|
else
|
||||||
height = listFact[i];
|
height = listFact[i];
|
||||||
|
|
||||||
width = nbNode/height;
|
width = nbNode/height;
|
||||||
|
|
||||||
//Building matrix
|
// Building matrix
|
||||||
matrix.clear();
|
matrix.clear();
|
||||||
|
|
||||||
matrix.resize(nbNode);
|
matrix.resize(nbNode);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
void paradiseo::smp::Ring::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
void paradiseo::smp::Ring::operator()(unsigned nbNode, std::vector<std::vector<bool>>& matrix) const
|
||||||
{
|
{
|
||||||
if(nbNode!=matrix.size())
|
if(nbNode != matrix.size())
|
||||||
{
|
{
|
||||||
matrix.clear();
|
matrix.clear();
|
||||||
|
|
||||||
|
|
@ -44,7 +44,7 @@ void paradiseo::smp::Ring::operator()(unsigned nbNode, std::vector<std::vector<b
|
||||||
line.assign(nbNode, false);
|
line.assign(nbNode, false);
|
||||||
matrix.assign(nbNode, line);
|
matrix.assign(nbNode, line);
|
||||||
|
|
||||||
for(int i=0; i<nbNode;i++)
|
for(unsigned i=0; i < nbNode; i++)
|
||||||
matrix[i][(i+1)%nbNode]=true;
|
matrix[i][(i+1)%nbNode]=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ void paradiseo::smp::Topology<TopologyType>::construct(unsigned nbNode)
|
||||||
template <class TopologyType>
|
template <class TopologyType>
|
||||||
void paradiseo::smp::Topology<TopologyType>::isolateNode(unsigned idNode)
|
void paradiseo::smp::Topology<TopologyType>::isolateNode(unsigned idNode)
|
||||||
{
|
{
|
||||||
for(int i=0;i<_matrix.size();i++)
|
for(unsigned i = 0; i < _matrix.size(); i++)
|
||||||
{
|
{
|
||||||
//Line of idNode to false : no connection FROM this node
|
//Line of idNode to false : no connection FROM this node
|
||||||
_matrix[idNode][i] = false;
|
_matrix[idNode][i] = false;
|
||||||
|
|
|
||||||
|
|
@ -73,13 +73,12 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reading the actual matrix
|
//Reading the actual matrix
|
||||||
std :: ifstream f("data-topo-stoch");
|
std::ifstream f("data-topo-stoch");
|
||||||
std::vector<std::vector<double>> _matrix;
|
std::vector<std::vector<double>> _matrix;
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
double temp;
|
double temp;
|
||||||
unsigned size;
|
double isNeighbor;
|
||||||
double isNeighbor, isFirst = true;
|
|
||||||
std::string line;
|
std::string line;
|
||||||
std::vector<double> lineVector;
|
std::vector<double> lineVector;
|
||||||
|
|
||||||
|
|
@ -91,7 +90,7 @@ int main()
|
||||||
std::istringstream tokenizer(line);
|
std::istringstream tokenizer(line);
|
||||||
std::string token;
|
std::string token;
|
||||||
|
|
||||||
while(tokenizer>> temp >> std::skipws)
|
while(tokenizer >> temp >> std::skipws)
|
||||||
{
|
{
|
||||||
//white spaces are skipped, and the integer is converted to boolean, to be stored
|
//white spaces are skipped, and the integer is converted to boolean, to be stored
|
||||||
|
|
||||||
|
|
@ -112,7 +111,7 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
//Comparison to the actual matrix : _matrix
|
//Comparison to the actual matrix : _matrix
|
||||||
for(int i = 0; i < matrix.size(); i++)
|
for(unsigned i = 0; i < matrix.size(); i++)
|
||||||
for(int j = 0; j < matrix.size(); j++)
|
for(unsigned j = 0; j < matrix.size(); j++)
|
||||||
assert(std::abs(_matrix[i][j] - matrix[i][j]) < .05);
|
assert(std::abs(_matrix[i][j] - matrix[i][j]) < .05);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ typedef eoBit<double> Indi2; // A bitstring with fitness double
|
||||||
// Conversion functions
|
// Conversion functions
|
||||||
Indi2 fromBase(Indi& i, unsigned size)
|
Indi2 fromBase(Indi& i, unsigned size)
|
||||||
{
|
{
|
||||||
|
(void)i;
|
||||||
// Dummy conversion. We just create a new Indi2
|
// Dummy conversion. We just create a new Indi2
|
||||||
Indi2 v;
|
Indi2 v;
|
||||||
for (unsigned ivar=0; ivar<size; ivar++)
|
for (unsigned ivar=0; ivar<size; ivar++)
|
||||||
|
|
@ -27,6 +28,7 @@ Indi2 fromBase(Indi& i, unsigned size)
|
||||||
|
|
||||||
Indi toBase(Indi2& i)
|
Indi toBase(Indi2& i)
|
||||||
{
|
{
|
||||||
|
(void)i;
|
||||||
// Dummy conversion. We just create a new Indi
|
// Dummy conversion. We just create a new Indi
|
||||||
Indi v;
|
Indi v;
|
||||||
std::cout << "Convert to base : " << v << std::endl;
|
std::cout << "Convert to base : " << v << std::endl;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue