Algorithm Optimisation Championship. - page 132

 

And, actually, an example of a member library. Working optimization algorithm, based on RNG. It is quite good (for RNG) for search maximum for functions with parameters of 1...5 (maybe more, no restrictions in code, but the results will be disappointing). It's not good for the championship, but it'll do for example:

#property library
#property strict

//+------------------------------------------------------------------+
// тестовая фитнес функция чемпионата, не известна участникам
#import "ff.ex5"
int    GetParamCount (); 
void   GetParamProperties (double &min, double &max, double &step); 
int    GetCountRunsFF (); 
double FF (double &array []); 
#import
//+------------------------------------------------------------------+


///////////////////////////////////////////////////////////////////////////////| 
//  Здесь список экспортируемых функций библиотеки оптимизации, которые
//обязаны объявлены именно так как показано ниже, для того, что проверочный скрипт
//мог корректно обратится к библиотеке, содержимое этих функций на усмотрение
//участников 
/* 
//+------------------------------------------------------------------+
// алгоритм оптимизации участника
#import "ao.ex5"
// инициализация АО
void   InitAO (int paramCount, int maxFFruns);
// запуск АО 
void   StartAlgo (); 
// получить максимальное значение ФФ       
double GetMaxFF (); 
#import
//+------------------------------------------------------------------+
*/

//+------------------------------------------------------------------+
void InitAO (int paramCount, int maxFFruns) export
{ 
  G_MaxFFruns  = maxFFruns; 
  G_ParamCount = paramCount; // можно и так: G_ParamCount = GetParamCount ();
  GetParamProperties (G_MinParam, G_MaxParam, G_StepParam);
}
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
void StartAlgo () export
{ 
  bool   stopAlgo = false; 
  int    ffRuns   = 0; 
  double temp     = 0.0; 
  double param []; 
  ArrayResize (param, G_ParamCount); 
  
  //------------------------------------------------------------------
  while(!stopAlgo) 
  {
    GetOptParam (param); 
    temp = FF (param); 
    
    if(temp > G_BestResult) 
    {
      G_BestResult = temp; 
      Comment (G_BestResult);
    } 

    ffRuns++; 
    
    if(ffRuns == G_MaxFFruns) 
      stopAlgo = true; 
  }
  //-----------------------------------------------------------------
}
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
double GetMaxFF () export
{ 
  return (G_BestResult);
}
//+------------------------------------------------------------------+
///////////////////////////////////////////////////////////////////////////////| 


///////////////////////////////////////////////////////////////////////////////|
// Ниже - функции участников, объявление и содержимое на их усмотрение 

int    G_MaxFFruns  = 0; 
double G_BestResult = -DBL_MAX; 
int    G_ParamCount = 0; 
double G_MinParam   = -DBL_MAX; 
double G_MaxParam   = DBL_MAX; 
double G_StepParam  = 0.0; 

//+------------------------------------------------------------------+
void GetOptParam (double &param []) 
{ 
  int size = ArraySize (param); 
  for(int i = 0; i < size; i++) 
    param [i] = SeInDiSp (RNDfromCI (G_MinParam, G_MaxParam), 
                          G_MinParam, 
                          G_MaxParam, 
                          G_StepParam);
}
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
double SeInDiSp (double in, double inMin, double inMax, double step) 
{ 
  if(in <= inMin) 
    return (inMin); 
  if(in >= inMax) 
    return (inMax); 
  if(step == 0.0) 
    return (in); 
  else 
    return (inMin + step * (double)MathRound ((in - inMin) / step));
}
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
double RNDfromCI (double min, double max) 
{ 
  if(min == max) 
    return (min); 
  double Min, Max; 
  if(min > max) 
  {
    Min = max; 
    Max = min;
  }
  else 
  {
    Min = min; 
    Max = max;
  }
  return (double(Min + ((Max - Min) * (double)MathRand () / 32767.0)));
}
//+------------------------------------------------------------------+
 

The average result of the HSS for the FF from the example above is -3.9699791274683918.

Made 5 runs of the script with parameter 1000 FF calls.

Compile examples and check. In place of the testao.ex5 on the champ will be your library.

Reminder:

At the championship the script will remain the same without any changes, the contents of the FF in ff.ex5 will be different, and the competitor library should be ao.ex5, it can be seen by the declared imported functions.

If it becomes necessary to add exported functions to the participant library, there will be an advance notice of this. At this point all script codes and required interfaces are shown (once again), get ready.

 
Andrey Dik:

