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

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
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -32,9 +32,9 @@ genMonoidValue = asks ((monoid . spec) &&& differentValues) >>= \case
  (Powerset, Nothing) -> liftIO $ randomIO
  (Powerset, _) -> error $ "differentValues not supported for powerset" -- FIXME detect this early (and handle the case <=2)
  (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, Just x)   -> liftIO $ randomRIO (0, x-1)
  (MaxInt, Just x)   -> liftIO $ randomRIO (1, x)

genStates :: Generator m (Vector m)
genStates = do