[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[oMetah-devel] ometah ./ometah.pws common/string.hpp interface...
From: |
Johann |
Subject: |
[oMetah-devel] ometah ./ometah.pws common/string.hpp interface... |
Date: |
Mon, 16 May 2005 06:03:55 -0400 |
CVSROOT: /cvsroot/ometah
Module name: ometah
Branch:
Changes by: Johann <address@hidden> 05/05/16 10:03:54
Modified files:
. : ometah.pws
common : string.hpp
interface : ometah.cpp
metaheuristic : itsMetaheuristic.cpp itsMetaheuristic.hpp
problem : itsProblem.cpp itsProblem.hpp
Log message:
* method for getting formatted informations
* some tests in interface
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/ometah.pws.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/common/string.hpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/interface/ometah.cpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/metaheuristic/itsMetaheuristic.cpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/metaheuristic/itsMetaheuristic.hpp.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/itsProblem.cpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/itsProblem.hpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
Patches:
Index: ometah/common/string.hpp
diff -u ometah/common/string.hpp:1.4 ometah/common/string.hpp:1.5
--- ometah/common/string.hpp:1.4 Sat Mar 26 09:17:38 2005
+++ ometah/common/string.hpp Mon May 16 10:03:54 2005
@@ -1,6 +1,6 @@
/***************************************************************************
- * $Id: string.hpp,v 1.4 2005/03/26 09:17:38 nojhan Exp $
+ * $Id: string.hpp,v 1.5 2005/05/16 10:03:54 nojhan Exp $
* Author : Johann Dréo <address@hidden>
****************************************************************************/
@@ -37,9 +37,10 @@
for( unsigned int i=1; i<aVector.size(); i++ ) {
*outer << aSeparator << aVector[i];
}
-}
+};
//! Make a double vector from a string vector
+/*
template<template <class T> class V>
V<double> stringToDouble(V<string> VString)
{
@@ -55,8 +56,10 @@
}
return VDouble;
}
+*/
//! Make a double from a string
+/*
double stringToDouble(string aString)
{
double aDouble;
@@ -64,7 +67,8 @@
aDouble = atof( aString.c_str() );
return aDouble;
-}
+};
+*/
//! Make a double vector from a string, with shortcut options
/*!
@@ -73,6 +77,7 @@
"3:1.0" => <1.0,1.0,1.0>
*/
+/*
template<template <class T> class V>
V<double> stringToDouble(string aString, string itemSeparator=",", string
multiSeparator=":")
{
@@ -91,6 +96,7 @@
}
return res;
}
+*/
//! Make a string vector from a string
/*!
@@ -111,7 +117,7 @@
words.push_back(text.substr(start, stop - start));
start = text.find_first_not_of(separators, stop+1);
}
-}
+};
//! Make a string vector from a string
template<template<class T> class V>
@@ -133,6 +139,6 @@
}
return words;
-}
+};
#endif
Index: ometah/interface/ometah.cpp
diff -u ometah/interface/ometah.cpp:1.11 ometah/interface/ometah.cpp:1.12
--- ometah/interface/ometah.cpp:1.11 Sat May 14 16:07:57 2005
+++ ometah/interface/ometah.cpp Mon May 16 10:03:54 2005
@@ -1,5 +1,5 @@
/***************************************************************************
- * $Id: ometah.cpp,v 1.11 2005/05/14 16:07:57 nojhan Exp $
+ * $Id: ometah.cpp,v 1.12 2005/05/16 10:03:54 nojhan Exp $
* Copyright : Université Paris 12 Val-de-Marne
* Author : Johann Dréo <address@hidden>
****************************************************************************/
@@ -139,6 +139,16 @@
* Launch the optimization
*/
+ //setMetaheuristic.item()->start();
+
+
+ // TESTS
+ cout << "METAHEURISTIC" << endl <<
setMetaheuristic.item()->getInformations();
+ cout << "PROBLEM" << endl << setProblem.item()->getInformations();
+ cout << endl;
+
setMetaheuristic.item()->start();
+
+
}
Index: ometah/metaheuristic/itsMetaheuristic.cpp
diff -u ometah/metaheuristic/itsMetaheuristic.cpp:1.10
ometah/metaheuristic/itsMetaheuristic.cpp:1.11
--- ometah/metaheuristic/itsMetaheuristic.cpp:1.10 Thu May 5 16:40:15 2005
+++ ometah/metaheuristic/itsMetaheuristic.cpp Mon May 16 10:03:54 2005
@@ -26,6 +26,7 @@
#include <iostream>
+#include <sstream>
#include "itsMetaheuristic.hpp"
#include "../common/random.hpp"
#include "../problem/itsProblem.hpp"
@@ -110,6 +111,9 @@
// one more iteration
iterationsCurrent++;
+
+ //TESTS
+ clog << iterationsCurrent << " ";
}
}
@@ -200,6 +204,24 @@
this->family = family;
}
+string itsMetaheuristic::getInformations()
+{
+ // a stream is easier to manipulate
+ stringstream infos;
+
+ // Separator used between key and value
+ string sep = ":\t";
+
+ infos << "Key" << sep << getKey() << endl;
+ infos << "Family" << sep << getFamily() << endl;
+ infos << "Name" << sep << getName() << endl;
+ infos << "Accronym" << sep << getAccronym() << endl;
+ infos << "Description" << sep << getDescription() << endl;
+ infos << "Reference" << sep << getCitation() << endl;
+
+ // get back the string only
+ return infos.str();
+}
unsigned int itsMetaheuristic::getSampleSize()
{
Index: ometah/metaheuristic/itsMetaheuristic.hpp
diff -u ometah/metaheuristic/itsMetaheuristic.hpp:1.12
ometah/metaheuristic/itsMetaheuristic.hpp:1.13
--- ometah/metaheuristic/itsMetaheuristic.hpp:1.12 Fri May 13 18:36:01 2005
+++ ometah/metaheuristic/itsMetaheuristic.hpp Mon May 16 10:03:54 2005
@@ -203,6 +203,15 @@
string getFamily();
//! Change the reference
void setFamily(string family);
+
+ //! 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.
+ The format is the following :
+ Key:\tValue\n
+ */
+ string getInformations();
//! Return the sample size
unsigned int getSampleSize();
Index: ometah/ometah.pws
diff -u ometah/ometah.pws:1.10 ometah/ometah.pws:1.11
--- ometah/ometah.pws:1.10 Sat May 14 06:33:15 2005
+++ ometah/ometah.pws Mon May 16 10:03:54 2005
@@ -1,6 +1,6 @@
[filenumbers]
-0=76
+0=1
1=1
2=29
3=32
@@ -30,16 +30,13 @@
[Project State]
clean before build=false
-[filelist]
-0=/home/nojhan/travail/openMetaheuristic/source/ometah/communication/itsCommunicationClient.hpp
-1=/home/nojhan/travail/openMetaheuristic/source/ometah/communication/itsCommunicationServer.hpp
-2=/home/nojhan/travail/openMetaheuristic/source/ometah/communication/itsCommunicationServer_embedded.cpp
-3=/home/nojhan/travail/openMetaheuristic/source/ometah/communication/itsCommunicationServer_embedded.hpp
-
[Project Tree]
0=0
1=0:0
2=0:1
+[Symbol Tree]
+0=1
+
[File Tree]
0=0
Index: ometah/problem/itsProblem.cpp
diff -u ometah/problem/itsProblem.cpp:1.10 ometah/problem/itsProblem.cpp:1.11
--- ometah/problem/itsProblem.cpp:1.10 Wed Mar 30 22:29:20 2005
+++ ometah/problem/itsProblem.cpp Mon May 16 10:03:54 2005
@@ -1,5 +1,5 @@
/***************************************************************************
- * $Id: itsProblem.cpp,v 1.10 2005/03/30 22:29:20 nojhan Exp $
+ * $Id: itsProblem.cpp,v 1.11 2005/05/16 10:03:54 nojhan Exp $
* Copyright 2005 Université Paris 12 Val-de-Marne
* Author : Johann Dréo <address@hidden>
****************************************************************************/
@@ -25,6 +25,7 @@
#include <string>
#include <vector>
#include <sstream>
+#include "../common/string.hpp"
#include "itsProblem.hpp"
using namespace std;
@@ -104,12 +105,45 @@
string itsProblem::getInformations()
{
// separator used to format output
- string separator = " ; ";
+ string sep = ":\t";
// put all in the stream
- ostringstream msg;
- msg << getName() << separator << getDescription() << separator <<
getCitation();
+ stringstream msg;
+ msg << "Key" << sep << getKey() << endl;
+ msg << "Name" << sep << getName() << endl;
+ msg << "Description" << sep << getDescription() << endl;
+ msg << "Formula" << sep << getFormula() << endl;
+ msg << "Dimension" << sep << getDimension() << endl;
+
+ // print vectors of the optimums
+ for(unsigned int i=0;i<getOptima().size();i++) {
+ if(getOptima().size()>1) {
+ msg << "Optimum " << i << sep;
+ } else {
+ msg << "Optimum " << sep;
+ }
+ msg << "<";
+ print(getOptima()[i].getValues(),",",&msg);
+ msg << "> @ <";
+ print(getOptima()[i].getSolution(),",",&msg);
+ msg << ">";
+ msg << endl;
+ }
+
+ // print vectors of bounds
+ msg << "Bounds" << sep << "[";
+ for(unsigned int i=0;i<getBounds().size();i++) {
+ msg << "[";
+ print(getBounds()[i],",",&msg);
+ msg << "]";
+ }
+ msg << "]" << endl;
+
+ msg << "Reference" << sep << getCitation() << endl;
+
+//Name, Description, Dimension, Formula, Optimum, Bounds and Reference
+
// return only the string
return msg.str();
}
Index: ometah/problem/itsProblem.hpp
diff -u ometah/problem/itsProblem.hpp:1.13 ometah/problem/itsProblem.hpp:1.14
--- ometah/problem/itsProblem.hpp:1.13 Fri May 13 18:36:01 2005
+++ ometah/problem/itsProblem.hpp Mon May 16 10:03:54 2005
@@ -1,5 +1,5 @@
/***************************************************************************
- * $Id: itsProblem.hpp,v 1.13 2005/05/13 18:36:01 nojhan Exp $
+ * $Id: itsProblem.hpp,v 1.14 2005/05/16 10:03:54 nojhan Exp $
* Copyright 2005 Université Paris 12 Val-de-Marne
* Author : Johann Dréo <address@hidden>
****************************************************************************/
@@ -130,6 +130,15 @@
//! Change the informations about the global optima
void setOptima(vector<itsPoint> optima);
+ //! 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.
+ The format is the following :
+ Key:\tValue\n
+ */
+ string getInformations();
+
//! Return the search space bounds
/*!
Return a matrix of the form :
@@ -168,12 +177,6 @@
//@}
- //! Return all available informations in a fashion way
- /*!
- Concatenate all string describing the problem and returns them.
- */
- string getInformations();
-
//! The objective function
/*!
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [oMetah-devel] ometah ./ometah.pws common/string.hpp interface...,
Johann <=