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 =
[ ( "ellipse"
, NE.fromList
[ ellipseTestCase opts ("ε=" ++ show narrowAbs)
[ ellipseTestCase opts ("ε_bis=" ++ show ε_bis ++ if doBox1 then "box(1)" else "")
( 0, 1 ) pi
( 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 =
RootIsolationOptions
{ 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 =
RootIsolationOptions
{ rootIsolationAlgorithms = defaultRootIsolationAlgorithms minWidth ε_eq
{ rootIsolationAlgorithms = defaultRootIsolationAlgorithms minWidth ε_eq True
}
where
minWidth = 1e-5
@ -114,10 +114,11 @@ defaultRootIsolationAlgorithms
. BoxCt n d
=> Double -- ^ minimum width of boxes (don't bisect further)
-> Double -- ^ threshold for progress
-> Bool -- ^ do box1
-> BoxHistory n
-> Box n
-> Either String ( NE.NonEmpty ( RootIsolationAlgorithmWithOptions n d ) )
defaultRootIsolationAlgorithms minWidth ε_eq history box =
defaultRootIsolationAlgorithms minWidth ε_eq doBox1 history box =
case history of
lastRoundBoxes : _
-- 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.
-- Currently: we try an interval GaussSeidel step followed by box(1)-consistency.
_ -> Right $ AlgoWithOptions @GaussSeidel _gsOptions
NE.:| [ AlgoWithOptions @Box1 _box1Options | not verySmall ]
NE.:| [ AlgoWithOptions @Box1 _box1Options
| doBox1 && not verySmall ]
where
verySmall = and $ ( \ cd -> width cd <= minWidth ) <$> coordinates box