.. _method-mesh_adaptive_search-use_surrogate-optimize:

""""""""
optimize
""""""""


Surrogate is used in lieu of true model for mesh adaptive search


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



**Specification**

- *Alias:* None

- *Arguments:* None


**Description**


When ``optimize`` is specified with ``use_surrogate``,
``mesh_adaptive_search`` will use the surrogate in lieu of the true model
and thus the true function is never invoked except to construct the
surrogate.

*Default Behavior*

``optimize`` is the default surrogate usage mode.

*Expected Output*

The user can expect to see both the number of true model evaluations
and the number of approximation (i.e., surrogate) evaluations reported
in the Dakota screen output.  The former should equal the number of
truth evaluations done for the surrogate construction.



**Examples**


The following example shows the syntax used to set
``use_surrogate`` to ``optimize``.


.. code-block::

    method,
     mesh_adaptive_search
     model_pointer = 'SURROGATE'
     use_surrogate optimize
    
    model,
     id_model = 'SURROGATE'
     surrogate global
     polynomial quadratic
     dace_method_pointer = 'SAMPLING'
    
    variables,
     continuous_design = 3
       initial_point   -1.0    1.5   2.0
       upper_bounds    10.0   10.0  10.0
       lower_bounds   -10.0  -10.0 -10.0
       descriptors      'x1'  'x2'  'x3'
     discrete_design_range = 2
       initial_point      2     2
       lower_bounds       1     1
       upper_bounds       4     9
       descriptors      'y1'   'y2'
           discrete_design_set
             real = 2
               elements_per_variable = 4 5
               elements = 1.2 2.3 3.4 4.5 1.2 3.3 4.4 5.5 7.7
               descriptors      'y3'   'y4'
             integer = 2
               elements_per_variable = 2 2
               elements = 4 7 8 9
               descriptors      'z1'   'z2'
    
    method,
     id_method = 'SAMPLING'
     model_pointer = 'TRUTH'
     sampling
       samples = 55
    
    model,
     id_model = 'TRUTH'
     single
       interface_pointer = 'TRUE_FN'
    
    interface,
     id_interface = 'TRUE_FN'
           direct
       analysis_driver = 'text_book'
    
    responses,
     objective_functions = 1
     no_gradients
     no_hessians


The following will appear toward the end of the screen output when
Dakota is run on this example.  The number of true function
evaluations includes only the 55 evaluations that were done to
construct the surrogate (as specified in the SAMPLING method block).


.. code-block::

    <<<<< Function evaluation summary (APPROX_INTERFACE): 221 total (221 new, 0 duplicate)
    <<<<< Function evaluation summary (TRUE_FN): 55 total (55 new, 0 duplicate)




