cobra.sampling.core
===================

.. py:module:: cobra.sampling.core

.. autoapi-nested-parse::

   Provide low-level sampling stepper functions and helpers.



Attributes
----------

.. autoapisummary::

   cobra.sampling.core.logger
   cobra.sampling.core.MAX_TRIES


Functions
---------

.. autoapisummary::

   cobra.sampling.core.step


Module Contents
---------------

.. py:data:: logger

.. py:data:: MAX_TRIES
   :value: 100


.. py:function:: step(sampler: cobra.sampling.hr_sampler.HRSampler, x: numpy.ndarray, delta: numpy.ndarray, fraction: Optional[float] = None, tries: int = 0) -> numpy.ndarray

   Sample a new feasible point from the point `x` in direction `delta`.

   This is the low-level sampling stepper for samplers derived
   from `HRSampler`. Currently, it's used by `ACHRSampler` and
   `OptGPSampler`.

   It's declared outside of the base sampling class to facilitate use of
   multiprocessing.

   :param sampler: The sampler to sample a step for.
   :type sampler: cobra.sampling.HRSampler
   :param x: A point in the sampling region.
   :type x: np.array
   :param delta: The direction to take the step in.
   :type delta: np.array
   :param fraction: A float controlling the part of alpha difference to contribute to
                    the fraction of `delta` (default None). If None, alpha is obtained
                    from a normal distribution.
   :type fraction: float, optional
   :param tries: Total number of tries (default 0).
   :type tries: int, optional

   :returns: The new numpy array obtained after a step of sampling.
   :rtype: np.array

   :raises RuntimeError: If `tries` exceeds `MAX_TRIES`.


