(problem: Dict, N: int, num_levels: int = 4,
           optimal_trajectories: int = None, local_optimization: bool = True,
           seed: int = None)
return sample_morris
Generate model inputs using the Method of Morris

    Returns a NumPy matrix containing the model inputs required for Method of
    Morris.  The resulting matrix has :math:`(G+1)*T` rows and :math:`D`
    columns, where :math:`D` is the number of parameters, :math:`G` is the
    number of groups (if no groups are selected, the number of parameters).
    :math:`T` is the number of trajectories :math:`N`,
    or `optimal_trajectories` if selected.
    These model inputs  are intended to be used with
    :func:`SALib.analyze.morris.analyze`.

    Parameters
    ----------
    problem : dict
        The problem definition
    N : int
        The number of trajectories to generate
    num_levels : int, default=4
        The number of grid levels (should be even)
    optimal_trajectories : int
        The number of optimal trajectories to sample (between 2 and N)
    local_optimization : bool, default=True
        Flag whether to use local optimization according to Ruano et al. (2012)
        Speeds up the process tremendously for bigger N and num_levels.
        If set to ``False`` brute force method is used, unless ``gurobipy`` is
        available
    seed : int
        Seed to generate a random number

    Returns
    -------
    sample_morris : numpy.ndarray
        Returns a numpy.ndarray containing the model inputs required for Method
        of Morris. The resulting matrix has :math:`(G/D+1)*N/T` rows and
        :math:`D` columns, where :math:`D` is the number of parameters.

    References
    ----------
    .. [1] Ruano, M.V., Ribes, J., Seco, A., Ferrer, J., 2012. 
           An improved sampling strategy based on trajectory design for 
           application of the Morris method to systems with many input factors. 
           Environmental Modelling & Software 37, 103–109. 
           https://doi.org/10.1016/j.envsoft.2012.03.008

    .. [2] Morris, M.D., 1991. 
           Factorial Sampling Plans for Preliminary Computational Experiments. 
           Technometrics 33, 161–174. 
           https://doi.org/10.1080/00401706.1991.10484804

    .. [3] Campolongo, F., Cariboni, J., Saltelli, A., 2007. 
           An effective screening design for sensitivity analysis of large models. 
           Environmental Modelling & Software, Modelling, computer-assisted 
           simulations, and mapping of dangerous phenomena for 
           hazard assessment 22, 1509–1518. 
           https://doi.org/10.1016/j.envsoft.2006.10.004
Generate model inputs using the Method of Morris
Generate model inputs using the Method of Morris
def sample(problem: Dict, N: int, num_levels: int = 4,
           optimal_trajectories: int = None, local_optimization: bool = True,
           seed: int = None) -> np.ndarray:
    """Generate model inputs using the Method of Morris

    Returns a NumPy matrix containing the model inputs required for Method of
    Morris.  The resulting matrix has :math:`(G+1)*T` rows and :math:`D`
    columns, where :math:`D` is the number of parameters, :math:`G` is the
    number of groups (if no groups are selected, the number of parameters).
    :math:`T` is the number of trajectories :math:`N`,
    or `optimal_trajectories` if selected.
    These model inputs  are intended to be used with
    :func:`SALib.analyze.morris.analyze`.

    Parameters
    ----------
    problem : dict
        The problem definition
    N : int
        The number of trajectories to generate
    num_levels : int, default=4
        The number of grid levels (should be even)
    optimal_trajectories : int
        The number of optimal trajectories to sample (between 2 and N)
    local_optimization : bool, default=True
        Flag whether to use local optimization according to Ruano et al. (2012)
        Speeds up the process tremendously for bigger N and num_levels.
        If set to ``False`` brute force method is used, unless ``gurobipy`` is
        available
    seed : int
        Seed to generate a random number

    Returns
    -------
    sample_morris : numpy.ndarray
        Returns a numpy.ndarray containing the model inputs required for Method
        of Morris. The resulting matrix has :math:`(G/D+1)*N/T` rows and
        :math:`D` columns, where :math:`D` is the number of parameters.

    References
    ----------
    .. [1] Ruano, M.V., Ribes, J., Seco, A., Ferrer, J., 2012. 
           An improved sampling strategy based on trajectory design for 
           application of the Morris method to systems with many input factors. 
           Environmental Modelling & Software 37, 103–109. 
           https://doi.org/10.1016/j.envsoft.2012.03.008

    .. [2] Morris, M.D., 1991. 
           Factorial Sampling Plans for Preliminary Computational Experiments. 
           Technometrics 33, 161–174. 
           https://doi.org/10.1080/00401706.1991.10484804

    .. [3] Campolongo, F., Cariboni, J., Saltelli, A., 2007. 
           An effective screening design for sensitivity analysis of large models. 
           Environmental Modelling & Software, Modelling, computer-assisted 
           simulations, and mapping of dangerous phenomena for 
           hazard assessment 22, 1509–1518. 
           https://doi.org/10.1016/j.envsoft.2006.10.004
    """
    if seed:
        np.random.seed(seed)

    _check_if_num_levels_is_even(num_levels)

    problem = _define_problem_with_groups(problem)

    sample_morris = _sample_morris(problem, N, num_levels)

    if optimal_trajectories:
        sample_morris = _compute_optimised_trajectories(problem, sample_morris,
                                                        N,
                                                        optimal_trajectories,
                                                        local_optimization)

    sample_morris = scale_samples(sample_morris, problem)

    return sample_morris
def sample ( problem : Dict , N : int , num_levels : int = 4 , optimal_trajectories : int = None , local_optimization : bool = True , seed : int = None ) -> np . ndarray : if seed : np . random . seed ( seed ) _check_if_num_levels_is_even ( num_levels ) problem = _define_problem_with_groups ( problem ) sample_morris = _sample_morris ( problem , N , num_levels ) if optimal_trajectories : sample_morris = _compute_optimised_trajectories ( problem , sample_morris , N , optimal_trajectories , local_optimization ) sample_morris = scale_samples ( sample_morris , problem ) return sample_morris