ometah-devel
[Top][All Lists]
Advanced

[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:16:59 -0400

CVSROOT:        /cvsroot/ometah
Module name:    ometah
Branch:         
Changes by:     NoJhan <address@hidden> 05/06/03 13:16:59

Modified files:
        problem/CEC05  : itsCEC05_SSRPO_Base.cpp itsCEC05_SSRPO_Base.hpp 

Log message:
        * griewank's function

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/ometah/ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp
diff -u ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp:1.3 
ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp:1.4
--- ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp:1.3    Fri Jun  3 13:01:07 2005
+++ ometah/problem/CEC05/itsCEC05_SSRPO_Base.cpp        Fri Jun  3 13:16:59 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- * $Id: itsCEC05_SSRPO_Base.cpp,v 1.3 2005/06/03 13:01:07 nojhan Exp $
+ * $Id: itsCEC05_SSRPO_Base.cpp,v 1.4 2005/06/03 13:16:59 nojhan Exp $
  * Author: Johann Dréo <address@hidden>
  ****************************************************************************/
 
@@ -212,3 +212,65 @@
 {
     return new itsWeierstrass();
 }
+
+
+
+
+/*******************************************************************************
+ * Griewank
+ 
******************************************************************************/
+
+
+itsGriewank::itsGriewank()
+{
+    // informations 
+    setName("Griewank");
+    setKey("Griewank");
+    setDescription("");
+    setCitation("Unknown");
+    
setFormula("$\\sum_{i=1}^{D}\\left(\\frac{x_{i}^{2}}{4000}\\right)-{\\displaystyle
 
\\prod_{i=1}^{D}\\left(\\cos\\left(\\frac{x_{i}}{\\sqrt{i}}\\right)+1\\right)}$");
+    
+    setDimension(1); // one dimension is the default, but one may change it 
after instanciation
+    
+    setBoundsMinimaAll(0);
+    setBoundsMaximaAll(600);
+    
+    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 itsGriewank::objectiveFunction(itsPoint point)
+{
+    unsigned int dim = getDimension();
+    vector<double> x=point.getSolution();
+
+    long double s, p;
+    long double res;
+    s = 0.0;
+    p = 1.0;
+    for (unsigned int i=0; i<dim; i++)
+    {
+        s += x[i] * x[i];
+        p *= cos( x[i] / sqrt( 1.0 + i ) );
+    }
+    res = 1.0 + s / 4000.0 - p;
+
+    vector<double> val(1,res);
+    point.setValues(val);
+    
+    return point;
+}
+
+itsProblem * itsGriewankFactory::create()
+{
+    return new itsGriewank();
+}
Index: ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp
diff -u ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp:1.3 
ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp:1.4
--- ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp:1.3    Fri Jun  3 13:01:07 2005
+++ ometah/problem/CEC05/itsCEC05_SSRPO_Base.hpp        Fri Jun  3 13:16:59 2005
@@ -1,5 +1,5 @@
 /***************************************************************************
- * $Id: itsCEC05_SSRPO_Base.hpp,v 1.3 2005/06/03 13:01:07 nojhan Exp $
+ * $Id: itsCEC05_SSRPO_Base.hpp,v 1.4 2005/06/03 13:16:59 nojhan Exp $
  * Author: Johann Dréo <address@hidden>
  ****************************************************************************/
 
@@ -83,4 +83,19 @@
 };
 
 
+/***** Griewank *****/
+
+class itsGriewank : public itsProblem
+{
+public:
+    itsGriewank();
+    itsPoint objectiveFunction(itsPoint point);
+};
+
+class itsGriewankFactory : public itsProblemFactory
+{
+public:
+    itsProblem * create();
+};
+
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]