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[source]

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


Returns cache hit count.

insert(point, value)[source]

Inserts an object value for point point.

Returns True if a point in the cache is replaced.


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.


Removes a point from the cache.

Returns True if a point is found and removed.


Clears cache and resets hit count.

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

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


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