Commit 719c0a4d authored by Hans-Peter Deifel's avatar Hans-Peter Deifel 🐢

wta: Don't generate zero edges when we decided not to

This is currently only implemented for the case where --different-values is
supplied.

When the random experiment says that we should generate non-zero edge, we should
rule out the possibility that this edge gets assigned a random weight of zero.
With small --different-values, zero edges would have become way more likely.
parent a2c3b0e2
...@@ -32,9 +32,9 @@ genMonoidValue = asks ((monoid . spec) &&& differentValues) >>= \case ...@@ -32,9 +32,9 @@ genMonoidValue = asks ((monoid . spec) &&& differentValues) >>= \case
(Powerset, Nothing) -> liftIO $ randomIO (Powerset, Nothing) -> liftIO $ randomIO
(Powerset, _) -> error $ "differentValues not supported for powerset" -- FIXME detect this early (and handle the case <=2) (Powerset, _) -> error $ "differentValues not supported for powerset" -- FIXME detect this early (and handle the case <=2)
(OrWord, Nothing) -> liftIO $ randomIO (OrWord, Nothing) -> liftIO $ randomIO
(OrWord, Just x) -> liftIO $ randomRIO (0, fromIntegral (x-1)) (OrWord, Just x) -> liftIO $ randomRIO (1, fromIntegral x)
(MaxInt, Nothing) -> liftIO $ randomIO (MaxInt, Nothing) -> liftIO $ randomIO
(MaxInt, Just x) -> liftIO $ randomRIO (0, x-1) (MaxInt, Just x) -> liftIO $ randomRIO (1, x)
genStates :: Generator m (Vector m) genStates :: Generator m (Vector m)
genStates = do genStates = do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment