[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[oMetah-devel] ometah/problem/CEC05 itsCEC05_SSRPO_Base.cpp it...
From: |
NoJhan |
Subject: |
[oMetah-devel] ometah/problem/CEC05 itsCEC05_SSRPO_Base.cpp it... |
Date: |
Fri, 03 Jun 2005 09:31:03 -0400 |
CVSROOT: /cvsroot/ometah
Module name: ometah
Branch:
Changes by: NoJhan <address@hidden> 05/06/03 13:31:03
Modified files:
problem/CEC05 : itsCEC05_SSRPO_Base.cpp itsCEC05_SSRPO_Base.hpp
Log message:
* schwefel's function
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
Patches:
Index: ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp
diff -u ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp:1.5
ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp:1.6
--- ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp:1.5 Fri Jun 3 13:25:27 2005
+++ ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp Fri Jun 3 13:31:03 2005
@@ -1,5 +1,5 @@
/***************************************************************************
- * $Id: itsCEC05_SSRPO_Base.cpp,v 1.5 2005/06/03 13:25:27 nojhan Exp $
+ * $Id: itsCEC05_SSRPO_Base.cpp,v 1.6 2005/06/03 13:31:03 nojhan Exp $
* Author: Johann Dréo <address@hidden>
****************************************************************************/
@@ -273,6 +273,7 @@
return new itsGriewank();
}
+
/*******************************************************************************
* Sphere
******************************************************************************/
@@ -325,3 +326,64 @@
{
return new itsSphere();
}
+
+
+/*******************************************************************************
+ * Schwefel
+
******************************************************************************/
+
+
+itsSchwefel::itsSchwefel()
+{
+ // informations
+ setName("Schwefel");
+ setKey("Schwefel");
+ setDescription("");
+ setCitation("Unknown");
+ setFormula("${\\displaystyle
\\sum_{i=1}^{D}\\left(\\sum_{j=1}^{i}\\left(x_{j}^{2}\\right)\\right)}$");
+
+ setDimension(1); // one dimension is the default, but one may change it
after instanciation
+
+ setBoundsMinimaAll(-100);
+ setBoundsMaximaAll(100);
+
+ vector<itsPoint> optim;
+ itsPoint pt;
+
+ vector<double> sol(getDimension(),0);
+ pt.setSolution(sol); // a vector of 0
+
+ vector<double> val(1,0);
+ pt.setValues(val); // a value of 0
+
+ optim.push_back(pt);
+ setOptima(optim);
+}
+
+itsPoint itsSchwefel::objectiveFunction(itsPoint point)
+{
+ unsigned int dim = getDimension();
+ vector<double> x=point.getSolution();
+
+ double sum1, sum2;
+ sum1 = 0.0;
+
+ for (unsigned int i=0; i<dim; i++) {
+ sum2 = 0.0;
+
+ for (unsigned int j=0; j<=i; j++) {
+ sum2 += x[j];
+ }
+ sum1 += sum2*sum2;
+ }
+
+ vector<double> val(1,sum1);
+ point.setValues(val);
+
+ return point;
+}
+
+itsProblem * itsSchwefelFactory::create()
+{
+ return new itsSphere();
+}
Index: ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp
diff -u ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp:1.5
ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp:1.6
--- ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp:1.5 Fri Jun 3 13:25:27 2005
+++ ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp Fri Jun 3 13:31:03 2005
@@ -1,5 +1,5 @@
/***************************************************************************
- * $Id: itsCEC05_SSRPO_Base.hpp,v 1.5 2005/06/03 13:25:27 nojhan Exp $
+ * $Id: itsCEC05_SSRPO_Base.hpp,v 1.6 2005/06/03 13:31:03 nojhan Exp $
* Author: Johann Dréo <address@hidden>
****************************************************************************/
@@ -32,6 +32,7 @@
* Weierstrass
* Griewangk
* Sphere
+ * Schwefel
*/
#ifndef ITSCEC05SSRPO
@@ -121,4 +122,20 @@
itsProblem * create();
};
+
+/***** Schwefel *****/
+
+class itsSchwefel : public itsProblem
+{
+public:
+ itsSchwefel();
+ itsPoint objectiveFunction(itsPoint point);
+};
+
+class itsSchwefelFactory : public itsProblemFactory
+{
+public:
+ itsProblem * create();
+};
+
#endif
- [oMetah-devel] ometah/problem/CEC05 itsCEC05_SSRPO_Base.cpp it..., NoJhan, 2005/06/03
- [oMetah-devel] ometah/problem/CEC05 itsCEC05_SSRPO_Base.cpp it..., NoJhan, 2005/06/03
- [oMetah-devel] ometah/problem/CEC05 itsCEC05_SSRPO_Base.cpp it..., NoJhan, 2005/06/03
- [oMetah-devel] ometah/problem/CEC05 itsCEC05_SSRPO_Base.cpp it..., NoJhan, 2005/06/03
- [oMetah-devel] ometah/problem/CEC05 itsCEC05_SSRPO_Base.cpp it...,
NoJhan <=
- [oMetah-devel] ometah/problem/CEC05 itsCEC05_SSRPO_Base.cpp it..., NoJhan, 2005/06/03
- [oMetah-devel] ometah/problem/CEC05 itsCEC05_SSRPO_Base.cpp it..., NoJhan, 2005/06/03