[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[oMetah-devel] ometah/metaheuristic itsEstimationOfDistributio...
From: |
Johann |
Subject: |
[oMetah-devel] ometah/metaheuristic itsEstimationOfDistributio... |
Date: |
Thu, 03 Mar 2005 08:02:59 -0500 |
CVSROOT: /cvsroot/ometah
Module name: ometah
Branch:
Changes by: Johann <address@hidden> 05/03/03 13:02:58
Modified files:
metaheuristic : itsEstimationOfDistribution.cpp
itsEstimationOfDistribution.hpp
itsMetaheuristic.cpp
Log message:
* learning and diversification phase for EDA
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/metaheuristic/itsEstimationOfDistribution.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/metaheuristic/itsEstimationOfDistribution.hpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/metaheuristic/itsMetaheuristic.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: ometah/metaheuristic/itsEstimationOfDistribution.cpp
diff -u ometah/metaheuristic/itsEstimationOfDistribution.cpp:1.1
ometah/metaheuristic/itsEstimationOfDistribution.cpp:1.2
--- ometah/metaheuristic/itsEstimationOfDistribution.cpp:1.1 Mon Feb 21
09:40:15 2005
+++ ometah/metaheuristic/itsEstimationOfDistribution.cpp Thu Mar 3
13:02:57 2005
@@ -1,7 +1,7 @@
/***************************************************************************
* itsMetaheuristic.hpp
*
- * $Id: itsEstimationOfDistribution.cpp,v 1.1 2005/02/21 09:40:15 nojhan Exp $
+ * $Id: itsEstimationOfDistribution.cpp,v 1.2 2005/03/03 13:02:57 nojhan Exp $
* Author : Johann Dréo <address@hidden>
****************************************************************************/
@@ -26,31 +26,58 @@
itsEstimationOfDistribution::itsEstimationOfDistribution()
{
setDistribution("Uniform");
+ setSelectRatio(0.5);
}
void itsEstimationOfDistribution::learning()
{
-
+ vector< vector<double> > transposedSimplifiedSample;
+
+ // for each point, extract the solution vector
+ for(unsigned int i=0; i < getSampleSize(); i++) {
+ // put this vector in a matrix
+ transposedSimplifiedSample.push_back( sample[i].getSolution() );
+ }
+
+ // transpose it so that the row correspond to a dimension, and not a
solution
+ transposedSimplifiedSample = transpose(transposedSimplifiedSample);
+
+ // verify that we have the correct dimension
+ if( transposedSimplifiedSample.size() != this->getDimension() ) {
+ throw "ErrorSize";
+ }
+
+ // find the minimum and the maximum for each dimension
+ for(unsigned int dim=0; dim < getDimension(); dim++) {
+ // store them
+ this->parameterUniformMinima.push_back( min(
transposedSimplifiedSample[dim] ) );
+ this->parameterUniformMaxima.push_back( max(
transposedSimplifiedSample[dim] ) );
+ }
}
void itsEstimationOfDistribution::diversification()
{
-
+ // draw each point in an hyper cube
+ for( unsigned int i=0; i < getSampleSize(); i++) {
+ // draw solution
+ sample[i].setSolution( randomHyperCube(this->parameterUniformMinima,
this->parameterUniformMaxima) );
+ // get values
+ sample[i] = this->problem.call(sample[i]);
+ }
}
-
void itsEstimationOfDistribution::intensification()
{
-
+ // sort the sample
+ // select the selectRatio% best points
}
-
-string getDistribution()
+string itsEstimationOfDistribution::getDistribution()
{
return this->distribution;
}
-void setDistribution(string distribution)
+void itsEstimationOfDistribution::setDistribution(string distribution)
{
if(distribution == "Uniform") {
this->distribution = distribution;
@@ -60,3 +87,14 @@
this->distribution = distribution;
}
}
+
+
+void setSelectRatio( double ratio )
+{
+ this->selectRatio = ratio;
+}
+
+double getSelectRatio()
+{
+ return this->selectRatio;
+}
Index: ometah/metaheuristic/itsEstimationOfDistribution.hpp
diff -u ometah/metaheuristic/itsEstimationOfDistribution.hpp:1.1
ometah/metaheuristic/itsEstimationOfDistribution.hpp:1.2
--- ometah/metaheuristic/itsEstimationOfDistribution.hpp:1.1 Mon Feb 21
09:40:15 2005
+++ ometah/metaheuristic/itsEstimationOfDistribution.hpp Thu Mar 3
13:02:57 2005
@@ -1,7 +1,7 @@
/***************************************************************************
* itsMetaheuristic.hpp
*
- * $Id: itsEstimationOfDistribution.hpp,v 1.1 2005/02/21 09:40:15 nojhan Exp $
+ * $Id: itsEstimationOfDistribution.hpp,v 1.2 2005/03/03 13:02:57 nojhan Exp $
* Author : Johann Dréo <address@hidden>
****************************************************************************/
@@ -27,7 +27,7 @@
#define ITSESTIMATIONPFDISTRIBUTION
#include "itsMetaheuristic.hpp"
-
+#incdlude "../common/matrix.hpp"
class itsEstimationOfDistribution : public itsMetaheuristic
{
@@ -39,6 +39,19 @@
*/
string distribution;
+ //! The minima parameter for the uniform distribution
+ vector<double> parameterUniformMinima;
+
+ //! The maxima parameter for the uniform distribution
+ vector<double> parameterUniformMaxima;
+
+ //! The select ratio
+ /*!
+ A number in [0,1] telling what proportion of points
+ should be selected in the intensification phase
+ */
+ double selectRatio;
+
protected:
//! the intensification is a the a method
void intensification();
@@ -64,6 +77,12 @@
//! Change the distribution
void setDistribution(string distribution);
+ //! Return the select ratio
+ double getSelectRatio();
+
+ //! Change the select ratio
+ void setSelectRatio( double ratio );
+
}
#endif
Index: ometah/metaheuristic/itsMetaheuristic.cpp
diff -u ometah/metaheuristic/itsMetaheuristic.cpp:1.2
ometah/metaheuristic/itsMetaheuristic.cpp:1.3
--- ometah/metaheuristic/itsMetaheuristic.cpp:1.2 Mon Feb 21 09:40:15 2005
+++ ometah/metaheuristic/itsMetaheuristic.cpp Thu Mar 3 13:02:57 2005
@@ -109,7 +109,7 @@
itsMetaheuristic::parseCommon()
{ }
-bool isStoppingCriteria()
+bool itsMetaheuristic::isStoppingCriteria()
{
// if the maximum iterations number has been reached
if(iterationsCurrent>=iterationsMaxNumber) {
- [oMetah-devel] ometah/metaheuristic itsEstimationOfDistributio...,
Johann <=