ometah-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[oMetah-devel] ometah ./ometah.pws common/itsPoint.cpp communi...


From: Johann
Subject: [oMetah-devel] ometah ./ometah.pws common/itsPoint.cpp communi...
Date: Fri, 27 May 2005 08:22:34 -0400

CVSROOT:        /cvsroot/ometah
Module name:    ometah
Branch:         
Changes by:     Johann <address@hidden> 05/05/27 12:22:34

Modified files:
        .              : ometah.pws 
        common         : itsPoint.cpp 
        communication  : itsCommunicationClient_embedded.cpp 
        interface      : ometah.cpp 
        metaheuristic  : itsEstimationOfDistribution.cpp 
                         itsMetaheuristic.cpp itsMetaheuristic.hpp 
        problem        : itsRosenbrock.cpp 

Log message:
        * better formatted log
        * correction of a potential bug with sample size

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/ometah.pws.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/common/itsPoint.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/communication/itsCommunicationClient_embedded.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/interface/ometah.cpp.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/metaheuristic/itsEstimationOfDistribution.cpp.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/metaheuristic/itsMetaheuristic.cpp.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/metaheuristic/itsMetaheuristic.hpp.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/itsRosenbrock.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: ometah/common/itsPoint.cpp
diff -u ometah/common/itsPoint.cpp:1.4 ometah/common/itsPoint.cpp:1.5
--- ometah/common/itsPoint.cpp:1.4      Thu May 26 17:15:06 2005
+++ ometah/common/itsPoint.cpp  Fri May 27 12:22:33 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- * $Id: itsPoint.cpp,v 1.4 2005/05/26 17:15:06 nojhan Exp $
+ * $Id: itsPoint.cpp,v 1.5 2005/05/27 12:22:33 nojhan Exp $
  * Author : Johann Dréo <address@hidden>
  ****************************************************************************/
 
@@ -127,11 +127,10 @@
         
         res << vec[0].getValues()[0];
         for(unsigned int i=1; i<vec.size(); i++) { // points
-            res << vec[i].getValues()[0];
+            res << separatorPoint << vec[i].getValues()[0];
             for(unsigned int j=1; j<vec[i].getValues().size(); j++) { // 
dimensions
                 res << separatorDimension << vec[i].getValues()[j];
             }
-            res << separatorPoint;
         }
     }
     return res.str();
Index: ometah/communication/itsCommunicationClient_embedded.cpp
diff -u ometah/communication/itsCommunicationClient_embedded.cpp:1.7 
ometah/communication/itsCommunicationClient_embedded.cpp:1.8
--- ometah/communication/itsCommunicationClient_embedded.cpp:1.7        Sat May 
14 16:07:57 2005
+++ ometah/communication/itsCommunicationClient_embedded.cpp    Fri May 27 
12:22:33 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  $Id: itsCommunicationClient_embedded.cpp,v 1.7 2005/05/14 16:07:57 nojhan 
Exp $
+ *  $Id: itsCommunicationClient_embedded.cpp,v 1.8 2005/05/27 12:22:33 nojhan 
Exp $
  *  Copyright : Université Paris 12 Val-de-Marne
  *  Author : Johann Dréo <address@hidden>
  ****************************************************************************/
@@ -20,6 +20,9 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <iostream>
+using namespace std;
+
 #include "itsCommunicationServer_embedded.hpp"
 #include "itsCommunicationClient_embedded.hpp"
 
Index: ometah/interface/ometah.cpp
diff -u ometah/interface/ometah.cpp:1.15 ometah/interface/ometah.cpp:1.16
--- ometah/interface/ometah.cpp:1.15    Thu May 26 17:15:06 2005
+++ ometah/interface/ometah.cpp Fri May 27 12:22:33 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  $Id: ometah.cpp,v 1.15 2005/05/26 17:15:06 nojhan Exp $
+ *  $Id: ometah.cpp,v 1.16 2005/05/27 12:22:33 nojhan Exp $
  *  Copyright : Université Paris 12 Val-de-Marne
  *  Author : Johann Dréo <address@hidden>
  ****************************************************************************/
@@ -150,7 +150,7 @@
     
     setMetaheuristic.item()->addDebugKey("selectNumber");
     setMetaheuristic.item()->setLogLevel(99);
