@@ -682,6 +682,7 @@ data FetchFlags = FetchFlags {
682
682
fetchSolver :: Flag PreSolver ,
683
683
fetchMaxBackjumps :: Flag Int ,
684
684
fetchMaxScore :: Flag InstallPlanScore ,
685
+ fetchFindBestSolution :: Flag FindBestSolution ,
685
686
fetchReorderGoals :: Flag ReorderGoals ,
686
687
fetchCountConflicts :: Flag CountConflicts ,
687
688
fetchIndependentGoals :: Flag IndependentGoals ,
@@ -699,6 +700,7 @@ defaultFetchFlags = FetchFlags {
699
700
fetchSolver = Flag defaultSolver,
700
701
fetchMaxBackjumps = Flag defaultMaxBackjumps,
701
702
fetchMaxScore = mempty ,
703
+ fetchFindBestSolution = Flag (FindBestSolution False ),
702
704
fetchReorderGoals = Flag (ReorderGoals False ),
703
705
fetchCountConflicts = Flag (CountConflicts True ),
704
706
fetchIndependentGoals = Flag (IndependentGoals False ),
@@ -748,6 +750,7 @@ fetchCommand = CommandUI {
748
750
optionSolverFlags showOrParseArgs
749
751
fetchMaxBackjumps (\ v flags -> flags { fetchMaxBackjumps = v })
750
752
fetchMaxScore (\ v flags -> flags { fetchMaxScore = v })
753
+ fetchFindBestSolution (\ v flags -> flags { fetchFindBestSolution = v })
751
754
fetchReorderGoals (\ v flags -> flags { fetchReorderGoals = v })
752
755
fetchCountConflicts (\ v flags -> flags { fetchCountConflicts = v })
753
756
fetchIndependentGoals (\ v flags -> flags { fetchIndependentGoals = v })
@@ -768,6 +771,7 @@ data FreezeFlags = FreezeFlags {
768
771
freezeSolver :: Flag PreSolver ,
769
772
freezeMaxBackjumps :: Flag Int ,
770
773
freezeMaxScore :: Flag InstallPlanScore ,
774
+ freezeFindBestSolution :: Flag FindBestSolution ,
771
775
freezeReorderGoals :: Flag ReorderGoals ,
772
776
freezeCountConflicts :: Flag CountConflicts ,
773
777
freezeIndependentGoals :: Flag IndependentGoals ,
@@ -785,6 +789,7 @@ defaultFreezeFlags = FreezeFlags {
785
789
freezeSolver = Flag defaultSolver,
786
790
freezeMaxBackjumps = Flag defaultMaxBackjumps,
787
791
freezeMaxScore = mempty ,
792
+ freezeFindBestSolution = Flag (FindBestSolution False ),
788
793
freezeReorderGoals = Flag (ReorderGoals False ),
789
794
freezeCountConflicts = Flag (CountConflicts True ),
790
795
freezeIndependentGoals = Flag (IndependentGoals False ),
@@ -837,6 +842,7 @@ freezeCommand = CommandUI {
837
842
optionSolverFlags showOrParseArgs
838
843
freezeMaxBackjumps (\ v flags -> flags { freezeMaxBackjumps = v })
839
844
freezeMaxScore (\ v flags -> flags { freezeMaxScore = v })
845
+ freezeFindBestSolution (\ v flags -> flags { freezeFindBestSolution = v })
840
846
freezeReorderGoals (\ v flags -> flags { freezeReorderGoals = v })
841
847
freezeCountConflicts (\ v flags -> flags { freezeCountConflicts = v })
842
848
freezeIndependentGoals (\ v flags -> flags { freezeIndependentGoals = v })
@@ -1403,6 +1409,7 @@ data InstallFlags = InstallFlags {
1403
1409
installDryRun :: Flag Bool ,
1404
1410
installMaxBackjumps :: Flag Int ,
1405
1411
installMaxScore :: Flag InstallPlanScore ,
1412
+ installFindBestSolution :: Flag FindBestSolution ,
1406
1413
installReorderGoals :: Flag ReorderGoals ,
1407
1414
installCountConflicts :: Flag CountConflicts ,
1408
1415
installIndependentGoals :: Flag IndependentGoals ,
@@ -1447,6 +1454,7 @@ defaultInstallFlags = InstallFlags {
1447
1454
installDryRun = Flag False ,
1448
1455
installMaxBackjumps = Flag defaultMaxBackjumps,
1449
1456
installMaxScore = mempty ,
1457
+ installFindBestSolution= Flag (FindBestSolution False ),
1450
1458
installReorderGoals = Flag (ReorderGoals False ),
1451
1459
installCountConflicts = Flag (CountConflicts True ),
1452
1460
installIndependentGoals= Flag (IndependentGoals False ),
@@ -1597,6 +1605,7 @@ installOptions showOrParseArgs =
1597
1605
optionSolverFlags showOrParseArgs
1598
1606
installMaxBackjumps (\ v flags -> flags { installMaxBackjumps = v })
1599
1607
installMaxScore (\ v flags -> flags { installMaxScore = v })
1608
+ installFindBestSolution (\ v flags -> flags { installFindBestSolution = v })
1600
1609
installReorderGoals (\ v flags -> flags { installReorderGoals = v })
1601
1610
installCountConflicts (\ v flags -> flags { installCountConflicts = v })
1602
1611
installIndependentGoals (\ v flags -> flags { installIndependentGoals = v })
@@ -2384,15 +2393,17 @@ optionSolver get set =
2384
2393
optionSolverFlags :: ShowOrParseArgs
2385
2394
-> (flags -> Flag Int ) -> (Flag Int -> flags -> flags )
2386
2395
-> (flags -> Flag InstallPlanScore ) -> (Flag InstallPlanScore -> flags -> flags )
2396
+ -> (flags -> Flag FindBestSolution ) -> (Flag FindBestSolution -> flags -> flags )
2387
2397
-> (flags -> Flag ReorderGoals ) -> (Flag ReorderGoals -> flags -> flags )
2388
2398
-> (flags -> Flag CountConflicts ) -> (Flag CountConflicts -> flags -> flags )
2389
2399
-> (flags -> Flag IndependentGoals ) -> (Flag IndependentGoals -> flags -> flags )
2390
2400
-> (flags -> Flag ShadowPkgs ) -> (Flag ShadowPkgs -> flags -> flags )
2391
2401
-> (flags -> Flag StrongFlags ) -> (Flag StrongFlags -> flags -> flags )
2392
2402
-> (flags -> Flag AllowBootLibInstalls ) -> (Flag AllowBootLibInstalls -> flags -> flags )
2393
2403
-> [OptionField flags ]
2394
- optionSolverFlags showOrParseArgs getmbj setmbj getms setms getrg setrg getcc setcc _getig _setig
2395
- getsip setsip getstrfl setstrfl getib setib =
2404
+ optionSolverFlags showOrParseArgs getmbj setmbj getms setms getfb setfb
2405
+ getrg setrg getcc setcc _getig _setig getsip setsip
2406
+ getstrfl setstrfl getib setib =
2396
2407
[ option [] [" max-backjumps" ]
2397
2408
(" Maximum number of backjumps allowed while solving (default: " ++ show defaultMaxBackjumps ++ " ). Use a negative number to enable unlimited backtracking. Use 0 to disable backtracking completely." )
2398
2409
getmbj setmbj
@@ -2405,6 +2416,11 @@ optionSolverFlags showOrParseArgs getmbj setmbj getms setms getrg setrg getcc se
2405
2416
(reqArg " NUM" (readP_to_E (" Cannot parse number: " ++ )
2406
2417
(fmap toFlag (Parse. readS_to_P reads )))
2407
2418
(map show . flagToList))
2419
+ , option [] [" find-best-solution" ]
2420
+ " Find the best-scoring solution within the backjump limit."
2421
+ (fmap asBool . getfb)
2422
+ (setfb . fmap FindBestSolution )
2423
+ (yesNoOpt showOrParseArgs)
2408
2424
, option [] [" reorder-goals" ]
2409
2425
" Try to reorder goals according to certain heuristics. Slows things down on average, but may make backtracking faster for some packages."
2410
2426
(fmap asBool . getrg)
0 commit comments