Food Source#

(hivenas.core.abc.food_source)

The FoodSources representing positions on the optimization surface used by the ABC optimizer as desribed in [1]. Can be considered the memory units for Employee and Onlooker Bees

[1] Karaboga, D., & Basturk, B. (2007). A powerful and efficient algorithm for numerical function optimization: artificial bee colony (ABC) algorithm. Journal of global optimization, 39(3), 459-471.

class FoodSource(position=None, fitness=None)[source]#

Bases: object

The FoodSource class encapsulates the position on the optimization surface and its corresponding fitness value + the evaluation time taken (in seconds)

eval_time#

the time taken to evaluate the given position (in seconds)

Type

float

pos#

the string-encoded position on the optimization surface

Type

str

fit#

the fitness corresponding the stored position

Type

float

encode_position()[source]#

Returns an encoded position for use in dicts

Returns

a formatted, whitespace-stripped version of the stored position. Used as the “candidate” in the stored CSV

Return type

str

property fitness#

The fitness attribute getter

Returns

the stored fitness value

Return type

float

property position#

The position attribute getter

Returns

the stored position

Return type

str

property time#

The eval_time attribute getter

Returns

the stored evaluation time value (in seconds)

Return type

float