trivial cosmetic changes

This commit is contained in:
LPTK 2013-07-17 16:34:04 +02:00
commit 0e235a770b
10 changed files with 262 additions and 207 deletions

View file

@ -53,6 +53,10 @@ public :
monitors.push_back(&_mon); monitors.push_back(&_mon);
} }
moCounterMonitorSaver(unsigned _interval)
: interval(_interval), counter(0)
{ }
/** /**
* call monitors if interval is reach by a counter * call monitors if interval is reach by a counter
*/ */

View file

@ -1,35 +1,26 @@
/* /*
<moBestFitnessStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau (c) Thales group, 2010
This software is governed by the CeCILL license under French law and This library is free software; you can redistribute it and/or
abiding by the rules of distribution of free software. You can use, modify it under the terms of the GNU Lesser General Public
modify and/ or redistribute the software under the terms of the CeCILL License as published by the Free Software Foundation;
license as circulated by CEA, CNRS and INRIA at the following URL version 2 of the License.
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy, This library is distributed in the hope that it will be useful,
modify and redistribute granted by the license, users are provided only but WITHOUT ANY WARRANTY; without even the implied warranty of
with a limited warranty and the software's author, the holder of the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
economic rights, and the successive licensors have only limited liability. Lesser General Public License for more details.
In this respect, the user's attention is drawn to the risks associated You should have received a copy of the GNU Lesser General Public
with loading, using, modifying and/or developing or reproducing the License along with this library; if not, write to the Free Software
software by the user in light of its specific status of free software, Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced Contact: http://eodev.sourceforge.net
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their Authors:
requirements in conditions enabling the security of their systems and/or Lionel Parreaux <lionel.parreaux@gmail.com>
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/ */
#ifndef moFitnessMomentsStat_h #ifndef moFitnessMomentsStat_h
@ -39,7 +30,7 @@
#include <continuator/moStat.h> #include <continuator/moStat.h>
/** /**
* Statistic that saves the standard deviation of the fitness of the solutions during the search * Statistic that saves the average and variance of the fitness of the solutions during the search
*/ */
template <class EOT> template <class EOT>
//class moFitnessMomentsStat : public moStat<EOT, std::pair<typename EOT::Fitness,typename EOT::Fitness> > //class moFitnessMomentsStat : public moStat<EOT, std::pair<typename EOT::Fitness,typename EOT::Fitness> >
@ -72,11 +63,6 @@ public :
nbSolutionsEncountered = currentAvg = currentVar = 0; nbSolutionsEncountered = currentAvg = currentVar = 0;
firstTime = false; firstTime = false;
} }
/*else if (firstTime)
{
value() = 0.0;
firstTime = false;
}*/
operator()(_sol); operator()(_sol);
} }

View file

@ -1,35 +1,26 @@
/* /*
<moBestFitnessStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau (c) Thales group, 2010
This software is governed by the CeCILL license under French law and This library is free software; you can redistribute it and/or
abiding by the rules of distribution of free software. You can use, modify it under the terms of the GNU Lesser General Public
modify and/ or redistribute the software under the terms of the CeCILL License as published by the Free Software Foundation;
license as circulated by CEA, CNRS and INRIA at the following URL version 2 of the License.
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy, This library is distributed in the hope that it will be useful,
modify and redistribute granted by the license, users are provided only but WITHOUT ANY WARRANTY; without even the implied warranty of
with a limited warranty and the software's author, the holder of the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
economic rights, and the successive licensors have only limited liability. Lesser General Public License for more details.
In this respect, the user's attention is drawn to the risks associated You should have received a copy of the GNU Lesser General Public
with loading, using, modifying and/or developing or reproducing the License along with this library; if not, write to the Free Software
software by the user in light of its specific status of free software, Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced Contact: http://eodev.sourceforge.net
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their Authors:
requirements in conditions enabling the security of their systems and/or Lionel Parreaux <lionel.parreaux@gmail.com>
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/ */
#ifndef moFitnessVarianceStat_h #ifndef moFitnessVarianceStat_h
@ -68,11 +59,6 @@ public :
nbSolutionsEncountered = currentAvg = currentVar = 0; nbSolutionsEncountered = currentAvg = currentVar = 0;
firstTime = false; firstTime = false;
} }
/*else if (firstTime)
{
value() = 0.0;
firstTime = false;
}*/
operator()(_sol); operator()(_sol);
} }
@ -85,14 +71,10 @@ public :
double x = _sol.fitness(); double x = _sol.fitness();
double oldAvg = currentAvg; double oldAvg = currentAvg;
currentAvg = oldAvg + (x - oldAvg)/nbSolutionsEncountered; currentAvg = oldAvg + (x - oldAvg)/nbSolutionsEncountered;
if (nbSolutionsEncountered > 1) // <- not really necessary
{
//value() = (value()/nbSolutionsEncountered + _sol.fitness())/(nbSolutionsEncountered+1);
double oldVar = currentVar; double oldVar = currentVar;
currentVar = oldVar + (x - oldAvg) * (x - currentAvg); currentVar = oldVar + (x - oldAvg) * (x - currentAvg);
value() = currentVar/nbSolutionsEncountered; value() = currentVar/nbSolutionsEncountered;
} }
}
/** /**
* @return name of the class * @return name of the class

View file

@ -39,9 +39,8 @@
#include <utils/eoParam.h> #include <utils/eoParam.h>
/** /**
* Base class for to update what ever you want * Base class for updating whatever you want.
* similar to eoUpdater * Similar to eoUpdater, but there is an "init" method !
* But there is an init method !
*/ */
class moUpdater : public eoF<void> class moUpdater : public eoF<void>
{ {

View file

@ -65,14 +65,18 @@ public:
typedef typename Neighbor::EOT EOT; typedef typename Neighbor::EOT EOT;
typedef typename EOT::Fitness Fitness ; typedef typename EOT::Fitness Fitness ;
moNeighborhoodExplorer():neighborhood(dummyNeighborhood), eval(dummyEval), isMoved(false) {} moNeighborhoodExplorer()
: neighborhood(dummyNeighborhood), eval(dummyEval), isMoved(false)
{ }
/** /**
* Constructor with a Neighborhood and evaluation function * Constructor with a Neighborhood and evaluation function
* @param _neighborhood the neighborhood * @param _neighborhood the neighborhood
* @param _eval the evaluation function * @param _eval the evaluation function
*/ */
moNeighborhoodExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval):neighborhood(_neighborhood), eval(_eval), isMoved(false) {} moNeighborhoodExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval)
: neighborhood(_neighborhood), eval(_eval), isMoved(false)
{ }
/** /**
* Init Search parameters * Init Search parameters

View file

@ -1,3 +1,28 @@
/*
(c) Thales group, 2010
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation;
version 2 of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: http://eodev.sourceforge.net
Authors:
Lionel Parreaux <lionel.parreaux@gmail.com>
*/
#ifndef __moRealNeighbor_h__ #ifndef __moRealNeighbor_h__
#define __moRealNeighbor_h__ #define __moRealNeighbor_h__