-    setMetaheuristic.item()->setSampleSize(3);
+    setMetaheuristic.item()->setSampleSize(5);
 
     try {
         setMetaheuristic.item()->start();
Index: ometah/metaheuristic/itsEstimationOfDistribution.cpp
diff -u ometah/metaheuristic/itsEstimationOfDistribution.cpp:1.14 
ometah/metaheuristic/itsEstimationOfDistribution.cpp:1.15
--- ometah/metaheuristic/itsEstimationOfDistribution.cpp:1.14   Thu May 26 
17:15:06 2005
+++ ometah/metaheuristic/itsEstimationOfDistribution.cpp        Fri May 27 
12:22:34 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  $Id: itsEstimationOfDistribution.cpp,v 1.14 2005/05/26 17:15:06 nojhan Exp 
$
+ *  $Id: itsEstimationOfDistribution.cpp,v 1.15 2005/05/27 12:22:34 nojhan Exp 
$
  *  Author : Johann Dréo <address@hidden>
  ****************************************************************************/
 
@@ -72,7 +72,7 @@
     vector< vector<double> > transposedSimplifiedSample;
     
     // for each point, extract the solution vector
-    for(unsigned int i=0; i < getSampleSize(); i++) {
+    for(unsigned int i=0; i < getSampleSizeCurrent(); i++) {
         // put this vector in a matrix
         transposedSimplifiedSample.push_back( sample[i].getSolution() );
     }
@@ -82,7 +82,7 @@
 
     // verify that we have the correct dimension
     if( transposedSimplifiedSample.size() != (unsigned 
int)this->problem->getDimension() ) {
-        throw "ErrorSize: transposed matrix does not correspond to dimension";
+        throw "ErrorSize: transposed matrix does not correspond to problem 
dimension";
     }
 
     // find the minimum and the maximum for each dimension  
@@ -95,8 +95,8 @@
  
 void itsEstimationOfDistribution::diversification()
 {
-    // erase all
-    sample.clear();
+    // reinit all
+    setSampleSize( getSampleSize() );
 
     // draw each point in an hyper cube
     for( unsigned int i=0; i < getSampleSize(); i++) {
@@ -104,7 +104,7 @@
         itsPoint p;
         p.setSolution( randomUniform(this->parameterUniformMinima, 
this->parameterUniformMaxima) );
         // get values
-        sample.push_back( this->problem->call(p) );
+        sample[i] = this->problem->call(p);
     }
 }
 
Index: ometah/metaheuristic/itsMetaheuristic.cpp
diff -u ometah/metaheuristic/itsMetaheuristic.cpp:1.14 
ometah/metaheuristic/itsMetaheuristic.cpp:1.15
--- ometah/metaheuristic/itsMetaheuristic.cpp:1.14      Thu May 26 17:15:06 2005
+++ ometah/metaheuristic/itsMetaheuristic.cpp   Fri May 27 12:22:34 2005
@@ -74,7 +74,7 @@
   this->outProcessResult = &cout;
   this->outErrors = &cerr;
   this->outLog = &clog;
-  this->outDebug = &clog;
+  this->outDebug = &cerr;
 
   this->iterationsCurrent=0;
 
@@ -101,7 +101,8 @@
     // ask for the associated values
     aRandomPoint = problem->call(aRandomPoint);
     // add it to the sample
-    sample.push_back(aRandomPoint);
+    //sample.push_back(aRandomPoint);
+    sample[i] = aRandomPoint;
   }
 }
 
@@ -115,33 +116,39 @@
 
 
   // log
+
   ostringstream msg1;
   msg1 << "iteration " << iterationsCurrent;
   printLog("iterations", msg1.str() );
-  printLog("sample_steps", printValues( this->sample ) );
+  printLog("sample_steps", "  sample "+printValues( this->sample ) );
 
   // while no stopping criterion reached
   while( !isStoppingCriteria() ) {
   
-    // main phases
-    printLog("steps","learning");
-    learning();
+    // log
+    ostringstream msg;
+    msg << "iteration " << iterationsCurrent+1;
+    printLog("iterations", msg.str() );
+
+  
+    /* main phases */
+    printLog("steps"," learning");
+    learning(); // Learning phase
     
-    printLog("steps","diversification");
-    diversification();
+    printLog("steps"," diversification");
+    diversification(); // Diversification phase
   
-    printLog("steps","intensification");
-    intensification();
+    // log sample
+    printLog("sample_steps", "  sample "+printValues( this->sample ) );
+  
+    printLog("steps"," intensification");
+    intensification(); // Intensification phase
     
+    printLog("sample_steps", "  sample "+printValues( this->sample ) );
+  
     // one more iteration
     iterationsCurrent++;
   
-    // log
-    ostringstream msg;
-    msg << "iteration " << iterationsCurrent;
-    printLog("iterations", msg.str() );
-    printLog("sample_steps", printValues( this->sample ) );
-
   }
 }
 
