mirror of
https://gitlab.com/sheaf/metabrush.git
synced 2024-11-05 23:03:38 +00:00
Always run Gauss-Seidel at tiny sizes to rule out fake solutions
This commit is contained in:
parent
0e59d85143
commit
b1df0d04e6
|
@ -250,26 +250,27 @@ defaultRootIsolationAlgorithms
|
||||||
:: forall n d
|
:: forall n d
|
||||||
. BoxCt n d
|
. BoxCt n d
|
||||||
=> Double -> Double -> Box n -> BoxHistory n -> Either String ( NE.NonEmpty ( RootIsolationAlgorithm n d ) )
|
=> Double -> Double -> Box n -> BoxHistory n -> Either String ( NE.NonEmpty ( RootIsolationAlgorithm n d ) )
|
||||||
defaultRootIsolationAlgorithms minWidth ε_eq box history
|
defaultRootIsolationAlgorithms minWidth ε_eq box history =
|
||||||
-- All the box widths are lower than the minimum width: give up.
|
case history of
|
||||||
| and $ ( \ cd -> width cd <= minWidth ) <$> coordinates box
|
|
||||||
= Left $ "widths <= " ++ show minWidth
|
|
||||||
| otherwise
|
|
||||||
= Right $ case history of
|
|
||||||
lastRoundBoxes : _
|
lastRoundBoxes : _
|
||||||
-- If, in the last round of strategies, we didn't try bisection...
|
-- If, in the last round of strategies, we didn't try bisection...
|
||||||
| any ( \case { BisectionStep {} -> False; _ -> True } . fst ) lastRoundBoxes
|
| any ( \case { BisectionStep {} -> False; _ -> True } . fst ) lastRoundBoxes
|
||||||
, ( _step, lastRoundFirstBox ) <- NE.last lastRoundBoxes
|
, ( _step, lastRoundFirstBox ) <- NE.last lastRoundBoxes
|
||||||
-- ...and the last round didn't sufficiently reduce the size of the box...
|
-- ...and the last round didn't sufficiently reduce the size of the box...
|
||||||
, not $ box `sufficientlySmallerThan` lastRoundFirstBox
|
, not $ box `sufficientlySmallerThan` lastRoundFirstBox
|
||||||
-- ...then try bisecting the box.
|
-- ...then try bisecting the box...
|
||||||
-> NE.singleton $ Bisection ( defaultBisectionOptions minWidth ε_eq box )
|
-- ...unless the box is already too small, in which case we give up.
|
||||||
|
-> if verySmall
|
||||||
|
then Left $ "widths <= " ++ show minWidth
|
||||||
|
else Right $ NE.singleton $ Bisection ( defaultBisectionOptions minWidth ε_eq box )
|
||||||
-- Otherwise, do a normal round.
|
-- Otherwise, do a normal round.
|
||||||
-- Currently: we try an interval Gauss–Seidel step followed by box(1)-consistency.
|
-- Currently: we try an interval Gauss–Seidel step followed by box(1)-consistency.
|
||||||
_ -> GaussSeidel _gaussSeidelOptions
|
_ -> Right $ GaussSeidel _gaussSeidelOptions
|
||||||
NE.:| [ Box1 _box1Options ]
|
NE.:| [ Box1 _box1Options | not verySmall ]
|
||||||
|
|
||||||
where
|
where
|
||||||
|
verySmall = and $ ( \ cd -> width cd <= minWidth ) <$> coordinates box
|
||||||
|
|
||||||
_box1Options :: Box1Options n d
|
_box1Options :: Box1Options n d
|
||||||
_box1Options =
|
_box1Options =
|
||||||
Box1Options
|
Box1Options
|
||||||
|
|
Loading…
Reference in a new issue