4.2. pyopus.optimizer.cache — Caching of function and constraint values, and annotations

Inheritance diagram of pyopus.optimizer.cache

Point caching (PyOPUS subsystem name: CACHE)

class pyopus.optimizer.cache.Cache

Cache for storing points. The point is the key. Every point has an object associated with it.

getHits()

Returns cache hit count.

insert(point, value)

Inserts an object value for point point.

Returns True if a point in the cache is replaced.

lookup(point)

Looks up a point and returns the associated object.

Returns None if the point is not in the cache.

Increases hit count if the point is found in the cache.

remove(point)

Removes a point from the cache.

Returns True if a point is found and removed.

reset()

Clears cache and resets hit count.

class pyopus.optimizer.cache.HashableWrapper(arr, copy=True)

Constructs a hashable wrapper arounf a numpy array. If copy is True a copy of the array is stored and returned.

array()

Returns the original array. Returns a copy if copy is True.