View file

@ -1,11 +1,36 @@
/*
(c) Thales group, 2010
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation;
version 2 of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: http://eodev.sourceforge.net
Authors:
Lionel Parreaux <lionel.parreaux@gmail.com>
*/
#ifndef __moRealNeighborhood_h__ #ifndef __moRealNeighborhood_h__
#define __moRealNeighborhood_h__ #define __moRealNeighborhood_h__
#include <mo> #include <mo>
#include <edo>
template<class Distrib, class Neighbor> template<class Distrib, class Neighbor>
class moRealNeighborhood : public moRndNeighborhood< Neighbor >, public eoFunctorBase class moRealNeighborhood : public moRndNeighborhood< Neighbor >
{ {
public: public:
typedef typename Distrib::EOType EOT; typedef typename Distrib::EOType EOT;
@ -17,7 +42,14 @@ protected:
public: public:
moRealNeighborhood( Distrib & distrib, edoSampler<Distrib> & sampler, edoBounder<EOT> & bounder ) : _distrib(distrib), _sampler(sampler), _bounder(bounder) {} moRealNeighborhood(
Distrib& distrib,
edoSampler<Distrib>& sampler,
edoBounder<EOT>& bounder
): _distrib(distrib),
_sampler(sampler),
_bounder(bounder)
{ }
/** /**
* It alway remains at least a solution in an infinite neighborhood * It alway remains at least a solution in an infinite neighborhood

View file

@ -1,14 +1,34 @@
/*
(c) Thales group, 2010
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation;
version 2 of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: http://eodev.sourceforge.net
Authors:
Lionel Parreaux <lionel.parreaux@gmail.com>
*/
#ifndef __moStdDevEstimator_h__ #ifndef __moStdDevEstimator_h__
#define __moStdDevEstimator_h__ #define __moStdDevEstimator_h__
#include <eo> #include <eo>
#include <mo> #include <mo>
#include <moFitnessVarianceStat.h> // TODO rm
#include <iostream> // TODO rm
// TODO make tests
template< class EOT, class Neighbor > template< class EOT, class Neighbor >
class moStdDevEstimator : public eoUF<EOT&, double> class moStdDevEstimator : public eoUF<EOT&, double>
{ {
@ -27,9 +47,11 @@ public:
moNeighborhood<Neighbor>& neighborhood, moNeighborhood<Neighbor>& neighborhood,
eoEvalFunc<EOT>& fullEval, eoEvalFunc<EOT>& fullEval,
/* The following should be read: /*
The following should be read:
moEval<Neighbor>& eval = _default_eval moEval<Neighbor>& eval = _default_eval
* (which is not possible to achieve as is in C++) */ (which is not possible to achieve as is in C++)
*/
const eoOptional< moEval<Neighbor> >& eval = eoOptional< moEval<Neighbor> >::null, const eoOptional< moEval<Neighbor> >& eval = eoOptional< moEval<Neighbor> >::null,
const eoOptional< moLocalSearch<Neighbor> >& walker = eoOptional< moLocalSearch<Neighbor> >::null const eoOptional< moLocalSearch<Neighbor> >& walker = eoOptional< moLocalSearch<Neighbor> >::null

View file

@ -44,7 +44,8 @@ public:
* Count number of threat * Count number of threat
* @param _queen a solution * @param _queen a solution
*/ */
void operator()(EOT& _queen){ void operator()(EOT& _queen)
{
unsigned int fit = 0; unsigned int fit = 0;
for(unsigned int i = 0; i < _queen.size()-1; i++) for(unsigned int i = 0; i < _queen.size()-1; i++)
for(unsigned int j = i+1; j < _queen.size(); j++) for(unsigned int j = i+1; j < _queen.size(); j++)