summaryrefslogtreecommitdiff
path: root/src/generic/problemresolver/problemresolver.h
AgeCommit message (Collapse)AuthorFilesLines
2012-03-23[curses] Hack to prevent debug messages dumping to the screenDaniel Hartwig1-1/+3
Closes: #651748
2010-05-28Transition from log4cxx to the new logging framework.Daniel Burrows1-21/+23
Hopefully this will eliminate some of the random crashes on exit that people were seeing.
2010-04-21Rename the log4cxx namespace to logging.Daniel Burrows1-11/+11
There are various problems with log4cxx, especially that it seems to be unreliable and leads to random crashes. It might be a good idea to eventually move to a different framework or roll our own. Decreasing the number of explicit dependencies on log4cxx is a good way to do that.
2010-04-11Remove all traces of the nonfunctional "stupid elimination" algorithm.Daniel Burrows1-16/+1
This was part of the initial design of the resolver, but it turned out to be unnecessary in practice, and the problem it tried to solve is actually quite difficult, so I never finished the implementation.
2010-04-09Fix a potential performance problem: the cost of solver sets was being ↵Daniel Burrows1-6/+26
underestimated because the "maximum" cost isn't actually maximal. The algorithm that was at fault started with the highest possible cost and incrementally lower-bounded it with the costs in the solver set, to compute the lower-bound of the whole solver set. That was the idea, anyway. It probably worked right when tiers had exactly two elements and there was a sensibly-defined highest tier. But now that means we start with (MAX, 0, 0, ...) and then lower-bound with, say, (10, 1, 5, 4) to get (10, 0, 0, ...) and, well, you see how that goes. The fix is a bit of a hack but will do what I need here (producing a conflict if there are no solvers and the lower-bound of all the solvers' costs otherwise).
2010-04-09Refactor the problem resolver to move all the checks of whether costs make a ↵Daniel Burrows1-16/+41
solution deferred or discarded into helper functions. The discard helper function existed already but wasn't being used consistently. In addition to making the code cleaner and more readable, this will make it easier to enforce a "ceiling" on solution costs, discarding solutions that go over the ceiling in one or more components.
2010-04-09Terminology change: replace "tier operation" with "cost" everywhere.Daniel Burrows1-386/+387
The only remaining references to tiers are in backwards-compatibility code; the "safety" cost component is composed of several "tiers" whose values can be configured.
2010-04-09Restructure the source tree to move tier_ related code into files whose name ↵Daniel Burrows1-3/+2
is based on "cost" instead.
2010-04-08Yank out the "tier" type and just use operations instead.Daniel Burrows1-91/+60
Although the concept of a "tier" is useful (to distinguish changes in the tier from the things being changed), the actual data type isn't needed. We can just store an operation that computes the tier of a step given a minimal tier. Throwing out tier objects yields several benefits. It makes the code somewhat simpler by reducing the number of complex object types floating around. It will make it easier to clean up the nomenclature by talking about costs instead of tiers. And it will make it easier to impose a "cost ceiling", just by virtue of making the cost-tracking subsystem simpler.
2010-04-08Add support for attaching a cost to unresolved recommends.Daniel Burrows1-3/+8
Not even compiled because I don't seem to have a full development environment installed on this machine yet (oops).
2010-03-12Introduce a new method on the resolver that tests whether a tier should ↵Daniel Burrows1-21/+56
cause a step to be discarded. This is another part of the groundwork for more configurable solution search criteria: the client of the resolver will be able to say that steps in which particular tier components exceed a given level should be discarded; consolidating all the ad-hoc tests into a single routine is the first step to implementing that feature.
2010-03-11Attempt to optimize the resolver by not creating unnecessary intermediate ↵Daniel Burrows1-14/+18
tier operations. This didn't actually make it faster, but I think it does make things a bit clearer.
2010-03-05Overhaul the resolver to distinguish between tiers and changes to tiers; ↵Daniel Burrows1-292/+448
this is the first step towards being able to minimize the number of changes meeting a criterion. The biggest change for this is that the new cost objects (tier operations) are not totally ordered, so various places that used to take a maximum now take a least-upper-bound instead; similarly for minimum and greatest-lower-bound. Still to do: find a sound way to allow the resolver to add together costs instead of upper-bounding them: "this change will force us to remove 10 packages". The new code seems to be a little too slow -- probably it lost some optimizations by accident. It does seem to be correct, though.
2010-02-15Document why we choose between two different algorithms to look for new ↵Daniel Burrows1-0/+14
promotions in a step when we come back to it.
2010-01-23Rewire the rest of the dependency solver to account for the new tier type.Daniel Burrows1-52/+2
Mostly this just removes typedefs from the universe-specific tier types and adds #includes for tier.h. The tier limits object was rewritten somewhat more, to account for the new terminology ("levels") and to make the integers explciitly represent structural levels, not tiers.
2009-11-17Have the resolver ignore unresolved dependencies that were unresolved before ↵Daniel Burrows1-2/+26
the current run of aptitude started. (Closes: #556042) This is done by filtering them out of the initial set of dependencies that the root node is initialized with. NOTE: I still need to convince myself that we can't somehow end up reactivating a dependency that should have been skipped. However, we might really need to legitimately activate it...something to think over, anyway. (I particularly suspect that the weird behavior of Conflicts might be a problem)
2009-07-28Always use make_shared to construct shared pointers.Daniel Burrows1-1/+2
2009-07-15Don't waste time building information about a solver set if nothing would be ↵Daniel Burrows1-10/+33
done with it. If the tier of the solver set is not high enough for us to extract any useful information, there's no point in calculating the reasons for that tier.
2009-07-10Merge with backout.Daniel Burrows1-30/+272
2009-07-10Eliminating the use of hash tables to save memory: backed out changeset ↵Daniel Burrows1-2/+2
7c43f786ebba
2009-07-10Merge backout.Daniel Burrows1-11/+82
2009-07-10Eliminating the use of hash tables to save memory: backed out changeset ↵Daniel Burrows1-60/+45
8ff97afb1605
2009-07-10Eliminating the use of hash tables to save memory: backed out changeset ↵Daniel Burrows1-57/+42
13ac768ed385
2009-07-07Switch the unresolved dep set representation to a boost::unordered_map.Daniel Burrows1-42/+57
2009-07-07When increasing the tier of a solver that's newly deferred, only increase ↵Daniel Burrows1-7/+9
exact matches (including matches to the dependency). Necessary because deferrals due to violating an approval constraint only apply when a version is chosen to solve the same dependency. This is just one other way that approval constraints are wonky. I'm thinking that it might be good on multiple levels to throw them out: they're a bit counterintuitive, they tend to produce unstable results (the set of legal successors can vary depending on which dependency is chosen as the next one to resolve, for instance), and because they mean that deferrals happen on a per-dependency basis, they need a lot of careful code and a lot of extra memory allocation to get right. I'm not sure what would replace them, though.
2009-07-07Fix recompute_step_tier() to correctly compute the tier.Daniel Burrows1-4/+73
It wasn't taking into account the actions themselves, or promotions that only included them. This fixes the big glaring problem with the new code, namely that it was spinning off indefinitely (because depending on the order in which some normally idempotent things were applied, they would trip this bug and miss the fact that a line of reasoning was supposed to be chopped off). There's still one odd problem, where I get different results each time I run it, probably because of some other order dependency.
2009-07-07Fix the sanity-check stuff to account for recent changes to the resolver code.Daniel Burrows1-45/+60
2009-07-07Log the semantic content of deferral/validity expressions rather than object ↵Daniel Burrows1-16/+158
pointers. This should make log files a lot more reproducible.
2009-07-07Add an extra sanity-check that all solvers have the right associated ↵Daniel Burrows1-0/+3
dependencies.
2009-07-06Hopefully fix how the number of deferred steps is counted.Daniel Burrows1-0/+4
2009-07-06Put every step, even deferred ones, into "pending".Daniel Burrows1-2/+1
Necessary for the sake of correctness: otherwise, set_step_tier doesn't know whether a step is "closed" and hence whether it should be put back on the pending list. An alternative would be to have an explicit flag on a step that gets set when it's "closed"; then we could throw deferred steps out of the pending tier entirely, which would be nice and would save a little time.
2009-07-06When recomputing a step tier from scratch, really recompute it from scratch.Daniel Burrows1-1/+7
Two bugs here: it wasn't being set back to the minimum tier, and it was being set directly rather than via set_step_tier().
2009-07-06When modifying a step tier, if it was previously in "pending" and it is a ↵Daniel Burrows1-0/+11
viable candidate (below the deferral tier), clear the "finished" flag. This avoids a problem where if a deferral was retracted after the resolver had run out of solutions, we wouldn't find any more answers.
2009-07-06If we're trying to un-defer a solver that's embedded in a step as an action, ↵Daniel Burrows1-1/+5
call recompute_step_tier() on that step. Necessary since the step might still be waiting to be examined.
2009-07-06Better logging when the resolver needs to retract a deferral.Daniel Burrows1-0/+2
2009-07-05Reimplement choice_set in terms of boost::unordered_set.Daniel Burrows1-2/+2
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-07-05Since choice-set installations hold a reference to the set they contain, we ↵Daniel Burrows1-1/+2
shouldn't pass a temporary there, ever. Turned up with valgrind.
2009-07-01Hide the representation of the solvers set from client code.Daniel Burrows1-24/+23
This is another step towards switching to a more efficient representation.
2009-06-30Switch to boost::flyweight from the custom memoization the resolver was doing.Daniel Burrows1-37/+31
In addition to eliminating that code, this change should make it easier to change the representation of dep_solvers (since I won't have to figure out how to memory-manage whatever-it-is).
2009-06-27Fix the promotion sanity-check to not claim that global promotions apply to ↵Daniel Burrows1-1/+1
a solver. If a solver's tier is below the step's tier, the sanity-check was claiming that the global promotion which had raised the step's tier should also apply to the solver, even if it didn't contain that solver. Fixed by restricting that test to (correctly) only consider promotions containing the solver in question.
2009-06-27When generating successors, make sure that promotions which apply to one ↵Daniel Burrows1-0/+25
child are picked up by the others.
2009-06-25Don't treat it as an error when a solver already exists when it's added.Daniel Burrows1-4/+1
Some dependencies legitimately list a solver twice; we already should handle this gracefully, and it isn't actually a sign of brokenness elsewhere.
2009-06-25Add sanity-checks to problemresolver.h.Daniel Burrows1-2/+171
These are expensive and compiled out by default, but useful for empirically verifying that the resolver isn't going wrong. Right now it is.
2009-06-24When looking for promotions, don't discard maximum-tier promotions.Daniel Burrows1-15/+18
Previously some of these were being thrown away, because the code was keeping promotions that were strictly less than the maximum tier (oops).
2009-06-23Don't consider the current version of a package to be a solver of a dependency.Daniel Burrows1-0/+8
2009-06-23Fix how we determine when choices are deferred.Daniel Burrows1-1/+15
Choices that install a different version of the source of a dependency should cause solvers of that dependency to be deferred.
2009-06-19Manage the closed set using boost::unordered_set.Daniel Burrows1-14/+49
Hopefully this is a bit more scalable.
2009-06-19When a dependency is forced, don't leave the parent step hanging around in ↵Daniel Burrows1-0/+4
the queue. This was causing steps to be processed multiple times.
2009-06-19Tweak another log line for easier parsing.Daniel Burrows1-1/+1
2009-06-18Spit out the number of actions in a step when logging the "Examining" line.Daniel Burrows1-1/+1
Makes it easier to write a much simpler renderer.