USE(3)
USE(3)
AbEC - Fitness Function
<< >>
< [ Home ] < 1. [ Use ] > 2. [ Configuration files ] > 3. [ Fitness function ] > 4. [ Running ] > 5. [ Results ] > 6. [ Example ] > 7. [ Adding new components ]
[~]$ Fitness Function
If you selected "CUSTOM" in the parameter "BENCHMARK" of the problemConfig.ini, that means that you want to define your own fitness function and not use a benchmark.

> function.py

To define the fitness function, you need to create a file that will evaluate the solutions of your algorithm (i.e. "function.py") in the same directory of the configuration files, and put this name in the parameter "FUNCTION" of the problemConfig.ini. This file should contain a python method named function(x) where the argument x is a list with "NDIM" dimensions and represent a solution to be evaluated.


The following command create and open the file:

$ nano function.py



Then, we define the function inside the file, like this:

def function(x):

Be free to use this framework.
AbEC © 2023.