fit_value
This function calculates the fitness of the i agent.
Input variables
Name | Description | Type |
of_i_value | Object function value of the i agent | Float |
fit_i_value | Fitness value of the i agent | Float |
</table> Output variables {: .label .label-yellow } Name | Description | Type |
fit_i_value | Fitness value of the i agent | Float |
Example 1 {: .label .label-blue } Use the `fit_value` function to generate the fitness of the agent. The objective function value is 1. ```python # Import # pip install metapy-toolbox or pip install --upgrade metapy-toolbox from metapy_toolbox import fit_value # or import * # Data ofI = 1 # Call function fitI = fit_value(ofI) # Output details print(f'fit value i agent when OF = {ofI} is {fitI}') ``` ```bash fit value i agent when OF = 1 is 0.5 ``` Example 2 {: .label .label-blue } Use the `fit_value` function to generate the fitness of the agent. The objective function value is -1. ```python # Import # pip install metapy-toolbox or pip install --upgrade metapy-toolbox from metapy_toolbox import fit_value # or import * # Data ofI = -1 # Call function fitI = fit_value(ofI) # Output details print(f'fit value i agent when OF = {ofI} is {fitI}') ``` ```bash fit value i agent when OF = -1 is 2 ```