Coverage for moptipy / operators / bitstrings / __init__.py: 100%

0 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2025-11-24 08:49 +0000

1""" 

2In this package we provide operators for bit strings. 

3 

4- Module :mod:`~moptipy.operators.bitstrings.op0_random` offers a nullary 

5 search operator that samples bit strings of a fixed length in a uniform 

6 random fashion. 

7- Module :mod:`~moptipy.operators.bitstrings.op1_flip1` offers a unary 

8 operator that flips exactly one bit. 

9- Module :mod:`~moptipy.operators.bitstrings.op1_flip_m` offers a unary 

10 operator with step size (see 

11 :class:`~moptipy.api.operators.Op1WithStepSize`). A step size of `0.0` 

12 means that it will flip one bit, a step size of `1.0` means that it flips 

13 all bits. 

14- Module :mod:`~moptipy.operators.bitstrings.op1_m_over_n_flip` flips each 

15 bit with probability `m/n` but ensures that at least one bit is flipped. 

16 This results in a number of bits being flipped being drawn from a Binomial 

17 distribution (and re-drawn if `0` was drawn). 

18- Module :mod:`~moptipy.operators.bitstrings.op2_uniform` offers the binary 

19 uniform crossover operation which copies each bit with probability `0.5` 

20 from the first and with the same probability from the second parent. 

21"""