Fix warnings in debug

This commit is contained in:
quemy 2013-01-19 00:46:08 +01:00
commit 49190367af
10 changed files with 43 additions and 45 deletions

View file

@ -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;

View file

@ -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;
} }
} }

View file

@ -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 () ;
} }
@ -108,7 +108,7 @@ void paradiseo::smp::CustomBooleanTopology::construct(unsigned nbNode)
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;

View file

@ -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;

View file

@ -53,7 +53,7 @@ void paradiseo::smp::Hypercubic::operator()(unsigned nbNode, std::vector<std::ve
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++)
{ {

View file

@ -33,23 +33,20 @@ 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 r1 = (double)listFact[i] * listFact[i] / nbNode;
double r2 = (double)listFact[i-1] * listFact[i-1] / 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

View file

@ -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;
} }
} }

View file

@ -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;

View file

@ -78,8 +78,7 @@ int main()
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;
@ -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);
} }

View file

@ -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;