ometah-devel
[Top][All Lists]
Advanced

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

[oMetah-devel] ometah ./ometah.pws common/matrix.hpp interface...


From: NoJhan
Subject: [oMetah-devel] ometah ./ometah.pws common/matrix.hpp interface...
Date: Thu, 09 Jun 2005 08:56:32 -0400

CVSROOT:        /cvsroot/ometah
Module name:    ometah
Branch:         
Changes by:     NoJhan <address@hidden> 05/06/09 12:56:32

Modified files:
        .              : ometah.pws 
        common         : matrix.hpp 
        interface      : ometah.cpp 
        metaheuristic  : itsMetaheuristic.cpp itsMetaheuristic.hpp 
        problem        : itsProblem.cpp itsProblem.hpp 
        problem/CEC05  : itsCEC05_SSRPO_Problems.cpp 

Log message:
        * more xml in output

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/ometah.pws.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/common/matrix.hpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/interface/ometah.cpp.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/metaheuristic/itsMetaheuristic.cpp.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/metaheuristic/itsMetaheuristic.hpp.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/itsProblem.cpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/itsProblem.hpp.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/CEC05/itsCEC05_SSRPO_Problems.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: ometah/common/matrix.hpp
diff -u ometah/common/matrix.hpp:1.10 ometah/common/matrix.hpp:1.11
--- ometah/common/matrix.hpp:1.10       Tue Jun  7 12:11:57 2005
+++ ometah/common/matrix.hpp    Thu Jun  9 12:56:31 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  $Id: matrix.hpp,v 1.10 2005/06/07 12:11:57 nojhan Exp $
+ *  $Id: matrix.hpp,v 1.11 2005/06/09 12:56:31 nojhan Exp $
  *  Copyright : Université Paris 12 Val-de-Marne
  *              (61 avenue du Général de Gaulle, 94010, Créteil, France)
  *  Author : Johann Dréo <address@hidden>
@@ -107,9 +107,9 @@
     return newMat;
   }
 
