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