class iwopy.core.Memory[source]

Storage for function results.

Attributes

max_size: int

The number of maximally stored results

data: dict

The stored data. Key: keyf return type, Values: tuples (objs, cons)

keyf: Function

The memory key function. Parameters: (vars_int, vars_float), returns key Object

Public members

Memory(size, keyf=None)[source]

Constructor

clear()[source]

Clears the memory

property size

The number of elements currently stored in memory

found_individual(vars_int, vars_float)[source]

Check if entry is found in memory.

found_population(vars_int, vars_float)[source]

Check if entry is found in memory.

store_individual(vars_int, vars_float, objs, cons)[source]

Store objs and cons data.

store_population(vars_int, vars_float, objs, cons)[source]

Store objs and cons data of a population.

lookup_individual(vars_int, vars_float)[source]

Lookup results from memory.

lookup_population(vars_int, vars_float, target=None)[source]

Lookup results from memory.