-  for( int i=0; i<Al; i++ ) {
-    for( int j=0; j<Bc; j++ ) {
-      for( int k=0; k<Ac ;k++ ) {
+  for( unsigned int i=0; i<Al; i++ ) {
+    for( unsigned int j=0; j<Bc; j++ ) {
+      for( unsigned int k=0; k<Ac ;k++ ) {
        newMat[i][j] += matA[i][k]*matB[k][j];
       }
     }
Index: ometah/interface/ometah.cpp
diff -u ometah/interface/ometah.cpp:1.34 ometah/interface/ometah.cpp:1.35
--- ometah/interface/ometah.cpp:1.34    Tue Jun  7 15:34:01 2005
+++ ometah/interface/ometah.cpp Thu Jun  9 12:56:31 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  $Id: ometah.cpp,v 1.34 2005/06/07 15:34:01 jpa Exp $
+ *  $Id: ometah.cpp,v 1.35 2005/06/09 12:56:31 nojhan Exp $
  *  Copyright : Université Paris 12 Val-de-Marne
  *              (61 avenue du Général de Gaulle, 94010, Créteil, France)
  *  Author : Johann Dréo <address@hidden>
@@ -120,27 +120,63 @@
   /* 
    * Make the usage strings
    */
-
+  
+  int k = 0;
   vector<string> vec =  setProblem.getKeyList();
   vector<string>::iterator it;
   it = vec.begin();
   stringstream problemUsage;
-  problemUsage << "problem ( ";
-  while ( it < vec.end() ) {
-    problemUsage << (*it) << ", ";
-    it++;
+  problemUsage << "problem (";
+  while ( !k ) { 
+    problemUsage << (*it);
+    if ((++it) < vec.end())
+      problemUsage << ", ";
+    else
+      k=1;
   }
-  problemUsage << " )";
+  problemUsage << ")";
   
+  k = 0;
   vec = setMetaheuristic.getKeyList();
   it = vec.begin();
   stringstream metahUsage;
-  metahUsage << "metaheuristic ( ";
-  while (it < vec.end() ) {
-    metahUsage << (*it) << ", ";
-    it++;
+  metahUsage << "metaheuristic (";
+  while ( !k ) { 
+    metahUsage << (*it);
+    if ((++it) < vec.end())
+      metahUsage << ", ";
+    else
+      k=1;
   }
-  metahUsage << " )";
+  metahUsage << ")";
+
+
+  k = 0;
+  vec = setCommunicationClient.getKeyList();
+  it = vec.begin();
+  stringstream clientUsage;
+  clientUsage << "communication client (";
+  while ( !k ) { 
+    clientUsage << (*it);
+    if ((++it) < vec.end())
+      clientUsage << ", ";
+    else
+      k=1;
+  }
+  clientUsage << ")";
+  k = 0;
+  vec = setCommunicationServer.getKeyList();
+  it = vec.begin();
+  stringstream serverUsage;
+  serverUsage << "communication server (";
+  while ( !k ) { 
+    serverUsage << (*it);
+    if ((++it) < vec.end())
+      serverUsage << ", ";
+    else
+      k=1;
+  }
+  serverUsage << ")";
 
 
   try {
@@ -152,10 +188,10 @@
                          (metahUsage.str()).c_str(), 
                          true, "string", "CEDA");
     argumentParser.defArg("-C", "--com-client", 
-                         "communication client mode ( Embedded | ...)" ,
+                         (clientUsage.str()).c_str() ,
                          true, "string", "Embedded");
     argumentParser.defArg("-S", "--com-server", 
-                         "communication server mode ( Embedded | ...)" ,
+                         (serverUsage.str()).c_str() ,
                          true, "string", "Embedded");
     argumentParser.defArg("-D", "--debug", 
                          "debug key" ,true, "string", "");
@@ -295,8 +331,13 @@
         << " on " << setProblem.item()->getName() 
         << " using " << setCommunicationClient.item()->getKey() << endl;
   
-  //clog << setProblem.item()->getName() << " description:" << endl;
-  //clog << setProblem.item()->getInformations() << endl;
+  
+  setMetaheuristic.item()->setOutProcessResult(&cout);
+  
+  cout << "<? xml-version=\"1.0\" encoding=\"ISO-8859-1\" ?>" << endl;
+  cout << "<ometah>" << endl;
+  cout << setProblem.item()->getInformations_XML() << endl;
+  cout << setMetaheuristic.item()->getInformations_XML() << endl;
   
   try {
     setMetaheuristic.item()->start();
@@ -310,5 +351,8 @@
   catch (...) {
     cerr << "Unknown error" << endl;
   }
+
+
+  cout << "</ometah>" << endl;
     
 }
Index: ometah/metaheuristic/itsMetaheuristic.cpp
diff -u ometah/metaheuristic/itsMetaheuristic.cpp:1.22 
ometah/metaheuristic/itsMetaheuristic.cpp:1.23
--- ometah/metaheuristic/itsMetaheuristic.cpp:1.22      Tue Jun  7 12:11:57 2005
+++ ometah/metaheuristic/itsMetaheuristic.cpp   Thu Jun  9 12:56:31 2005
@@ -1,5 +1,5 @@
 /**************************************************************************** 
- * $Id: itsMetaheuristic.cpp,v 1.22 2005/06/07 12:11:57 nojhan Exp $
+ * $Id: itsMetaheuristic.cpp,v 1.23 2005/06/09 12:56:31 nojhan Exp $
  *  Copyright : Université Paris 12 Val-de-Marne
  *              (61 avenue du Général de Gaulle, 94010, Créteil, France)
  * Authors : Walid Tfaili <address@hidden>
@@ -114,7 +114,6 @@
 {
   printLog("steps","initialization");
 
-  *outProcessResult << "<? xml-version=\"1.0\" encoding=\"ISO-8859-1\" ?>" << 
endl;
   *outProcessResult << "<optimization>" << endl;
 
   initialization();
@@ -128,8 +127,10 @@
   printLog("iterations", msg1.str() );
   printLog("sample_steps", "  sample_values "+printValues( this->sample ) );
 
-  *outProcessResult << "<iteration class=\"" << "start" << "\" id=\"" << 
iterationsCurrent << "\">" << endl;
+  *outProcessResult << "<iteration id=\"" << iterationsCurrent << "\">" << 
endl;
+  *outProcessResult << "<step class=\"" << "start" << ">" << endl;
   outputSample();  
+  *outProcessResult << "</step>" << endl;
   *outProcessResult << "</iteration>" << endl;
 
 
@@ -141,15 +142,17 @@
     ostringstream msg;
     msg << "iteration " << iterationsCurrent+1;
     printLog("iterations", msg.str() );
-
+  
+    *outProcessResult << "<iteration id=\"" << iterationsCurrent << "\">" << 
endl;
+  
   
     /* main phases */
     printLog("steps"," learning");
     learning(); // Learning phase
-    
-    *outProcessResult << "<iteration class=\"" << "learning" << "\" id=\"" << 
iterationsCurrent << "\">" << endl;
-    outputSample();  
-    *outProcessResult << "</iteration>" << endl;
+  
+    *outProcessResult << "<step class=\"" << "learning" << ">" << endl;
+        outputSample();  
+    *outProcessResult << "</step>" << endl;
 
     printLog("steps"," diversification");
     diversification(); // Diversification phase
@@ -157,9 +160,9 @@
     // log sample
     printLog("sample_steps", "  sample_values "+printValues( this->sample ) );
   
-    *outProcessResult << "<iteration class=\"" << "diversification" << "\" 
id=\"" << iterationsCurrent << "\">" << endl;
-    outputSample();  
-    *outProcessResult << "</iteration>" << endl;
+    *outProcessResult << "<step class=\"" << "diversification" << ">" << endl;
+        outputSample();  
+    *outProcessResult << "</step>" << endl;
 
   
     printLog("steps"," intensification");
@@ -172,10 +175,16 @@
     printDebug("sample_values", printValues( this->sample, -1, " ", "\n"  
)+"\n\n", false );
     printDebug("sample_solutions", printSolutions( this->sample, -1, " ", "\n" 
 )+"\n\n", false );
 
-    *outProcessResult << "<iteration class=\"" << "intensification" << "\" 
id=\"" << iterationsCurrent << "\">" << endl;
-    outputSample();  
-    *outProcessResult << "</iteration>" << endl;
 
+    *outProcessResult << "<step class=\"" << "intensification" << ">" << endl;
+        outputSample();  
+    *outProcessResult << "</step>" << endl;
+
+
+    *outProcessResult << "<evaluations>" << "?" << "</evaluations>" << endl; 
// FIXME : nombre d'évaluations
+
+    *outProcessResult << "</iteration>" << endl;
+    
     // one more iteration
     iterationsCurrent++;
   
@@ -294,6 +303,27 @@
     return infos.str();
 }
 
+
+string itsMetaheuristic::getInformations_XML()
+{
+    // a stream is easier to manipulate
+    stringstream infos;
+
+    infos << "<metaheuristic>" << endl;
+
+    infos << "<key>" << getKey() << "</key>" << endl;
+    infos << "<family>" << getFamily() << "</family>" << endl;
+    infos << "<name>" << getName() << "</name>" << endl;
+    infos << "<accronym>" << getAccronym() << "</accronym>" << endl;
+    infos << "<description>" << getDescription() << "</description>" << endl;
+    infos << "<reference>" << getCitation() << "</reference>" << endl;
+
+    infos << "</metaheuristic>" << endl;
+
+    // get back the string only
+    return infos.str();
+}
+
 unsigned int itsMetaheuristic::getSampleSize()
 {
     return this->sampleSize;
Index: ometah/metaheuristic/itsMetaheuristic.hpp
diff -u ometah/metaheuristic/itsMetaheuristic.hpp:1.20 
ometah/metaheuristic/itsMetaheuristic.hpp:1.21
--- ometah/metaheuristic/itsMetaheuristic.hpp:1.20      Tue Jun  7 12:11:57 2005
+++ ometah/metaheuristic/itsMetaheuristic.hpp   Thu Jun  9 12:56:32 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  $Id: itsMetaheuristic.hpp,v 1.20 2005/06/07 12:11:57 nojhan Exp $
+ *  $Id: itsMetaheuristic.hpp,v 1.21 2005/06/09 12:56:32 nojhan Exp $
  *  Copyright : Université Paris 12 Val-de-Marne
  *              (61 avenue du Général de Gaulle, 94010, Créteil, France)
  *  Author : Walid Tfaili <address@hidden>
@@ -232,6 +232,13 @@
   */
   string getInformations();
 
+  //! Return a formated output of all the informations
+  /*!
+    Return the Key, Family, Name, Accronym, Description and Reference 
+    (in this order) of the algorithm, if given. In xml format.
+  */
+  string getInformations_XML();
+
   //! Return the sample size
   unsigned int getSampleSize();
   //! Return the true current sample size_t
Index: ometah/ometah.pws
diff -u ometah/ometah.pws:1.19 ometah/ometah.pws:1.20
--- ometah/ometah.pws:1.19      Mon Jun  6 12:41:52 2005
+++ ometah/ometah.pws   Thu Jun  9 12:56:31 2005
@@ -1,8 +1,8 @@
 
 [filenumbers]
-0=409
-1=36
-2=54
+0=337
+1=63
+2=60
 3=1
 4=28
 5=153
@@ -30,6 +30,11 @@
 [Project State]
 clean before build=false
 
+[filelist]
+0=/home/nojhan/travail/openMetaheuristic/source/ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp
+1=/home/nojhan/travail/openMetaheuristic/source/ometah/problem/CEC05/itsCEC05_SSRPO_Problems.cpp
+2=/home/nojhan/travail/openMetaheuristic/source/ometah/problem/CEC05/itsCEC05_SSRPO_Problems.hpp
+
 [Project Tree]
 0=0
 1=0:0
Index: ometah/problem/CEC05/itsCEC05_SSRPO_Problems.cpp
diff -u ometah/problem/CEC05/itsCEC05_SSRPO_Problems.cpp:1.2 
ometah/problem/CEC05/itsCEC05_SSRPO_Problems.cpp:1.3
--- ometah/problem/CEC05/itsCEC05_SSRPO_Problems.cpp:1.2        Tue Jun  7 
15:24:48 2005
+++ ometah/problem/CEC05/itsCEC05_SSRPO_Problems.cpp    Thu Jun  9 12:56:32 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- * $Id: itsCEC05_SSRPO_Problems.cpp,v 1.2 2005/06/07 15:24:48 nojhan Exp $
+ * $Id: itsCEC05_SSRPO_Problems.cpp,v 1.3 2005/06/09 12:56:32 nojhan Exp $
  *  Copyright : Université Paris 12 Val-de-Marne
  *              (61 avenue du Général de Gaulle, 94010, Créteil, France)
  * Author: Johann Dréo <address@hidden>
@@ -32,24 +32,32 @@
 }
 
 
-
 void itsCEC05_SSRPO_Problem::doShiftOptimum()
 {
     vector<double> sol = currentPoint.getSolution();
 
-    for(unsigned int i=0; i<currentPoint.size(); i++) {
+    for(unsigned int i=0; i<currentPoint.getSolution().size(); i++) {
         sol[i] += optimumShift[i];
     }
     currentPoint.setSolution( sol );
 }
 
+
 void itsCEC05_SSRPO_Problem::doRotate()
 {
     vector<double> sol = currentPoint.getSolution();
 
-    
+    vector<vector< double> > solMat;
+    solMat.push_back(sol);
+
+    vector<vector<double> > res;
+
+    //res = multiply( solMat, this->rotationMatrix );
+
+    currentPoint.setSolution(res[0]);
 }
 
+
 void itsCEC05_SSRPO_Problem::noise()
 {
 
Index: ometah/problem/itsProblem.cpp
diff -u ometah/problem/itsProblem.cpp:1.13 ometah/problem/itsProblem.cpp:1.14
--- ometah/problem/itsProblem.cpp:1.13  Tue Jun  7 12:11:57 2005
+++ ometah/problem/itsProblem.cpp       Thu Jun  9 12:56:32 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  $Id: itsProblem.cpp,v 1.13 2005/06/07 12:11:57 nojhan Exp $
+ *  $Id: itsProblem.cpp,v 1.14 2005/06/09 12:56:32 nojhan Exp $
  *  Copyright : Université Paris 12 Val-de-Marne
  *              (61 avenue du Général de Gaulle, 94010, Créteil, France)
  *  Author : Johann Dréo <address@hidden>
@@ -148,6 +148,67 @@
   return msg.str();  
 }
 
+
+string itsProblem::getInformations_XML()
+{
+  // put all in the stream
+  stringstream msg;
+  
+  msg << "<problem>" << endl;
+
+  msg << "<key>" << getKey() << "</key>" << endl;
+  msg << "<name>" << getName() << "</name>" << endl;
+  msg << "<description>" << getDescription() << "</description>" << endl;
+  msg << "<formula>" << getFormula() << "</formula>" << endl;
+  msg << "<dimension>" << getDimension() << "</dimension>" << endl;
+  
+
+  // print vectors of the optimums
+  msg << "<optimums>" << endl;
+  for(unsigned int i=0;i<getOptima().size();i++) { 
+      if(getOptima().size()>1) {
+          msg << "<point id=\"" << i << "\">" << "<values>";
+      } else {
+          msg << "<point>" << "<values>";
+      }
+      
+      print(getOptima()[i].getValues(),",",&msg);
+      msg << "</values>" << "<solution>";
+      print(getOptima()[i].getSolution(),",",&msg);
+      msg << "</solution>" << "</point>" << endl;
+  
+  }
+  msg << "</optimums>" << endl;
+
+  // print vectors of bounds
+  msg << "<bounds>" << endl;
+
+  msg << "<minimums>";
+    msg << "<point>" << "<solution>";
+    msg << print( getBoundsMinima() );
+    msg << "</point>" << "</solution>";
+  msg << "</minimums>" << endl;
+
+  msg << "<maximums>";
+    msg << "<point>" << "<solution>";
+    msg << print( getBoundsMaxima() );
+    msg << "</point>" << "</solution>";
+  msg << "</maximums>" << endl;
+
+  msg << "</bounds>" << endl;
+
+  // references
+  msg << "<reference>" << getCitation() << "</reference>" << endl;
+
+
+  msg << "</problem>" << endl;
+
+  // return only the string
+  return msg.str();  
+}
+
+
+
 vector<itsPoint> itsProblem::getOptima()
 {
     return this->optima;
Index: ometah/problem/itsProblem.hpp
diff -u ometah/problem/itsProblem.hpp:1.15 ometah/problem/itsProblem.hpp:1.16
--- ometah/problem/itsProblem.hpp:1.15  Tue Jun  7 12:11:57 2005
+++ ometah/problem/itsProblem.hpp       Thu Jun  9 12:56:32 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  $Id: itsProblem.hpp,v 1.15 2005/06/07 12:11:57 nojhan Exp $
+ *  $Id: itsProblem.hpp,v 1.16 2005/06/09 12:56:32 nojhan Exp $
  *  Copyright : Université Paris 12 Val-de-Marne
  *              (61 avenue du Général de Gaulle, 94010, Créteil, France)
  *  Author : Johann Dréo <address@hidden>
@@ -140,6 +140,14 @@
   */
   string getInformations();
   
+  
+  //! Return a formated output of all the informations
+  /*!
+    Return the Key, Name, Description, Dimension, Formula, Optimum, Bounds and 
Reference 
+    (in this order) of the algorithm, if given. In a xml format.
+  */
+  string getInformations_XML();
+  
   //! Return the search space bounds
   /*!
     Return a matrix of the form :




reply via email to

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