[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:25:27 -0400 |
CVSROOT: /cvsroot/ometah
Module name: ometah
Branch:
Changes by: NoJhan <address@hidden> 05/06/03 13:25:27
Modified files:
problem/CEC05 : itsCEC05_SSRPO_Base.cpp itsCEC05_SSRPO_Base.hpp
Log message:
* sphere function
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp
diff -u ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp:1.4
ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp:1.5
--- ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp:1.4 Fri Jun 3 13:16:59 2005
+++ ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp Fri Jun 3 13:25:27 2005
@@ -1,5 +1,5 @@
/***************************************************************************
- * $Id: itsCEC05_SSRPO_Base.cpp,v 1.4 2005/06/03 13:16:59 nojhan Exp $
+ * $Id: itsCEC05_SSRPO_Base.cpp,v 1.5 2005/06/03 13:25:27 nojhan Exp $
* Author: Johann Dréo <address@hidden>
****************************************************************************/
@@ -215,7 +215,6 @@
-
/*******************************************************************************
* Griewank
******************************************************************************/
@@ -253,12 +252,11 @@
unsigned int dim = getDimension();
vector<double> x=point.getSolution();
- long double s, p;
- long double res;
+ double s, p;
+ double res;
s = 0.0;
p = 1.0;
- for (unsigned int i=0; i<dim; i++)
- {
+ for (unsigned int i=0; i<dim; i++) {
s += x[i] * x[i];
p *= cos( x[i] / sqrt( 1.0 + i ) );
}
@@ -274,3 +272,56 @@
{
return new itsGriewank();
}
+
+/*******************************************************************************
+ * Sphere
+
******************************************************************************/
+
+
+itsSphere::itsSphere()
+{
+ // informations
+ setName("Sphere");
+ setKey("Sphere");
+ setDescription("");
+ setCitation("Unknown");
+ setFormula("${\\displaystyle \\sum_{i=1}^{D}\\left(x_{i}^{2}\\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 itsSphere::objectiveFunction(itsPoint point)
+{
+ unsigned int dim = getDimension();
+ vector<double> x=point.getSolution();
+
+ double res = 0.0;
+ for (unsigned int i=0; i<dim; i++) {
+ res += x[i]*x[i];
+ }
+
+ vector<double> val(1,res);
+ point.setValues(val);
+
+ return point;
+}
+
+itsProblem * itsSphereFactory::create()
+{
+ return new itsSphere();
+}
Index: ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp
diff -u ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp:1.4
ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp:1.5
--- ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp:1.4 Fri Jun 3 13:16:59 2005
+++ ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp Fri Jun 3 13:25:27 2005
@@ -1,5 +1,5 @@
/***************************************************************************
- * $Id: itsCEC05_SSRPO_Base.hpp,v 1.4 2005/06/03 13:16:59 nojhan Exp $
+ * $Id: itsCEC05_SSRPO_Base.hpp,v 1.5 2005/06/03 13:25:27 nojhan Exp $
* Author: Johann Dréo <address@hidden>
****************************************************************************/
@@ -25,7 +25,14 @@
* Special Session on Real-Parameter Optimization at the IEEE Congress on
* Evolutionary Computation, Edinburgh, UK, 2-5 Sept. 2005
*/
-
+
+/*
+ * Ackley
+ * Rastrigrin
+ * Weierstrass
+ * Griewangk
+ * Sphere
+ */
#ifndef ITSCEC05SSRPO
#define ITSCEC05SSRPO
@@ -98,4 +105,20 @@
itsProblem * create();
};
+
+/***** Sphere *****/
+
+class itsSphere : public itsProblem
+{
+public:
+ itsSphere();
+ itsPoint objectiveFunction(itsPoint point);
+};
+
+class itsSphereFactory : 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, 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