Memory Solution Cache
A memory-based cache to hold solutions. A simplified cache to avoid including more advanced caches in the dependency tree. This cache holds solutions in a map based on (RequestData, Solution) pairs. The cache is capacity constrained to the specified capacity. The user can supply an eviction rule that will identify a solution to evict when the capacity is reached. If no eviction rule is supplied, then by default the algorithm removes the first solution that is deterministically infeasible, infinite, or undefined in some manner. Then, it will identify the oldest solution with the largest penalized objective function for removal.
Parameters
the maximum permitted size of the cache
if true, the input infeasible solutions are allowed to be saved in the cache. If false, input-infeasible solutions are silently ignored. The default is false (do not allow input infeasible solutions to be saved)
Properties
If true, the cache will allow lookups of solutions based on the input settings. If false, the cache will not allow lookups of solutions based on the input settings. The default is true (allow cache lookups)
If true, the cache will allow puts of solutions based on the input settings. If false, the cache will not allow puts of solutions based on the input settings. The default is true (allow cache puts)
A rule to govern which solution should be evicted when the cache capacity is met.
Functions
By default, the eviction candidate will be:
Places the solution into the cache. It is important that implementors handle the insertion of infeasible inputs and ensure that the input map is associated with the solution
Looks up and removes the solution associated with the supplied input map. Null is returned if there is no associated solution. It is important that implementors handle the reduced size relative to the cache.