Passage du code dans un pretty printer

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1813 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2010-05-17 14:56:42 +00:00
commit 3d8057ac4d
88 changed files with 2726 additions and 2720 deletions

View file

@ -37,7 +37,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
* Abstract class for Acceptance criteria
*/
template< class Neighbor >
class moAcceptanceCriterion : public eoBF<typename Neighbor::EOT&, typename Neighbor::EOT&, bool>, virtual public moMemory<Neighbor>{
class moAcceptanceCriterion : public eoBF<typename Neighbor::EOT&, typename Neighbor::EOT&, bool>, virtual public moMemory<Neighbor> {
};

View file

@ -37,7 +37,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
* Acceptance Criterion for extreme diversification : always accept new solution
*/
template< class Neighbor >
class moAlwaysAcceptCrit : public moAcceptanceCriterion<Neighbor>, public moDummyMemory<Neighbor>{
class moAlwaysAcceptCrit : public moAcceptanceCriterion<Neighbor>, public moDummyMemory<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;
@ -48,7 +48,7 @@ public:
* @param _sol2 the new solution after local search
* @return always true
*/
bool operator()(EOT& _sol1, EOT& _sol2){
bool operator()(EOT& _sol1, EOT& _sol2) {
return true;
}

View file

@ -38,12 +38,12 @@ Contact: paradiseo-help@lists.gforge.inria.fr
* Acceptance Criterion for extreme intensification : accept if the new solution is better than previous one
*/
template< class Neighbor >
class moBetterAcceptCrit : public moAcceptanceCriterion<Neighbor>, public moDummyMemory<Neighbor>{
class moBetterAcceptCrit : public moAcceptanceCriterion<Neighbor>, public moDummyMemory<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;
moBetterAcceptCrit(moSolComparator<EOT>& _comparator):comparator(_comparator){}
moBetterAcceptCrit(moSolComparator<EOT>& _comparator):comparator(_comparator) {}
/**
* Accept if the new solution is better than previous one
@ -51,7 +51,7 @@ public:
* @param _sol2 the new solution after local search
* @return true if the new solution is better than previous one
*/
bool operator()(EOT& _sol1, EOT& _sol2){
bool operator()(EOT& _sol1, EOT& _sol2) {
return comparator(_sol1, _sol2);
}

View file

@ -97,9 +97,11 @@ public:
private:
class dummmyMonOp: public eoMonOp<EOT>{
class dummmyMonOp: public eoMonOp<EOT> {
public:
bool operator()(EOT&){return false;}
bool operator()(EOT&) {
return false;
}
}dummyOp;
moIterContinuator<moDummyNeighbor<EOT> > iterCont;
moMonOpPerturb<Neighbor> defaultPerturb;

View file

@ -65,7 +65,7 @@ public:
* @param _solution a solution
*/
virtual void init(EOT & _solution) {
for(unsigned int i = 0; i < continuators.size(); ++i)
for (unsigned int i = 0; i < continuators.size(); ++i)
continuators[i]->init(_solution);
}
@ -78,7 +78,7 @@ public:
// some data may be update in each continuator.
// So, all continuators are tested
for(unsigned int i = 0; i < continuators.size(); ++i)
for (unsigned int i = 0; i < continuators.size(); ++i)
if ( !(*continuators[i])(_solution) )
bContinue = false;

View file

@ -46,7 +46,7 @@ public:
/**
* @param _maxFit maximum fitness to reach
*/
moFitContinuator(Fitness _maxFit): maxFit(_maxFit){}
moFitContinuator(Fitness _maxFit): maxFit(_maxFit) {}
/**
*@param _solution a solution

View file

@ -46,7 +46,7 @@ public:
* @param _maxIter number maximum of iterations
* @param _verbose true/false : verbose mode on/off
*/
moIterContinuator(unsigned int _maxIter, bool _verbose=true): maxIter(_maxIter), verbose(_verbose){}
moIterContinuator(unsigned int _maxIter, bool _verbose=true): maxIter(_maxIter), verbose(_verbose) {}
/**
*@param _solution a solution
@ -56,7 +56,7 @@ public:
bool res;
cpt++;
res = (cpt < maxIter);
if(!res && verbose)
if (!res && verbose)
std::cout << "STOP in moIterContinuator: Reached maximum number of iterations [" << cpt << "/" << maxIter << "]" << std::endl;
return res;
}

View file

@ -51,7 +51,7 @@ public:
* @param _eval neighbor evaluation function to count
* @param _maxNeighborEval number maximum of iterations
*/
moNeighborEvalContinuator(moEvalCounter<Neighbor> & _eval, unsigned int _maxNeighborEval): eval(_eval), maxNeighborEval(_maxNeighborEval){}
moNeighborEvalContinuator(moEvalCounter<Neighbor> & _eval, unsigned int _maxNeighborEval): eval(_eval), maxNeighborEval(_maxNeighborEval) {}
/**
* Test if continue

View file

@ -54,7 +54,7 @@ public:
/**
* first call of a statistical operator
*/
virtual void init(EOT &){}
virtual void init(EOT &) {}
};

View file

@ -47,7 +47,7 @@ public:
* @param _max maximum running time$
* @param _verbose verbose mode true/false -> on/off
*/
moTimeContinuator(time_t _max, bool _verbose=true): max(_max), verbose(_verbose){
moTimeContinuator(time_t _max, bool _verbose=true): max(_max), verbose(_verbose) {
start = time(NULL);
}
@ -61,7 +61,7 @@ public:
bool res;
time_t elapsed = (time_t) difftime(time(NULL), start);
res = (elapsed < max);
if(!res && verbose)
if (!res && verbose)
std::cout << "STOP in moTimeContinuator: Reached maximum time [" << elapsed << "/" << max << "]" << std::endl;
return res;
}

View file

@ -179,7 +179,7 @@ public:
throw std::runtime_error(str);
}
for(unsigned int i = 0; i < size(); i++) {
for (unsigned int i = 0; i < size(); i++) {
os << getValue(i);
os << std::endl ;

View file

@ -36,7 +36,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
* Dummy Evaluation function
*/
template<class Neighbor>
class moDummyEval : public moEval<Neighbor>{
class moDummyEval : public moEval<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;
typedef typename EOT::Fitness Fitness;
@ -46,7 +46,7 @@ public:
* @param _sol a solution (unused)
* @param _n a neighbor (unused)
*/
void operator()(EOT& _sol, Neighbor& _n){}
void operator()(EOT& _sol, Neighbor& _n) {}
};

View file

@ -67,7 +67,9 @@ public:
* @param _solution a solution (unused)
* @return always false
*/
bool isContinue(EOT& _solution) { return false; } ;
bool isContinue(EOT& _solution) {
return false;
} ;
/**
* NOTHING TO DO
@ -80,7 +82,9 @@ public:
* @param _solution a solution (unused)
* @return always false
*/
virtual bool accept(EOT& _solution) { return false; } ;
virtual bool accept(EOT& _solution) {
return false;
} ;
/**
* NOTHING TO DO

View file

@ -62,14 +62,14 @@ public:
* @param _perturb a perturbation operator
* @param _acceptCrit a acceptance criteria
*/
moILSexplorer(moLocalSearch<Neighbor>& _ls, moPerturbation<Neighbor>& _perturb, moAcceptanceCriterion<Neighbor>& _acceptCrit) : moNeighborhoodExplorer<dummyNeighbor>(), ls(_ls), perturb(_perturb), acceptCrit(_acceptCrit){
moILSexplorer(moLocalSearch<Neighbor>& _ls, moPerturbation<Neighbor>& _perturb, moAcceptanceCriterion<Neighbor>& _acceptCrit) : moNeighborhoodExplorer<dummyNeighbor>(), ls(_ls), perturb(_perturb), acceptCrit(_acceptCrit) {
firstIteration=true;
}
/**
* Destructor
*/
~moILSexplorer(){
~moILSexplorer() {
}
@ -77,7 +77,7 @@ public:
* Init perturbation and acceptance criteria
* @param _solution the current solution
*/
virtual void initParam(EOT & _solution){
virtual void initParam(EOT & _solution) {
firstIteration=true;
perturb.init(_solution);
acceptCrit.init(_solution);
@ -87,8 +87,8 @@ public:
* Update perturbation and acceptance criteria
* @param _solution the current solution
*/
virtual void updateParam(EOT & _solution){
if((*this).moveApplied()){
virtual void updateParam(EOT & _solution) {
if ((*this).moveApplied()) {
perturb.add(_solution,emptyNeighbor);
acceptCrit.add(_solution,emptyNeighbor);
}
@ -100,18 +100,18 @@ public:
* terminate: NOTHING TO DO
* @param _solution a solution (unused)
*/
virtual void terminate(EOT & _solution){};
virtual void terminate(EOT & _solution) {};
/**
* Perturb and apply local search on a solution
* @param _solution the solution
*/
virtual void operator()(EOT & _solution){
virtual void operator()(EOT & _solution) {
//copy the solution to perform new local search
current=_solution;
//perturb solution exept at the first iteration
if(!firstIteration){
if (!firstIteration) {
perturb(current);
}

View file

@ -171,7 +171,7 @@ public:
* Getter
* @return the temperature
*/
double getTemperature(){
double getTemperature() {
return temperature;
}

View file

@ -36,7 +36,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
* Count the number of move, noMove and the number of successive stagnation since the last Move
*/
template< class Neighbor >
class moCountMoveMemory : virtual public moMemory<Neighbor>{
class moCountMoveMemory : virtual public moMemory<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;
@ -82,7 +82,7 @@ public:
* Getter of the number of move
* @return the counter
*/
unsigned int getNbMove(){
unsigned int getNbMove() {
return nbMove;
}
@ -90,7 +90,7 @@ public:
* Getter of the number of no move
* @return the counter
*/
unsigned int getNbNoMove(){
unsigned int getNbNoMove() {
return nbNoMove;
}
@ -98,14 +98,14 @@ public:
* Getter of the number of successive stagnation since the last Move
* @return the counter
*/
unsigned int getCounter(){
unsigned int getCounter() {
return counter;
}
/**
* Init counter
*/
void initCounter(){
void initCounter() {
counter=0;
}

View file

@ -37,6 +37,6 @@ Contact: paradiseo-help@lists.gforge.inria.fr
* Abstract class for diversification strategy
*/
template< class Neighbor >
class moDiversification : virtual public moMemory<Neighbor>, public eoUF<typename Neighbor::EOT &,bool>{};
class moDiversification : virtual public moMemory<Neighbor>, public eoUF<typename Neighbor::EOT &,bool> {};
#endif

View file

@ -36,7 +36,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
* Dummy memory to make an empty memory
*/
template< class Neighbor >
class moDummyMemory : virtual public moMemory<Neighbor>{
class moDummyMemory : virtual public moMemory<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;

View file

@ -37,6 +37,6 @@ Contact: paradiseo-help@lists.gforge.inria.fr
* Abstract class for intensification strategy
*/
template< class Neighbor >
class moIntensification : virtual public moMemory<Neighbor>, public eoUF<typename Neighbor::EOT &,bool>{};
class moIntensification : virtual public moMemory<Neighbor>, public eoUF<typename Neighbor::EOT &,bool> {};
#endif

View file

@ -50,14 +50,14 @@ public:
* @param _monOp an eoMonOp (diversification operator)
* @param _fullEval a full evaluation function
*/
moMonOpDiversification(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval):monOp(_monOp), fullEval(_fullEval){}
moMonOpDiversification(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval):monOp(_monOp), fullEval(_fullEval) {}
/**
* Apply monOp on the solution
* @param _solution to diversify
* @return value of monOp
*/
bool operator()(EOT& _solution){
bool operator()(EOT& _solution) {
bool res = monOp(_solution);
fullEval(_solution);
return res;

View file

@ -88,9 +88,9 @@ public:
* @param _neighbor the current neighbor (unused)
*/
virtual void update(EOT & _sol, Neighbor & _neighbor) {
if(howlong > 0)
if (howlong > 0)
for (unsigned int i=0; i<tabuList.size(); i++)
if(tabuList[i].second > 0)
if (tabuList[i].second > 0)
tabuList[i].second--;
}

View file

@ -88,9 +88,9 @@ public:
* @param _neighbor the current neighbor (unused)
*/
virtual void update(EOT & _sol, Neighbor & _neighbor) {
if(howlong > 0)
if (howlong > 0)
for (unsigned int i=0; i<tabuList.size(); i++)
if(tabuList[i].second > 0)
if (tabuList[i].second > 0)
tabuList[i].second--;
}

View file

@ -36,13 +36,13 @@ Contact: paradiseo-help@lists.gforge.inria.fr
* Dummy Neighborhood
*/
template< class EOT >
class moDummyNeighbor : public moNeighbor< EOT >{
class moDummyNeighbor : public moNeighbor< EOT > {
public:
/**
* NOTHING TO DO
* @param _solution the related solution
*/
virtual void move(EOT& _solution){}
virtual void move(EOT& _solution) {}
};
#endif

View file

@ -37,7 +37,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
* Dummy Neighborhood
*/
template< class Neighbor >
class moDummyNeighborhood : public moNeighborhood<Neighbor>{
class moDummyNeighborhood : public moNeighborhood<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;
@ -46,7 +46,7 @@ public:
* @param _solution a solution (unused)
* @return always false
*/
virtual bool hasNeighbor(EOT & _solution){
virtual bool hasNeighbor(EOT & _solution) {
return false;
}
@ -55,21 +55,21 @@ public:
* @param _solution a solution (unused)
* @param _current a neighbor (unused)
*/
virtual void init(EOT & _solution, Neighbor & _current){}
virtual void init(EOT & _solution, Neighbor & _current) {}
/**
* NOTHING TO DO
* @param _solution a solution (unused)
* @param _current a neighbor (unused)
*/
virtual void next(EOT & _solution, Neighbor & _current){}
virtual void next(EOT & _solution, Neighbor & _current) {}
/**
* NOTHING TO DO
* @param _solution a solution (unused)
* @return always false
*/
virtual bool cont(EOT & _solution){
virtual bool cont(EOT & _solution) {
return false;
}

View file

@ -98,7 +98,7 @@ public:
* @param _neighbor a neighbor
* @return if _neighbor and this one are equals
*/
virtual bool equals(moIndexNeighbor<EOT>& _neighbor){
virtual bool equals(moIndexNeighbor<EOT>& _neighbor) {
return (key==_neighbor.index());
}

View file

@ -107,7 +107,7 @@ public:
* @param _neighbor a neighbor
* @return if _neighbor and this one are equals
*/
virtual bool equals(moNeighbor<EOT>& _neighbor){
virtual bool equals(moNeighbor<EOT>& _neighbor) {
return false;
}

View file

@ -53,7 +53,7 @@ public:
* Apply the local search on the solution
* @param _solution to perturb
*/
void operator()(EOT& _solution){
void operator()(EOT& _solution) {
init(_solution);
ls(_solution);
}

View file

@ -49,14 +49,14 @@ public:
* @param _monOp an eoMonOp (pertubation operator)
* @param _fullEval a full evaluation function
*/
moMonOpPerturb(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval):monOp(_monOp), fullEval(_fullEval){}
moMonOpPerturb(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval):monOp(_monOp), fullEval(_fullEval) {}
/**
* Apply monOp on the solution
* @param _solution to perturb
* @return value of monOp
*/
bool operator()(EOT& _solution){
bool operator()(EOT& _solution) {
bool res = monOp(_solution);
fullEval(_solution);
return res;

View file

@ -38,7 +38,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
* Neighborhood Perturbation: explore the neighborhood to perturb the solution (the neighborhood could be different as the one used in the Local Search)
*/
template< class Neighbor, class OtherNeighbor >
class moNeighborhoodPerturb : public moPerturbation<Neighbor>{
class moNeighborhoodPerturb : public moPerturbation<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;
@ -49,15 +49,15 @@ public:
* @param _otherNeighborhood a neighborhood
* @param _eval an Evaluation Function
*/
moNeighborhoodPerturb(OtherNH& _otherNeighborhood, moEval<OtherNeighbor>& _eval): otherNeighborhood(_otherNeighborhood), eval(_eval){}
moNeighborhoodPerturb(OtherNH& _otherNeighborhood, moEval<OtherNeighbor>& _eval): otherNeighborhood(_otherNeighborhood), eval(_eval) {}
/**
* Apply move on the solution
* @param _solution the current solution
* @return true
*/
virtual bool operator()(EOT& _solution){
if(otherNeighborhood.hasNeighbor(_solution)){
virtual bool operator()(EOT& _solution) {
if (otherNeighborhood.hasNeighbor(_solution)) {
eval(_solution, current);
current.move(_solution);
_solution.fitness(current.fitness());
@ -69,8 +69,8 @@ public:
* Init the neighborhood
* @param _sol the current solution
*/
virtual void init(EOT & _sol){
if(otherNeighborhood.hasNeighbor(_sol))
virtual void init(EOT & _sol) {
if (otherNeighborhood.hasNeighbor(_sol))
otherNeighborhood.init(_sol, current);
}
@ -79,7 +79,7 @@ public:
* @param _sol the current solution
* @param _neighbor unused neighbor (always empty)
*/
virtual void add(EOT & _sol, Neighbor & _neighbor){
virtual void add(EOT & _sol, Neighbor & _neighbor) {
(*this).init(_sol);
}
@ -88,8 +88,8 @@ public:
* @param _sol the current solution
* @param _neighbor unused neighbor (always empty)
*/
virtual void update(EOT & _sol, Neighbor & _neighbor){
if(otherNeighborhood.cont(_sol))
virtual void update(EOT & _sol, Neighbor & _neighbor) {
if (otherNeighborhood.cont(_sol))
otherNeighborhood.next(_sol, current);
else
(*this).init(_sol);
@ -98,7 +98,7 @@ public:
/**
* NOTHING TO DO
*/
virtual void clearMemory(){}
virtual void clearMemory() {}
private:
OtherNH& otherNeighborhood;

View file

@ -58,8 +58,8 @@ public:
* @param _solution to restart
* @return true
*/
bool operator()(EOT& _solution){
if((*this).getCounter()>= threshold){
bool operator()(EOT& _solution) {
if ((*this).getCounter()>= threshold) {
initializer(_solution);
fullEval(_solution);
(*this).initCounter();

View file

@ -49,7 +49,7 @@ public:
* Initialization on the externatl solution
* @param _solution to initialize
*/
void operator()(EOT& _solution){
void operator()(EOT& _solution) {
_solution = extSol;
}

View file

@ -68,7 +68,7 @@ public :
int nc;
bool litt;
for(unsigned int k = 0; k < size; k++) {
for (unsigned int k = 0; k < size; k++) {
// number of the clause
nc = modifiedClauses[k];

View file

@ -46,20 +46,20 @@ public:
* Apply move on a solution regarding a key
* @param _sol the solution to move
*/
virtual void move(EOT & _sol){
virtual void move(EOT & _sol) {
unsigned int tmp ;
size=_sol.size();
translate(key+1);
// keep the first component to change
tmp = _sol[first];
// shift
if (first < second){
if (first < second) {
for (unsigned int i=first; i<second-1; i++)
_sol[i] = _sol[i+1];
// shift the first component
_sol[second-1] = tmp;
}
else{ /* first > second*/
else { /* first > second*/
for (unsigned int i=first; i>second; i--)
_sol[i] = _sol[i-1];
// shift the first component
@ -72,15 +72,15 @@ public:
* fix two indexes regarding a key
* @param _key the key allowing to compute the two indexes for the shift
*/
void translate(unsigned int _key){
void translate(unsigned int _key) {
int step;
int val = _key;
int tmpSize = size * (size-1) / 2;
// moves from left to right
if (val <= tmpSize){
if (val <= tmpSize) {
step = size - 1;
first = 0;
while ((val - step) > 0){
while ((val - step) > 0) {
val = val - step;
step--;
first++;
@ -88,11 +88,11 @@ public:
second = first + val + 1;
}
// moves from right to left (equivalent moves are avoided)
else{ /* val > tmpSize */
else { /* val > tmpSize */
val = val - tmpSize;
step = size - 2;
second = 0;
while ((val - step) > 0){
while ((val - step) > 0) {
val = val - step;
step--;
second++;
@ -101,7 +101,7 @@ public:
}
}
void print(){
void print() {
std::cout << key << ": [" << first << ", " << second << "] -> " << (*this).fitness() << std::endl;
}

View file

@ -45,7 +45,7 @@ public:
* Apply the swap
* @param _solution the solution to move
*/
virtual void move(EOT& _solution){
virtual void move(EOT& _solution) {
unsigned int tmp;
tmp=_solution[indices.first];
_solution[indices.first]=_solution[indices.second];
@ -57,7 +57,7 @@ public:
* apply the swap to restore the solution (use by moFullEvalByModif)
* @param _solution the solution to move
*/
virtual void moveBack(EOT& _solution){
virtual void moveBack(EOT& _solution) {
unsigned int tmp;
tmp=_solution[indices.first];
_solution[indices.first]=_solution[indices.second];
@ -70,7 +70,7 @@ public:
* @param _first first index
* @param _second second index
*/
void setIndices(unsigned int _first, unsigned int _second){
void setIndices(unsigned int _first, unsigned int _second) {
indices.first = _first;
indices.second = _second;
}
@ -78,7 +78,7 @@ public:
/**
* Print the Neighbor
*/
void print(){
void print() {
std::cout << "[" << indices.first << ", " << indices.second << "] -> " << (*this).fitness() << std::endl;
}

View file

@ -45,7 +45,7 @@ public:
/**
* @return if there are available Neighbor
*/
virtual bool hasNeighbor(EOT& _solution){
virtual bool hasNeighbor(EOT& _solution) {
return (_solution.size() > 1);
};
@ -54,7 +54,7 @@ public:
* @param _solution the solution to explore
* @param _current the first neighbor
*/
virtual void init(EOT& _solution, Neighbor& _current){
virtual void init(EOT& _solution, Neighbor& _current) {
indices.first=0;
indices.second=1;
size=_solution.size();
@ -66,8 +66,8 @@ public:
* @param _solution the solution to explore
* @param _current the next neighbor
*/
virtual void next(EOT& _solution, Neighbor& _current){
if(indices.second==size-1){
virtual void next(EOT& _solution, Neighbor& _current) {
if (indices.second==size-1) {
indices.first++;
indices.second=indices.first+1;
}
@ -81,7 +81,7 @@ public:
* @param _solution the solution to explore
* @return if there is again a neighbor not explored
*/
virtual bool cont(EOT& _solution){
virtual bool cont(EOT& _solution) {
return !((indices.first == (size-2)) && (indices.second == (size-1)));
}

View file

@ -70,7 +70,7 @@ public:
eoEvalFunc<EOT>& _fullEval,
moEval<Neighbor>& _eval,
unsigned int _nbStep) :
moSampling<Neighbor>(_init, * new moRandomWalk<Neighbor>(_neighborhood, _fullEval, _eval, _nbStep), fitnessStat){}
moSampling<Neighbor>(_init, * new moRandomWalk<Neighbor>(_neighborhood, _fullEval, _eval, _nbStep), fitnessStat) {}
/**
* default destructor

View file

@ -64,7 +64,7 @@ public:
moDensityOfStatesSampling(eoInit<EOT> & _init,
eoEvalFunc<EOT>& _fullEval,
unsigned int _nbSol) :
moSampling<Neighbor>(_init, * new moRandomSearch<Neighbor>(_init, _fullEval, _nbSol), fitnessStat){}
moSampling<Neighbor>(_init, * new moRandomSearch<Neighbor>(_init, _fullEval, _nbSol), fitnessStat) {}
/**
* default destructor

View file

@ -79,7 +79,7 @@ public:
*/
~moSampling() {
// delete all monitors
for(unsigned i = 0; i < monitorVec.size(); i++)
for (unsigned i = 0; i < monitorVec.size(); i++)
delete monitorVec[i];
// delete the checkpoint
@ -108,7 +108,7 @@ public:
*/
void operator()(void) {
// clear all statistic vectors
for(unsigned i = 0; i < monitorVec.size(); i++)
for (unsigned i = 0; i < monitorVec.size(); i++)
monitorVec[i]->clear();
// change the checkpoint to compute the statistics
@ -144,10 +144,10 @@ public:
// all vector have the same size
unsigned vecSize = monitorVec[0]->size();
for(unsigned int i = 0; i < vecSize; i++) {
for (unsigned int i = 0; i < vecSize; i++) {
os << monitorVec[0]->getValue(i);
for(unsigned int j = 1; j < monitorVec.size(); j++) {
for (unsigned int j = 1; j < monitorVec.size(); j++) {
os << _delim.c_str() << monitorVec[j]->getValue(i);
}

View file

@ -79,7 +79,7 @@ public:
std = 0.0;
double d;
for(unsigned int i = 0; i < n; i++) {
for (unsigned int i = 0; i < n; i++) {
d = data[i];
if (d < min)
min = d;
@ -113,13 +113,13 @@ public:
unsigned int n = data.size();
matrix.resize(n);
for(unsigned i = 0; i < n; i++)
for (unsigned i = 0; i < n; i++)
matrix[i].resize(n);
unsigned j;
for(unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; i++) {
matrix[i][i] = 0.0;
for(j = 0; j < i; j++) {
for (j = 0; j < i; j++) {
matrix[i][j] = distance(data[i], data[j]);
matrix[j][i] = matrix[i][j];
}
@ -154,7 +154,7 @@ public:
unsigned s, k;
for(s = 0; s <= nbS; s++) {
for (s = 0; s <= nbS; s++) {
cov[s] = 0;
m[s] = 0;
sig[s] = 0;
@ -167,7 +167,7 @@ public:
s = nbS;
while (s > 0) {
while (k + s < n) {
for(j = 0; j <= s; j++) {
for (j = 0; j <= s; j++) {
m[j] += data[k+j];
sig[j] += data[k+j] * data[k+j];
cov[j] += data[k] * data[k+j];
@ -192,19 +192,19 @@ public:
double tmp1, tmp2;
phi2[1][1] = rho[1];
for(k = 2; k <= nbS; k++) {
for (k = 2; k <= nbS; k++) {
tmp1 = 0;
tmp2 = 0;
for(j = 1; j < k; j++) {
for (j = 1; j < k; j++) {
tmp1 += phi2[k-1][j] * rho[k-j];
tmp2 += phi2[k-1][j] * rho[j];
}
phi2[k][k] = (rho[k] - tmp1) / (1 - tmp2);
for(j = 1; j < k; j++)
for (j = 1; j < k; j++)
phi2[k][j] = phi2[k-1][j] - phi2[k][k] * phi2[k-1][k-j];
}
for(j = 1; j <= nbS; j++)
for (j = 1; j <= nbS; j++)
phi[j] = phi2[j][j];
}