Gurobi relies on a pseudorandom number generator (PNRG) to allow for behavior which is both random and deterministic.

A PRNG is an algorithm designed to produce a sequence of numbers that approximates the properties of a random sequence of numbers. Unlike truly random numbers, which are derived from unpredictable physical processes, pseudorandom numbers are generated by a deterministic process. Despite their deterministic nature, well-designed PRNGs produce sequences of numbers that appear random for most practical purposes. Due to determinism the sequence of numbers can be reproduced, if the initial state of the PRNG is known, and the initial state is dependent on a single number known as the seed. If you have used random numbers when coding then you will have used a PRNG. If you did not explicitly set a seed value then a default will be used. The seed value for the PNRG used by Gurobi can be queried and changed through our Seed parameter.

*Demonstrating PRNG and the effect of seed values using numpy:*

>> import numpy as np

>> np.random.seed(42) # seed numpy's PRNG with a value of 42

>> print(np.random.random(5))

[0.37454012 0.95071431 0.73199394 0.59865848 0.15601864]

>> np.random.seed(2) # seed numpy's PRNG with a value of 2

>> print(np.random.random(5))

[0.4359949 0.02592623 0.54966248 0.43532239 0.4203678 ]

>> np.random.seed(42) # seed numpy's PRNG with a value of 42 (again)

>> print(np.random.random(5))

[0.37454012 0.95071431 0.73199394 0.59865848 0.15601864]

### Further information

## Comments

0 comments

Article is closed for comments.