From: Malcolm R. <mal...@cs...> - 2007-10-12 03:06:51
|
Hi, I'm trying to write a constraint which represents the partitioning of a set into a collection of disjoint subsets. To make sure that the subsets are disjoint, it is useful to keep track of how many subsets have each element in their kernel or envelope. It is more efficient to store this information and update it as we are notified of additions and removals, rather than to scan all the sets on every pass. I have written code which uses a HashMap for this purpose, but it just occured to me that this will not work with backtracking. Is there an appropriate alternative structure which will respond to backtracking appropriately? Thanks, Malcolm -- "If there is one thing worse than the modern weakening of major morals it is the modern strengthening of minor morals. Thus it is considered more withering to accuse a man of bad taste than of bad ethics." -- G.K.Chesterton, On Lying in Bed |