Bench with & without box(1)-consistency algorithm

This commit is contained in:
sheaf 2024-04-24 02:04:13 +02:00
parent 17df43c5d7
commit 6450859e3c
2 changed files with 9 additions and 6 deletions

View file

@ -92,14 +92,15 @@ benchGroups :: [ ( String, NE.NonEmpty TestCase ) ]
benchGroups = benchGroups =
[ ( "ellipse" [ ( "ellipse"
, NE.fromList , NE.fromList
[ ellipseTestCase opts ("ε=" ++ show narrowAbs) [ ellipseTestCase opts ("ε_bis=" ++ show ε_bis ++ if doBox1 then "box(1)" else "")
( 0, 1 ) pi ( 0, 1 ) pi
( defaultStartBoxes [ 0 .. 3 ] ) ( defaultStartBoxes [ 0 .. 3 ] )
| narrowAbs <- [ 5e-2, 1e-6 ] | ε_bis <- [ 1e-6, 5e-6, 1e-5, 5e-5, 1e-4, 5e-4, 1e-4, 5e-4, 1e-3, 5e-3, 1e-2, 5e-2, 0.1, 0.2, 0.3 ]
, doBox1 <- [ False, True ]
, let opts = , let opts =
RootIsolationOptions RootIsolationOptions
{ rootIsolationAlgorithms = { rootIsolationAlgorithms =
defaultRootIsolationAlgorithms minWidth narrowAbs defaultRootIsolationAlgorithms minWidth ε_bis doBox1
} }
] ]
) )

View file

@ -102,7 +102,7 @@ newtype RootIsolationOptions n d
defaultRootIsolationOptions :: BoxCt n d => RootIsolationOptions n d defaultRootIsolationOptions :: BoxCt n d => RootIsolationOptions n d
defaultRootIsolationOptions = defaultRootIsolationOptions =
RootIsolationOptions RootIsolationOptions
{ rootIsolationAlgorithms = defaultRootIsolationAlgorithms minWidth ε_eq { rootIsolationAlgorithms = defaultRootIsolationAlgorithms minWidth ε_eq True
} }
where where
minWidth = 1e-5 minWidth = 1e-5
@ -114,10 +114,11 @@ defaultRootIsolationAlgorithms
. BoxCt n d . BoxCt n d
=> Double -- ^ minimum width of boxes (don't bisect further) => Double -- ^ minimum width of boxes (don't bisect further)
-> Double -- ^ threshold for progress -> Double -- ^ threshold for progress
-> Bool -- ^ do box1
-> BoxHistory n -> BoxHistory n
-> Box n -> Box n
-> Either String ( NE.NonEmpty ( RootIsolationAlgorithmWithOptions n d ) ) -> Either String ( NE.NonEmpty ( RootIsolationAlgorithmWithOptions n d ) )
defaultRootIsolationAlgorithms minWidth ε_eq history box = defaultRootIsolationAlgorithms minWidth ε_eq doBox1 history box =
case history of 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...
@ -133,7 +134,8 @@ defaultRootIsolationAlgorithms minWidth ε_eq history box =
-- Otherwise, do a normal round. -- Otherwise, do a normal round.
-- Currently: we try an interval GaussSeidel step followed by box(1)-consistency. -- Currently: we try an interval GaussSeidel step followed by box(1)-consistency.
_ -> Right $ AlgoWithOptions @GaussSeidel _gsOptions _ -> Right $ AlgoWithOptions @GaussSeidel _gsOptions
NE.:| [ AlgoWithOptions @Box1 _box1Options | not verySmall ] NE.:| [ AlgoWithOptions @Box1 _box1Options
| doBox1 && not verySmall ]
where where
verySmall = and $ ( \ cd -> width cd <= minWidth ) <$> coordinates box verySmall = and $ ( \ cd -> width cd <= minWidth ) <$> coordinates box