mirror of
https://gitlab.com/sheaf/metabrush.git
synced 2024-11-05 14:53:37 +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
|
lastRoundBoxes : _
|
||||||
= Left $ "widths <= " ++ show minWidth
|
-- If, in the last round of strategies, we didn't try bisection...
|
||||||
| otherwise
|
| any ( \case { BisectionStep {} -> False; _ -> True } . fst ) lastRoundBoxes
|
||||||
= Right $ case history of
|
, ( _step, lastRoundFirstBox ) <- NE.last lastRoundBoxes
|
||||||
lastRoundBoxes : _
|
-- ...and the last round didn't sufficiently reduce the size of the box...
|
||||||
-- If, in the last round of strategies, we didn't try bisection...
|
, not $ box `sufficientlySmallerThan` lastRoundFirstBox
|
||||||
| any ( \case { BisectionStep {} -> False; _ -> True } . fst ) lastRoundBoxes
|
-- ...then try bisecting the box...
|
||||||
, ( _step, lastRoundFirstBox ) <- NE.last lastRoundBoxes
|
-- ...unless the box is already too small, in which case we give up.
|
||||||
-- ...and the last round didn't sufficiently reduce the size of the box...
|
-> if verySmall
|
||||||
, not $ box `sufficientlySmallerThan` lastRoundFirstBox
|
then Left $ "widths <= " ++ show minWidth
|
||||||
-- ...then try bisecting the box.
|
else Right $ NE.singleton $ Bisection ( defaultBisectionOptions minWidth ε_eq box )
|
||||||
-> 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.
|
_ -> Right $ GaussSeidel _gaussSeidelOptions
|
||||||
_ -> GaussSeidel _gaussSeidelOptions
|
NE.:| [ Box1 _box1Options | not verySmall ]
|
||||||
NE.:| [ Box1 _box1Options ]
|
|
||||||
|
|
||||||
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