@@ -256,6 +263,11 @@
     return this->sampleSize;
 }
 
+unsigned int itsMetaheuristic::getSampleSizeCurrent()
+{
+    return this->sample.size();
+}
+
 void itsMetaheuristic::setSampleSize(unsigned int size)
 {
     this->sampleSize = size;
Index: ometah/metaheuristic/itsMetaheuristic.hpp
diff -u ometah/metaheuristic/itsMetaheuristic.hpp:1.14 
ometah/metaheuristic/itsMetaheuristic.hpp:1.15
--- ometah/metaheuristic/itsMetaheuristic.hpp:1.14      Wed May 25 15:33:16 2005
+++ ometah/metaheuristic/itsMetaheuristic.hpp   Fri May 27 12:22:34 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  $Id: itsMetaheuristic.hpp,v 1.14 2005/05/25 15:33:16 nojhan Exp $
+ *  $Id: itsMetaheuristic.hpp,v 1.15 2005/05/27 12:22:34 nojhan Exp $
  *  Copyright : 2005 Université Paris 12 Val-de-Marne
  *  Author : Walid Tfaili <address@hidden>, Johann Dréo <address@hidden>
  ****************************************************************************/
@@ -233,9 +233,11 @@
 
   //! Return the sample size
   unsigned int getSampleSize();
+  //! Return the true current sample size_t
+  unsigned int getSampleSizeCurrent();
   //! Change the sample size
   /*!
-    WARNING : changing the size cause the vector to be reinitialized
+    WARNING : changing the size may cause data loss
   */
   void setSampleSize(unsigned int size);
 
Index: ometah/ometah.pws
diff -u ometah/ometah.pws:1.14 ometah/ometah.pws:1.15
--- ometah/ometah.pws:1.14      Thu May 26 17:15:06 2005
+++ ometah/ometah.pws   Fri May 27 12:22:33 2005
@@ -1,11 +1,11 @@
 
 [filenumbers]
-0=122
-1=1
-2=113
-3=81
-4=162
-5=27
+0=111
+1=147
+2=240
+3=133
+4=81
+5=153
 6=1
 7=56
 
@@ -33,9 +33,10 @@
 [filelist]
 
0=/home/nojhan/travail/openMetaheuristic/source/ometah/metaheuristic/itsEstimationOfDistribution.cpp
 
1=/home/nojhan/travail/openMetaheuristic/source/ometah/metaheuristic/itsMetaheuristic.cpp
-2=/home/nojhan/travail/openMetaheuristic/source/ometah/common/itsPoint.cpp
-3=/home/nojhan/travail/openMetaheuristic/source/ometah/common/itsPoint.hpp
-4=/home/nojhan/travail/openMetaheuristic/source/ometah/interface/ometah.cpp
+2=/home/nojhan/travail/openMetaheuristic/source/ometah/metaheuristic/itsMetaheuristic.hpp
+3=/home/nojhan/travail/openMetaheuristic/source/ometah/common/itsPoint.cpp
+4=/home/nojhan/travail/openMetaheuristic/source/ometah/common/itsPoint.hpp
+5=/home/nojhan/travail/openMetaheuristic/source/ometah/interface/ometah.cpp
 
 [Project Tree]
 0=0
Index: ometah/problem/itsRosenbrock.cpp
diff -u ometah/problem/itsRosenbrock.cpp:1.5 
ometah/problem/itsRosenbrock.cpp:1.6
--- ometah/problem/itsRosenbrock.cpp:1.5        Wed May 25 15:33:16 2005
+++ ometah/problem/itsRosenbrock.cpp    Fri May 27 12:22:34 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  $Id: itsRosenbrock.cpp,v 1.5 2005/05/25 15:33:16 nojhan Exp $
+ *  $Id: itsRosenbrock.cpp,v 1.6 2005/05/27 12:22:34 nojhan Exp $
  *  Copyright 2005 Université Paris 12 Val-de-Marne
  *  Author : Johann Dréo <address@hidden>
  ****************************************************************************/
@@ -22,6 +22,7 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <iostream>
 #include <vector>
 #include "itsRosenbrock.hpp"
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]