.. _method-mesh_adaptive_search-neighbor_order:

""""""""""""""
neighbor_order
""""""""""""""


Number of dimensions in which to perturb categorical variables.


.. toctree::
   :hidden:
   :maxdepth: 1



**Specification**

- *Alias:* None

- *Arguments:* INTEGER


**Description**


The ``neighbor_order`` keyword allows the user to specify the number of
categorical dimensions to perturb when determining neighboring points
that will be used by the mesh adaptive direct search method to augment
its search.  When greater than 1, the neighbors are defined from the
tensor product of the admissible 1-dimensional perturbations.

*Default Behavior*

By default, the categorical neighbors will be defined by perturbing
only one categorical variable at a time (according to the corresponding
adjacency_matrix; see :dakkw:`variables-discrete_design_set-string-adjacency_matrix`)
while leaving the others fixed at their current values.

*Usage Tips*

The maximum meaningful value ``neighbor_order`` can take on is the
number of categorical variables.



**Examples**


In this example, suppose we have the following categorical variables
and associated adjacency matrices.


.. code-block::

    variables
      discrete_design_set
        real = 2
          categorical ‘yes’ ‘yes’
          num_set_values = 3 5
          set_values = 1.2 2.3 3.4
                       1.2 3.3 4.4 5.5 7.7
          adjacency_matrix = 1 1 0
                             1 1 1
                             0 1 1
                             1 0 1 0 1
                             0 1 0 1 0
                             1 0 1 0 1
                             0 1 0 1 0
                             1 0 1 0 1


Also suppose that we have the following method specification.


.. code-block::

    method
      mesh_adaptive_search
        seed = 1234


If the mesh adaptive direct search is at the point (1.2, 1.2), then
the neighbors will be defined by the default 1-dimensional
perturbations and would be the following:


.. code-block::

    (2.3, 1.2)
    (1.2, 4.4)
    (1.2, 7.7)


If, instead, the method specification is the following:


.. code-block::

    method
      mesh_adaptive_search
        seed = 1234
        neighbor_order = 2


The neighbors will be defined by 2-dimensional perturbations defined
from the tensor product of the 1-dimensional perturbation and would be
the following:


.. code-block::

    (2.3, 1.2)
    (2.3, 4.4)
    (2.3, 7.7)
    (1.2, 4.4)
    (1.2, 7.7)




