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);
}
moCounterMonitorSaver(unsigned _interval)
: interval(_interval), counter(0)
{ }
/**
* 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
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
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.
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
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.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
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.
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>
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moFitnessMomentsStat_h
@ -39,7 +30,7 @@
#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>
//class moFitnessMomentsStat : public moStat<EOT, std::pair<typename EOT::Fitness,typename EOT::Fitness> >
@ -72,11 +63,6 @@ public :
nbSolutionsEncountered = currentAvg = currentVar = 0;
firstTime = false;
}
/*else if (firstTime)
{
value() = 0.0;
firstTime = false;
}*/
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
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
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.
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
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.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
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.
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>
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moFitnessVarianceStat_h
@ -68,11 +59,6 @@ public :
nbSolutionsEncountered = currentAvg = currentVar = 0;
firstTime = false;
}
/*else if (firstTime)
{
value() = 0.0;
firstTime = false;
}*/
operator()(_sol);
}
@ -85,14 +71,10 @@ public :
double x = _sol.fitness();
double oldAvg = currentAvg;
currentAvg = oldAvg + (x - oldAvg)/nbSolutionsEncountered;
if (nbSolutionsEncountered > 1) // <- not really necessary
{
//value() = (value()/nbSolutionsEncountered + _sol.fitness())/(nbSolutionsEncountered+1);
double oldVar = currentVar;
currentVar = oldVar + (x - oldAvg) * (x - currentAvg);
value() = currentVar/nbSolutionsEncountered;
}
}
/**
* @return name of the class

View file

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

View file

@ -65,14 +65,18 @@ public:
typedef typename Neighbor::EOT EOT;
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
* @param _neighborhood the neighborhood
* @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

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__
#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__
#define __moRealNeighborhood_h__
#include <mo>
#include <edo>
template<class Distrib, class Neighbor>
class moRealNeighborhood : public moRndNeighborhood< Neighbor >, public eoFunctorBase
class moRealNeighborhood : public moRndNeighborhood< Neighbor >
{
public:
typedef typename Distrib::EOType EOT;
@ -17,7 +42,14 @@ protected:
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

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__
#define __moStdDevEstimator_h__
#include <eo>
#include <mo>
#include <moFitnessVarianceStat.h> // TODO rm
#include <iostream> // TODO rm
// TODO make tests
template< class EOT, class Neighbor >
class moStdDevEstimator : public eoUF<EOT&, double>
{
@ -27,9 +47,11 @@ public:
moNeighborhood<Neighbor>& neighborhood,
eoEvalFunc<EOT>& fullEval,
/* The following should be read:
/*
The following should be read:
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< moLocalSearch<Neighbor> >& walker = eoOptional< moLocalSearch<Neighbor> >::null

View file

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