def test_differen_seed(): """Different seeds give different random engines.""" ecole.seed(0) random_engine_1 = ecole.spawn_random_engine() ecole.seed(2) random_engine_2 = ecole.spawn_random_engine() assert random_engine_1 != random_engine_2
def test_same_seed(): """Same seed give same random engines.""" ecole.seed(0) random_engine_1 = ecole.spawn_random_engine() ecole.seed(0) random_engine_2 = ecole.spawn_random_engine() assert random_engine_1 == random_engine_2
def __init__(self, observation_function="default", reward_function="default", information_function="default", scip_params=None, **dynamics_kwargs) -> None: self.observation_function = ecole.data.parse( observation_function, self.__DefaultObservationFunction__()) self.reward_function = ecole.data.parse( reward_function, self.__DefaultRewardFunction__()) self.information_function = ecole.data.parse( information_function, self.__DefaultInformationFunction__()) self.scip_params = scip_params if scip_params is not None else {} self.model = None self.dynamics = self.__Dynamics__(**dynamics_kwargs) self.can_transition = False self.random_engine = ecole.spawn_random_engine()
def __init__(self, observation_function="default", reward_function="default", information_function="default", scip_params=None, **dynamics_kwargs) -> None: """Create a new environment object. Parameters ---------- observation_function: An object of type :py:class:`~ecole.observation.ObservationFunction` used to custotize what observation are returned in :meth:`reset` and :meth:`step`. reward_function: An object of type :py:class:`~ecole.reward.RewardFunction` used to customize what reward are returned in :meth:`reset` and :meth:`step`. information_function: An object of type :py:class:`~ecole.information.InformationFunction` used to customize what additional information are returned in :meth:`reset` and :meth:`step`. scip_params: Parameters set on the underlying :py:class:`~ecole.scip.Model` on every episode. **dynamics_kwargs: Other arguments are passed to the constructor of the :py:class:`~ecole.typing.Dynamics`. """ self.observation_function = ecole.data.parse( observation_function, self.__DefaultObservationFunction__()) self.reward_function = ecole.data.parse( reward_function, self.__DefaultRewardFunction__()) self.information_function = ecole.data.parse( information_function, self.__DefaultInformationFunction__()) self.scip_params = scip_params if scip_params is not None else {} self.model = None self.dynamics = self.__Dynamics__(**dynamics_kwargs) self.can_transition = False self.random_engine = ecole.spawn_random_engine()
def test_spawn_engine(): """Successive random engines are different""" random_engine_1 = ecole.spawn_random_engine() random_engine_2 = ecole.spawn_random_engine() assert random_engine_1 != random_engine_2