Skip to content
Snippets Groups Projects
Commit afeb48f1 authored by Edsko de Vries's avatar Edsko de Vries
Browse files

Add "defer setup choices" heuristic.

By chosing setup dependencies after regular dependencies we get more
opportunities for linking setup dependencies against regular dependencies.
parent d78cfecc
No related branches found
No related tags found
No related merge requests found
......@@ -259,6 +259,19 @@ preferBaseGoalChoice = trav go
preferBase _ (OpenGoal (Simple (Dep (Q _pp pn) _) _) _) | unPN pn == "base" = GT
preferBase _ _ = EQ
-- | Deal with setup dependencies after regular dependencies, so that we can
-- will link setup depencencies against package dependencies when possible
deferSetupChoices :: Tree a -> Tree a
deferSetupChoices = trav go
where
go (GoalChoiceF xs) = GoalChoiceF (P.sortByKeys deferSetup xs)
go x = x
deferSetup :: OpenGoal comp -> OpenGoal comp -> Ordering
deferSetup (OpenGoal (Simple (Dep (Q (Setup _ _) _) _) _) _) _ = GT
deferSetup _ (OpenGoal (Simple (Dep (Q (Setup _ _) _) _) _) _) = LT
deferSetup _ _ = EQ
-- | Transformation that sorts choice nodes so that
-- child nodes with a small branching degree are preferred. As a
-- special case, choices with 0 branches will be preferred (as they
......
......@@ -42,6 +42,7 @@ solve sc idx userPrefs userConstraints userGoals =
where
explorePhase = exploreTreeLog . backjump
heuristicsPhase = P.firstGoal . -- after doing goal-choice heuristics, commit to the first choice (saves space)
P.deferSetupChoices .
P.deferWeakFlagChoices .
P.preferBaseGoalChoice .
P.preferLinked .
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment