summaryrefslogtreecommitdiff
path: root/src/generic/problemresolver/choice_set.h
AgeCommit message (Collapse)AuthorFilesLines
2009-07-10Eliminating the use of hash tables to save memory: backed out changeset ↵Daniel Burrows1-152/+127
7c43f786ebba
2009-07-05Reimplement choice_set in terms of boost::unordered_set.Daniel Burrows1-127/+152
There is a cost in memory to this change. But the win in terms of speed is *huge*. How huge? Well, when compiled without optimization, the new code is now 4-5 times faster than the previous code *with* optimization and something like 20-30 times faster than 0.5.2.
2009-06-16Give choice_set both the ability to find choices contained in a particular ↵Daniel Burrows1-3/+89
choice, and to find choices that contain a particular choice.
2009-06-16Fix the documentation of get_containing_choice.Daniel Burrows1-1/+1
2009-06-09Add 3-way comparisons to the resolver layer instead of using operator<.Daniel Burrows1-8/+14
A 3-way comparison is the traditional "return <0, =0, or >0" protocol. The implementation supports compile-time polymorphism to select the most appropriate comparison, defaulting to operator<. This yields a huge improvement in the program run-time, probably because the program compares lots of complex objects, especially things like imm::set objects that build their comparison from sub-comparisons. It would still be good to overload compare3<> on the types used in the aptitude resolver universe -- although the core types are simple enough that the compiler will probably be able to optimize the extra comparisons away (I hope, anyway).
2009-06-06Add support in choice_set for retrieving the choice, if any, that the set ↵Daniel Burrows1-3/+29
contains which is itself contained in the input choice. The choice is unique if it exists because of the structure of choice_set. Overlapping choices that are not identical must install versions of the same package, and there can only be one choice that installs a version of any given package.
2009-06-03Instead of dying with an inscrutable assertion failure when conflicting ↵Daniel Burrows1-1/+5
choices are added to a set, log at ERROR level and try to continue.
2009-04-05Build a tree of resolver steps as the resolver runs.Daniel Burrows1-0/+20
This is in preparation for backpropagating conflict/promotion information, and in fact much of the code for that is already implemented in this commit (just not activated yet). I decided to use integer references into a deque to keep things a little more compact instead of having a huge number of structures on the heap: the resolver is already memory-hungry enough, no need to make things even worse.
2009-03-23Restructure the resolver so that it stores and returns sets of choices using ↵Daniel Burrows1-2/+1
choice_sets, rather than manually storing the different types of choices in the solution object. This has two beneficial effects. First, it should make it a bit easier to add a new choice type, although many parts of the program will still have to be touched. Perhaps more importantly, this provides a cleaner conceptual model of what the resolver does: it finds "choice points" (that is to say, dependencies that need to be solved) and makes choices at them. This commit sneaks in a few optimizations that I came across in the process of rewiring all the resolver logic. The big one is that testing whether a solution violates a user constraint now requires steps proportional to the size of the solution, not to the number of user constraints. (each step is logarithmic in the number of constraints, but that's still a big improvement)
2009-03-09Write an operator-> for choice_set::const_iterator.Daniel Burrows1-0/+5
2009-03-09Add a (very inefficient) iterator on choice sets and a test for it.Daniel Burrows1-0/+73
This will make it a lot easier to port the frontend code to use choice sets, should I decide to move the backend solution to using choice sets. for_each() is efficient, but also a pain to use; when I'm only going to iterate over one small set, it's a lot simpler to have an iterator interface available.
2009-03-09Let choice_set::for_each() short-circuit, just like imm::set::for_each().Daniel Burrows1-4/+9
2009-03-07Implement a clone() method on choice sets, analogous to the clone() on ↵Daniel Burrows1-0/+16
solutions an imm::sets.
2009-03-07Add a routine to look up the version of a package that a choice set installs.Daniel Burrows1-0/+23
Needed to use this in the solution object.
2009-03-03Add a routine that inserts one choice set's values into another choice set.Daniel Burrows1-0/+14
2009-03-03Make choice sets take the *narrowest* element added to them, not the widest.Daniel Burrows1-11/+33
This matters because choice sets are used to store the information that a set of actions has a joint consequence. This means that we only want to store the *narrowest* action added to a set, because to be part of both a more general action and a more specific action, you must be part of the more specific one. (technically, when building the sets that we are looking for joint consequences in (that is, search nodes / solutions), we should take the widest action that's added to them -- but in practice, we never add overlapping actions to one of these sets anyway due to the monotonicity rule (actions only overlap if they touch the same package).
2009-03-01Implement a lame operator< on choice sets.Daniel Burrows1-0/+12
2009-03-01Output {} around choice sets.Daniel Burrows1-0/+2
2009-03-01Write a class that encapsulates the business of storing a set of choices and ↵Daniel Burrows1-0/+280
eliminating overlaps, and write a test case for it.