The average result of the HSS for the FF from the example above is -3.9699791274683918.

Made 5 runs of the script with parameter 1000 FF calls.

Compile examples and check. In place of the testao.ex5 on the champ will be your library.

Reminder:

At the championship the script will remain the same without any changes, the contents of FF in ff.ex5 will be different, and the competitor library should be ao.ex5, it can be seen by the declared imported functions.

If it becomes necessary to add exported functions to the participant library, there will be an advance notice of this. At this point all script codes and required interfaces are shown (once again), get ready.

H The interface works. Transferred the above three codes to fives.

1. called the executable script as Ch Script.

2. the library of the fitness function is named ff. That is how it should be called. The script will not see it otherwise.

3. The library of the example algorithm is named ao. The library should be named like that. Otherwise the script will not see it.

I ran the script on the chart. Before that, I changed the fitness function in the library to double ffVolue = 2+exp(-MathAbs(x1+x2+x3)); the real maximum is three. Got it.


As I understand it, I need to rewrite my algorithm in the format of the example algorithm, rename my functions in the code to the names that are in the example and check that they work.

There is no need to study the connection interface and the given example FF.

Files:
ff.mq5  2 kb
ao.mq5  5 kb
 
Yuri Evseenkov:

H The interface works. Transferred these three codes to the 5.

1. named the executable script as Ch Script.

2. the library of the fitness function is named ff. That is how it should be called. The script will not see it otherwise.

3. The library of the example algorithm is named ao. The library should be named like that. Otherwise the script will not see it.

I ran the script on the chart. Before that, I changed the fitness function in the library to double ffVolue = 2+exp(-MathAbs(x1+x2+x3)); the real maximum is three. Got it.


As I understand it, I need to rewrite my algorithm in the format of the example algorithm, rename my functions in the code to the names that are in the example and check that they work.

There is no need to study the connection interface and the given example FF.

Great! You have done everything correctly.

Just a little correction in the highlighted: in the participant's algorithm,you need to ensure that you declare (exactly as in the example) the mandatory exportable functions, the contents of those exportable functions and the presence of other custom ones are at the participant's discretion .That's what it says in the comments.

It's simple, isn't it? ))

 
Oh, and yes... The examples will work in MT4 as well. Haven't checked, but there's nothing in there that wouldn't work in MT4. That's what I said for those who are allergic (or emtapathobic) to MT5, the championship is open to them too.
 
Andrey Dik:
Oh, and yes... The examples will work in MT4 too. I didn't check it, but there's nothing that may not work in MT4. That's what I said for those who are allergic (or emtapy afraid) to MT5, championship is open for them too.

To make it work in foursquare, replace #import "ff.ex5" and #import "ao.ex5" with #import "ff.ex4" and #import "ao.ex4" in the executable script and in the example member algorithm.

You can also write in 4 . For example, when I compiled MQL4 code in MQL5, there was only one error. I changed TRUE to true or one and it worked. I should just write it as shown in the example. I haven't fixed my own code yet. I'll give it a try.


Files:
Ch_script.mq4  2 kb
ff.mq4  2 kb
ao.mq4  5 kb
 

Good afternoon!

I'm preparing a platform (website) dedicated to optimization algorithms, where there will be contests, useful information and many other interesting and useful things.

Everyone will be able to test their strength in writing algorithms and test them against other participants. Participant will not need to send the algorithm to the server, all interaction with the FF, located on the server, occurs via REST, the participant sends a set of arguments to the server, and gets the result back FF, no referee is required as everything is extremely transparent, while remaining secret to the participants algorithms.

Stay tuned!

 
Andrey Dik:

...

Wait for news!

Waiting


 
Andrey Dik:

Good afternoon!

I'm preparing a platform (website) dedicated to optimization algorithms, where there will be contests, useful information and many other interesting and useful things.

Everyone will be able to test their strength in writing algorithms and test them against other participants. Participant will not need to send the algorithm to the server, all interaction with the FF, located on the server, occurs via REST, the participant sends a set of arguments to the server, and gets the result back FF, no referee is required as everything is extremely transparent, while remaining secret to the participants algorithms.

Wait for news!

Interesting!

Don't listen to forum advisers and critics, do what you think up, or else nothing will work ))

 
Andrey F. Zelinsky:

Waiting

Sergey Chalyshev:

Interesting!

Just don't listen to forum counsellors and critics, do what you want or it won't work again ))

Thank you!)

Reason: