[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 08:47:13 -0400 |
CVSROOT: /cvsroot/ometah
Module name: ometah
Branch:
Changes by: NoJhan <address@hidden> 05/06/03 12:47:12
Modified files:
problem/CEC05 : itsCEC05_SSRPO_Base.cpp itsCEC05_SSRPO_Base.hpp
Log message:
* Rastrigin base problem
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp
diff -u ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp:1.1
ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp:1.2
--- ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp:1.1 Fri Jun 3 12:07:49 2005
+++ ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp Fri Jun 3 12:47:12 2005
@@ -1,5 +1,5 @@
/***************************************************************************
- * $Id: itsCEC05_SSRPO_Base.cpp,v 1.1 2005/06/03 12:07:49 nojhan Exp $
+ * $Id: itsCEC05_SSRPO_Base.cpp,v 1.2 2005/06/03 12:47:12 nojhan Exp $
* Author: Johann Dréo <address@hidden>
****************************************************************************/
@@ -35,6 +35,11 @@
using namespace std;
+
+/*******************************************************************************
+ * Ackley
+
******************************************************************************/
+
itsAckley::itsAckley()
{
// informations
@@ -88,3 +93,58 @@
{
return new itsAckley();
}
+
+
+/*******************************************************************************
+ * Rastrigin
+
******************************************************************************/
+
+
+itsRastrigin::itsRastrigin()
+{
+ // informations
+ setName("Rastrigin");
+ setKey("Rastrigin");
+ setDescription("");
+ setCitation("Unknown");
+ setFormula("${\\displaystyle
\\sum_{i=1}^{D}\\left(z_{i}^{2}-10\\cos\\left(2\\pi
z_{i}\\right)+10\\right)}$");
+
+ setDimension(1); // one dimension is the default, but one may change it
after instanciation
+
+ setBoundsMinimaAll(-5);
+ setBoundsMaximaAll(5);
+
+ 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 itsRastrigin::objectiveFunction(itsPoint point)
+{
+ long double res = 0.0;
+ unsigned int dim = getDimension();
+ vector<double> x=point.getSolution();
+
+ for (unsigned int i=0; i<dim; i++)
+ {
+ res += (x[i]*x[i] - 10.0*cos(2.0*PI*x[i]) + 10.0);
+ }
+
+ vector<double> val(1,res);
+ point.setValues(val);
+
+ return point;
+}
+
+itsProblem * itsRastriginFactory::create()
+{
+ return new itsRastrigin();
+}
Index: ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp
diff -u ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp:1.1
ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp:1.2
--- ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp:1.1 Fri Jun 3 12:07:49 2005
+++ ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp Fri Jun 3 12:47:12 2005
@@ -1,5 +1,5 @@
/***************************************************************************
- * $Id: itsCEC05_SSRPO_Base.hpp,v 1.1 2005/06/03 12:07:49 nojhan Exp $
+ * $Id: itsCEC05_SSRPO_Base.hpp,v 1.2 2005/06/03 12:47:12 nojhan Exp $
* Author: Johann Dréo <address@hidden>
****************************************************************************/
@@ -33,13 +33,13 @@
#include "../../common/itsPoint.hpp"
#include "../itsProblem.hpp"
+
+/***** Ackley *****/
+
class itsAckley : public itsProblem
{
public:
- //! Constructor
itsAckley();
-
- //! Function
itsPoint objectiveFunction(itsPoint point);
};
@@ -49,4 +49,22 @@
itsProblem * create();
};
+
+
+/***** Rastrigrin *****/
+
+class itsRastrigin : public itsProblem
+{
+public:
+ itsRastrigin();
+ itsPoint objectiveFunction(itsPoint point);
+};
+
+class itsRastriginFactory : 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 <=
- [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