@@ -640,6 +640,7 @@ data FetchFlags = FetchFlags {
640
640
fetchSolver :: Flag PreSolver ,
641
641
fetchMaxBackjumps :: Flag Int ,
642
642
fetchMaxScore :: Flag InstallPlanScore ,
643
+ fetchFindBestSolution :: Flag FindBestSolution ,
643
644
fetchReorderGoals :: Flag ReorderGoals ,
644
645
fetchCountConflicts :: Flag CountConflicts ,
645
646
fetchIndependentGoals :: Flag IndependentGoals ,
@@ -656,6 +657,7 @@ defaultFetchFlags = FetchFlags {
656
657
fetchSolver = Flag defaultSolver,
657
658
fetchMaxBackjumps = Flag defaultMaxBackjumps,
658
659
fetchMaxScore = mempty ,
660
+ fetchFindBestSolution = Flag (FindBestSolution False ),
659
661
fetchReorderGoals = Flag (ReorderGoals False ),
660
662
fetchCountConflicts = Flag (CountConflicts True ),
661
663
fetchIndependentGoals = Flag (IndependentGoals False ),
@@ -704,6 +706,7 @@ fetchCommand = CommandUI {
704
706
optionSolverFlags showOrParseArgs
705
707
fetchMaxBackjumps (\ v flags -> flags { fetchMaxBackjumps = v })
706
708
fetchMaxScore (\ v flags -> flags { fetchMaxScore = v })
709
+ fetchFindBestSolution (\ v flags -> flags { fetchFindBestSolution = v })
707
710
fetchReorderGoals (\ v flags -> flags { fetchReorderGoals = v })
708
711
fetchCountConflicts (\ v flags -> flags { fetchCountConflicts = v })
709
712
fetchIndependentGoals (\ v flags -> flags { fetchIndependentGoals = v })
@@ -723,6 +726,7 @@ data FreezeFlags = FreezeFlags {
723
726
freezeSolver :: Flag PreSolver ,
724
727
freezeMaxBackjumps :: Flag Int ,
725
728
freezeMaxScore :: Flag InstallPlanScore ,
729
+ freezeFindBestSolution :: Flag FindBestSolution ,
726
730
freezeReorderGoals :: Flag ReorderGoals ,
727
731
freezeCountConflicts :: Flag CountConflicts ,
728
732
freezeIndependentGoals :: Flag IndependentGoals ,
@@ -739,6 +743,7 @@ defaultFreezeFlags = FreezeFlags {
739
743
freezeSolver = Flag defaultSolver,
740
744
freezeMaxBackjumps = Flag defaultMaxBackjumps,
741
745
freezeMaxScore = mempty ,
746
+ freezeFindBestSolution = Flag (FindBestSolution False ),
742
747
freezeReorderGoals = Flag (ReorderGoals False ),
743
748
freezeCountConflicts = Flag (CountConflicts True ),
744
749
freezeIndependentGoals = Flag (IndependentGoals False ),
@@ -786,6 +791,7 @@ freezeCommand = CommandUI {
786
791
optionSolverFlags showOrParseArgs
787
792
freezeMaxBackjumps (\ v flags -> flags { freezeMaxBackjumps = v })
788
793
freezeMaxScore (\ v flags -> flags { freezeMaxScore = v })
794
+ freezeFindBestSolution (\ v flags -> flags { freezeFindBestSolution = v })
789
795
freezeReorderGoals (\ v flags -> flags { freezeReorderGoals = v })
790
796
freezeCountConflicts (\ v flags -> flags { freezeCountConflicts = v })
791
797
freezeIndependentGoals (\ v flags -> flags { freezeIndependentGoals = v })
@@ -1190,6 +1196,7 @@ data InstallFlags = InstallFlags {
1190
1196
installDryRun :: Flag Bool ,
1191
1197
installMaxBackjumps :: Flag Int ,
1192
1198
installMaxScore :: Flag InstallPlanScore ,
1199
+ installFindBestSolution :: Flag FindBestSolution ,
1193
1200
installReorderGoals :: Flag ReorderGoals ,
1194
1201
installCountConflicts :: Flag CountConflicts ,
1195
1202
installIndependentGoals :: Flag IndependentGoals ,
@@ -1224,6 +1231,7 @@ defaultInstallFlags = InstallFlags {
1224
1231
installDryRun = Flag False ,
1225
1232
installMaxBackjumps = Flag defaultMaxBackjumps,
1226
1233
installMaxScore = mempty ,
1234
+ installFindBestSolution= Flag (FindBestSolution False ),
1227
1235
installReorderGoals = Flag (ReorderGoals False ),
1228
1236
installCountConflicts = Flag (CountConflicts True ),
1229
1237
installIndependentGoals= Flag (IndependentGoals False ),
@@ -1371,6 +1379,7 @@ installOptions showOrParseArgs =
1371
1379
optionSolverFlags showOrParseArgs
1372
1380
installMaxBackjumps (\ v flags -> flags { installMaxBackjumps = v })
1373
1381
installMaxScore (\ v flags -> flags { installMaxScore = v })
1382
+ installFindBestSolution (\ v flags -> flags { installFindBestSolution = v })
1374
1383
installReorderGoals (\ v flags -> flags { installReorderGoals = v })
1375
1384
installCountConflicts (\ v flags -> flags { installCountConflicts = v })
1376
1385
installIndependentGoals (\ v flags -> flags { installIndependentGoals = v })
@@ -2138,13 +2147,14 @@ optionSolver get set =
2138
2147
optionSolverFlags :: ShowOrParseArgs
2139
2148
-> (flags -> Flag Int ) -> (Flag Int -> flags -> flags )
2140
2149
-> (flags -> Flag InstallPlanScore ) -> (Flag InstallPlanScore -> flags -> flags )
2150
+ -> (flags -> Flag FindBestSolution ) -> (Flag FindBestSolution -> flags -> flags )
2141
2151
-> (flags -> Flag ReorderGoals ) -> (Flag ReorderGoals -> flags -> flags )
2142
2152
-> (flags -> Flag CountConflicts ) -> (Flag CountConflicts -> flags -> flags )
2143
2153
-> (flags -> Flag IndependentGoals ) -> (Flag IndependentGoals -> flags -> flags )
2144
2154
-> (flags -> Flag ShadowPkgs ) -> (Flag ShadowPkgs -> flags -> flags )
2145
2155
-> (flags -> Flag StrongFlags ) -> (Flag StrongFlags -> flags -> flags )
2146
2156
-> [OptionField flags ]
2147
- optionSolverFlags showOrParseArgs getmbj setmbj getms setms getrg setrg getcc setcc _getig _setig getsip setsip getstrfl setstrfl =
2157
+ optionSolverFlags showOrParseArgs getmbj setmbj getms setms getfb setfb getrg setrg getcc setcc _getig _setig getsip setsip getstrfl setstrfl =
2148
2158
[ option [] [" max-backjumps" ]
2149
2159
(" Maximum number of backjumps allowed while solving (default: " ++ show defaultMaxBackjumps ++ " ). Use a negative number to enable unlimited backtracking. Use 0 to disable backtracking completely." )
2150
2160
getmbj setmbj
@@ -2157,6 +2167,11 @@ optionSolverFlags showOrParseArgs getmbj setmbj getms setms getrg setrg getcc se
2157
2167
(reqArg " NUM" (readP_to_E (" Cannot parse number: " ++ )
2158
2168
(fmap toFlag (Parse. readS_to_P reads )))
2159
2169
(map show . flagToList))
2170
+ , option [] [" find-best-solution" ]
2171
+ " Find the best-scoring solution within the backjump limit."
2172
+ (fmap asBool . getfb)
2173
+ (setfb . fmap FindBestSolution )
2174
+ (yesNoOpt showOrParseArgs)
2160
2175
, option [] [" reorder-goals" ]
2161
2176
" Try to reorder goals according to certain heuristics. Slows things down on average, but may make backtracking faster for some packages."
2162
2177
(fmap asBool . getrg)
0 commit comments