@@ -607,6 +607,7 @@ data FetchFlags = FetchFlags {
607
607
fetchSolver :: Flag PreSolver ,
608
608
fetchMaxBackjumps :: Flag Int ,
609
609
fetchMaxScore :: Flag InstallPlanScore ,
610
+ fetchFindBestSolution :: Flag FindBestSolution ,
610
611
fetchReorderGoals :: Flag ReorderGoals ,
611
612
fetchCountConflicts :: Flag CountConflicts ,
612
613
fetchIndependentGoals :: Flag IndependentGoals ,
@@ -623,6 +624,7 @@ defaultFetchFlags = FetchFlags {
623
624
fetchSolver = Flag defaultSolver,
624
625
fetchMaxBackjumps = Flag defaultMaxBackjumps,
625
626
fetchMaxScore = mempty ,
627
+ fetchFindBestSolution = Flag (FindBestSolution False ),
626
628
fetchReorderGoals = Flag (ReorderGoals False ),
627
629
fetchCountConflicts = Flag (CountConflicts True ),
628
630
fetchIndependentGoals = Flag (IndependentGoals False ),
@@ -671,6 +673,7 @@ fetchCommand = CommandUI {
671
673
optionSolverFlags showOrParseArgs
672
674
fetchMaxBackjumps (\ v flags -> flags { fetchMaxBackjumps = v })
673
675
fetchMaxScore (\ v flags -> flags { fetchMaxScore = v })
676
+ fetchFindBestSolution (\ v flags -> flags { fetchFindBestSolution = v })
674
677
fetchReorderGoals (\ v flags -> flags { fetchReorderGoals = v })
675
678
fetchCountConflicts (\ v flags -> flags { fetchCountConflicts = v })
676
679
fetchIndependentGoals (\ v flags -> flags { fetchIndependentGoals = v })
@@ -690,6 +693,7 @@ data FreezeFlags = FreezeFlags {
690
693
freezeSolver :: Flag PreSolver ,
691
694
freezeMaxBackjumps :: Flag Int ,
692
695
freezeMaxScore :: Flag InstallPlanScore ,
696
+ freezeFindBestSolution :: Flag FindBestSolution ,
693
697
freezeReorderGoals :: Flag ReorderGoals ,
694
698
freezeCountConflicts :: Flag CountConflicts ,
695
699
freezeIndependentGoals :: Flag IndependentGoals ,
@@ -706,6 +710,7 @@ defaultFreezeFlags = FreezeFlags {
706
710
freezeSolver = Flag defaultSolver,
707
711
freezeMaxBackjumps = Flag defaultMaxBackjumps,
708
712
freezeMaxScore = mempty ,
713
+ freezeFindBestSolution = Flag (FindBestSolution False ),
709
714
freezeReorderGoals = Flag (ReorderGoals False ),
710
715
freezeCountConflicts = Flag (CountConflicts True ),
711
716
freezeIndependentGoals = Flag (IndependentGoals False ),
@@ -753,6 +758,7 @@ freezeCommand = CommandUI {
753
758
optionSolverFlags showOrParseArgs
754
759
freezeMaxBackjumps (\ v flags -> flags { freezeMaxBackjumps = v })
755
760
freezeMaxScore (\ v flags -> flags { freezeMaxScore = v })
761
+ freezeFindBestSolution (\ v flags -> flags { freezeFindBestSolution = v })
756
762
freezeReorderGoals (\ v flags -> flags { freezeReorderGoals = v })
757
763
freezeCountConflicts (\ v flags -> flags { freezeCountConflicts = v })
758
764
freezeIndependentGoals (\ v flags -> flags { freezeIndependentGoals = v })
@@ -1157,6 +1163,7 @@ data InstallFlags = InstallFlags {
1157
1163
installDryRun :: Flag Bool ,
1158
1164
installMaxBackjumps :: Flag Int ,
1159
1165
installMaxScore :: Flag InstallPlanScore ,
1166
+ installFindBestSolution :: Flag FindBestSolution ,
1160
1167
installReorderGoals :: Flag ReorderGoals ,
1161
1168
installCountConflicts :: Flag CountConflicts ,
1162
1169
installIndependentGoals :: Flag IndependentGoals ,
@@ -1191,6 +1198,7 @@ defaultInstallFlags = InstallFlags {
1191
1198
installDryRun = Flag False ,
1192
1199
installMaxBackjumps = Flag defaultMaxBackjumps,
1193
1200
installMaxScore = mempty ,
1201
+ installFindBestSolution= Flag (FindBestSolution False ),
1194
1202
installReorderGoals = Flag (ReorderGoals False ),
1195
1203
installCountConflicts = Flag (CountConflicts True ),
1196
1204
installIndependentGoals= Flag (IndependentGoals False ),
@@ -1338,6 +1346,7 @@ installOptions showOrParseArgs =
1338
1346
optionSolverFlags showOrParseArgs
1339
1347
installMaxBackjumps (\ v flags -> flags { installMaxBackjumps = v })
1340
1348
installMaxScore (\ v flags -> flags { installMaxScore = v })
1349
+ installFindBestSolution (\ v flags -> flags { installFindBestSolution = v })
1341
1350
installReorderGoals (\ v flags -> flags { installReorderGoals = v })
1342
1351
installCountConflicts (\ v flags -> flags { installCountConflicts = v })
1343
1352
installIndependentGoals (\ v flags -> flags { installIndependentGoals = v })
@@ -2105,13 +2114,14 @@ optionSolver get set =
2105
2114
optionSolverFlags :: ShowOrParseArgs
2106
2115
-> (flags -> Flag Int ) -> (Flag Int -> flags -> flags )
2107
2116
-> (flags -> Flag InstallPlanScore ) -> (Flag InstallPlanScore -> flags -> flags )
2117
+ -> (flags -> Flag FindBestSolution ) -> (Flag FindBestSolution -> flags -> flags )
2108
2118
-> (flags -> Flag ReorderGoals ) -> (Flag ReorderGoals -> flags -> flags )
2109
2119
-> (flags -> Flag CountConflicts ) -> (Flag CountConflicts -> flags -> flags )
2110
2120
-> (flags -> Flag IndependentGoals ) -> (Flag IndependentGoals -> flags -> flags )
2111
2121
-> (flags -> Flag ShadowPkgs ) -> (Flag ShadowPkgs -> flags -> flags )
2112
2122
-> (flags -> Flag StrongFlags ) -> (Flag StrongFlags -> flags -> flags )
2113
2123
-> [OptionField flags ]
2114
- optionSolverFlags showOrParseArgs getmbj setmbj getms setms getrg setrg getcc setcc _getig _setig getsip setsip getstrfl setstrfl =
2124
+ optionSolverFlags showOrParseArgs getmbj setmbj getms setms getfb setfb getrg setrg getcc setcc _getig _setig getsip setsip getstrfl setstrfl =
2115
2125
[ option [] [" max-backjumps" ]
2116
2126
(" Maximum number of backjumps allowed while solving (default: " ++ show defaultMaxBackjumps ++ " ). Use a negative number to enable unlimited backtracking. Use 0 to disable backtracking completely." )
2117
2127
getmbj setmbj
@@ -2124,6 +2134,11 @@ optionSolverFlags showOrParseArgs getmbj setmbj getms setms getrg setrg getcc se
2124
2134
(reqArg " NUM" (readP_to_E (" Cannot parse number: " ++ )
2125
2135
(fmap toFlag (Parse. readS_to_P reads )))
2126
2136
(map show . flagToList))
2137
+ , option [] [" find-best-solution" ]
2138
+ " Find the best-scoring solution within the backjump limit."
2139
+ (fmap asBool . getfb)
2140
+ (setfb . fmap FindBestSolution )
2141
+ (yesNoOpt showOrParseArgs)
2127
2142
, option [] [" reorder-goals" ]
2128
2143
" Try to reorder goals according to certain heuristics. Slows things down on average, but may make backtracking faster for some packages."
2129
2144
(fmap asBool . getrg)
0 commit comments