Commit 4b318f57 authored by kristenk's avatar kristenk
Browse files

Only prefer goals with 0 or 1 active choices when --reorder-goals is specified.

--reorder-goals previously also preferred goals with two choices, but that had
the effect of preferring all flags, which can have at most two choices.
parent 3b8cdbcb
......@@ -140,19 +140,8 @@ solve sc cinfo idx pkgConfigDB userPrefs userConstraints userGoals =
$ addLinking
$ buildTree idx (independentGoals sc) (S.toList userGoals)
-- Counting conflicts and reordering goals interferes, as both are strategies to
-- change the order of goals.
--
-- We therefore change the strategy based on whether --count-conflicts is set or
-- not:
--
-- - when --count-conflicts is set, we use preferReallyEasyGoalChoices, which
-- prefers (keeps) goals only if the have 0 or 1 enabled choice.
--
-- - when --count-conflicts is not set, we use preferEasyGoalChoices, which
-- (next to preferring goals with 0 or 1 enabled choice)
-- also prefers goals that have 2 enabled choices over goals with more than
-- two enabled choices.
-- When --reorder-goals is set, we use preferReallyEasyGoalChoices, which
-- prefers (keeps) goals only if the have 0 or 1 enabled choice.
--
-- In the past, we furthermore used P.firstGoal to trim down the goal choice nodes
-- to just a single option. This was a way to work around a space leak that was
......@@ -164,9 +153,8 @@ solve sc cinfo idx pkgConfigDB userPrefs userConstraints userGoals =
-- Otherwise, we simply choose the first remaining goal.
--
goalChoiceHeuristics
| asBool (reorderGoals sc) && asBool (countConflicts sc) = P.preferReallyEasyGoalChoices
| asBool (reorderGoals sc) = P.preferEasyGoalChoices
| otherwise = id {- P.firstGoal -}
| asBool (reorderGoals sc) = P.preferReallyEasyGoalChoices
| otherwise = id {- P.firstGoal -}
-- | Dump solver tree to a file (in debugging mode)
--
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment