You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is advantageous to restrict ConvexPolytope and Polytope to have immutable geometry (except for their annotation, i.e., the propositions), so that expensive attributes (e.g., Chebyshev radius and center, envelope, bounding box, etc.) need not be recomputed.
Since there is no particular mechanism to monitor whether an already computed attribute is no more up to date, these objects are in practice already immutable (also: there is no suggested way of altering them, though as of dd707a5A and b are not yet protected).
Therefore we may also consider equipping them with a __hash__ function, though one complication would be that two Polytopes with nearly the same geometry can be created but they would have different __hash__ values associated with them.
The text was updated successfully, but these errors were encountered:
Is there any motivation to make them immutable aside from avoiding usage of out-of-date memoized values?
If not, then I am opposed to this. Something instead that I recommend is to make memoization optional and disabled by default. Then, if someone explicitly enables it, it must be an active decision, and the documentation would have warnings about A and b attributes not being monitored, etc.
Another alternative is to make A and b accessible as object properties and to force memoized values to be cleared whenever they are changed.
The alternative sounds better, it has been implemented in 479e9ce (on branch overhaul). It remains to clear memoized values also for Polytope, when one of its ConvexPolytope objects is modified.
It is advantageous to restrict
ConvexPolytope
andPolytope
to have immutable geometry (except for their annotation, i.e., the propositions), so that expensive attributes (e.g., Chebyshev radius and center, envelope, bounding box, etc.) need not be recomputed.Since there is no particular mechanism to monitor whether an already computed attribute is no more up to date, these objects are in practice already immutable (also: there is no suggested way of altering them, though as of dd707a5
A
andb
are not yet protected).Therefore we may also consider equipping them with a
__hash__
function, though one complication would be that twoPolytopes
with nearly the same geometry can be created but they would have different__hash__
values associated with them.The text was updated successfully, but these errors were encountered: