[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[oMetah-devel] ometah ./ometah.pws metaheuristic/itsMetaheuris...
From: |
NoJhan |
Subject: |
[oMetah-devel] ometah ./ometah.pws metaheuristic/itsMetaheuris... |
Date: |
Mon, 06 Jun 2005 08:41:52 -0400 |
CVSROOT: /cvsroot/ometah
Module name: ometah
Branch:
Changes by: NoJhan <address@hidden> 05/06/06 12:41:52
Modified files:
. : ometah.pws
metaheuristic : itsMetaheuristic.cpp itsMetaheuristic.hpp
Log message:
* XML output for the optimization part
* accessors for output streams
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/ometah.pws.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/metaheuristic/itsMetaheuristic.cpp.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/metaheuristic/itsMetaheuristic.hpp.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
Patches:
Index: ometah/metaheuristic/itsMetaheuristic.cpp
diff -u ometah/metaheuristic/itsMetaheuristic.cpp:1.18
ometah/metaheuristic/itsMetaheuristic.cpp:1.19
--- ometah/metaheuristic/itsMetaheuristic.cpp:1.18 Tue May 31 13:42:56 2005
+++ ometah/metaheuristic/itsMetaheuristic.cpp Mon Jun 6 12:41:52 2005
@@ -1,5 +1,5 @@
/****************************************************************************
- * $Id: itsMetaheuristic.cpp,v 1.18 2005/05/31 13:42:56 nojhan Exp $
+ * $Id: itsMetaheuristic.cpp,v 1.19 2005/06/06 12:41:52 nojhan Exp $
* Copyright 2005 Walid TFAILI
* Authors : Walid Tfaili <address@hidden>, Johann Dréo <address@hidden>
****************************************************************************/
@@ -111,6 +111,9 @@
void itsMetaheuristic::start()
{
printLog("steps","initialization");
+
+ *outProcessResult << "<optimization>" << endl;
+
initialization();
// no iterations has been computed
@@ -122,6 +125,12 @@
printLog("iterations", msg1.str() );
printLog("sample_steps", " sample_values "+printValues( this->sample ) );
+ *outProcessResult << "<iteration class=\"" << "start" << "\" id=\"" <<
iterationsCurrent << "\">" << endl;
+ outputSample();
+ *outProcessResult << "</iteration>" << endl;
+
+
+
// while no stopping criterion reached
while( !isStoppingCriteria() ) {
@@ -135,12 +144,21 @@
printLog("steps"," learning");
learning(); // Learning phase
+ *outProcessResult << "<iteration class=\"" << "learning" << "\" id=\"" <<
iterationsCurrent << "\">" << endl;
+ outputSample();
+ *outProcessResult << "</iteration>" << endl;
+
printLog("steps"," diversification");
diversification(); // Diversification phase
// log sample
printLog("sample_steps", " sample_values "+printValues( this->sample ) );
+ *outProcessResult << "<iteration class=\"" << "diversification" << "\"
id=\"" << iterationsCurrent << "\">" << endl;
+ outputSample();
+ *outProcessResult << "</iteration>" << endl;
+
+
printLog("steps"," intensification");
intensification(); // Intensification phase
@@ -151,6 +169,10 @@
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;
+
// one more iteration
iterationsCurrent++;
@@ -160,8 +182,9 @@
printLog("optimum", "optimum "+print( getOptimum().getValues() ) ); // FIXME
: print the solution too
// print the result
- *outEndResult << print( getOptimum().getValues() ) << " "; // values
- *outEndResult << print( getOptimum().getSolution() ) << endl; // solution
+ outputOptimum();
+
+ *outProcessResult << "<optimization>" << endl;
}
void itsMetaheuristic::parameterParse()
@@ -338,3 +361,63 @@
}
return optimum;
}
+
+string itsMetaheuristic::printXMLPoint(itsPoint p)
+{
+ ostringstream out;
+
+ out << "<point>";
+ out << "<values>";
+ out << print( p.getValues(), " " );
+ out << "</values>";
+
+ out << "<solution>";
+ out << print( p.getSolution(), " " );
+ out << "</solution>";
+ out << "</point>";
+
+ return out.str();
+}
+
+void itsMetaheuristic::outputOptimum()
+{
+ *outEndResult << "<optimum>" << endl;
+ *outEndResult << printXMLPoint( this->getOptimum() ) << endl;
+ *outEndResult << "</optimum>" << endl;
+}
+
+
+void itsMetaheuristic::outputSample()
+{
+ *outProcessResult << "<sample>" << endl;
+ for (unsigned int i=0; i<getSampleSizeCurrent(); i++) {
+ *outProcessResult << printXMLPoint(this->sample[i]) << endl;
+ }
+ *outProcessResult << "</sample>" << endl;
+}
+
+
+void itsMetaheuristic::setOutEndResult(ostream* out)
+{
+ this->outEndResult = out;
+}
+
+void itsMetaheuristic::setOutProcessResult(ostream* out)
+{
+ this->outProcessResult = out;
+}
+
+void itsMetaheuristic::setOutErrors(ostream* out)
+{
+ this->outErrors = out;
+}
+
+void itsMetaheuristic::setOutLog(ostream* out)
+{
+ this->outLog = out;
+}
+
+void itsMetaheuristic::setOutDebug(ostream* out)
+{
+ this->outDebug = out;
+}
Index: ometah/metaheuristic/itsMetaheuristic.hpp
diff -u ometah/metaheuristic/itsMetaheuristic.hpp:1.18
ometah/metaheuristic/itsMetaheuristic.hpp:1.19
--- ometah/metaheuristic/itsMetaheuristic.hpp:1.18 Tue May 31 13:42:56 2005
+++ ometah/metaheuristic/itsMetaheuristic.hpp Mon Jun 6 12:41:52 2005
@@ -1,5 +1,5 @@
/***************************************************************************
- * $Id: itsMetaheuristic.hpp,v 1.18 2005/05/31 13:42:56 nojhan Exp $
+ * $Id: itsMetaheuristic.hpp,v 1.19 2005/06/06 12:41:52 nojhan Exp $
* Copyright : 2005 Université Paris 12 Val-de-Marne
* Author : Walid Tfaili <address@hidden>, Johann Dréo <address@hidden>
****************************************************************************/
@@ -256,6 +256,22 @@
//! Change the log level
void setLogLevel(int level);
+
+ //! Change the output for end results
+ void setOutEndResult(ostream* out);
+
+ //! Change the output for in process results
+ void setOutProcessResult(ostream* out);
+
+ //! Change the output for errors
+ void setOutErrors(ostream* out);
+
+ //! Change the output for log
+ void setOutLog(ostream* out);
+
+ //! Change the output for debug
+ void setOutDebug(ostream* out);
+
//@}
@@ -285,6 +301,14 @@
//! Add a debug key
void addDebugKey(string key);
+ //! Formatted output for the end result
+ void outputOptimum();
+
+ //! Formatted output for in progress result
+ void outputSample();
+
+ //! Format a point in xml
+ string printXMLPoint(itsPoint p);
};
Index: ometah/ometah.pws
diff -u ometah/ometah.pws:1.18 ometah/ometah.pws:1.19
--- ometah/ometah.pws:1.18 Thu Jun 2 21:59:39 2005
+++ ometah/ometah.pws Mon Jun 6 12:41:52 2005
@@ -1,10 +1,10 @@
[filenumbers]
-0=88
-1=96
-2=197
-3=50
-4=36
+0=409
+1=36
+2=54
+3=1
+4=28
5=153
6=1
7=56
@@ -30,12 +30,6 @@
[Project State]
clean before build=false
-[filelist]
-0=/home/nojhan/travail/openMetaheuristic/source/ometah/interface/itsArgument.cpp
-1=/home/nojhan/travail/openMetaheuristic/source/ometah/interface/itsArgument.hpp
-2=/home/nojhan/travail/openMetaheuristic/source/ometah/interface/ometah.cpp
-3=/home/nojhan/travail/openMetaheuristic/source/ometah/interface/ometah.hpp
-
[Project Tree]
0=0
1=0:0
@@ -46,4 +40,5 @@
[File Tree]
0=0
-1=0:6
+1=0:8
+2=0:8:0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [oMetah-devel] ometah ./ometah.pws metaheuristic/itsMetaheuris...,
NoJhan <=