# all the entries of a line are ignored after '#'

# the problem directory (PROBLEM_DIR) is automatically determined by NOMAD,
# or can be user-given by Parameters::set_PROBLEM_DIR()

# all given file names are supposed to refer to files in PROBLEM_DIR

# to give a directory or file name containing spaces, use quotes ("name" or 'name')

# all indexes begin at 0

# index ranges with format 'i' or 'i-j' can be replaced by '*' to replace '0-n-1'

# '-', 'inf', '-inf' or '+inf' are accepted as undefined real values

#----------------------#
#  General parameters  #
#----------------------#

DIMENSION           int    # dimension (or n)

SEED                int    # unique, optional; integer value or DIFF (default)
                           # corresponds to the random seed; it is also the run tag used to
                           # create black-box input/output temporary files

EPSILON             real   # machine precision (def=1e-13)

POINT_DISPLAY_LIMIT int    # . maximal number of point coordinates that will be displayed
                           #   at screen
                           # . a negative value means no limit (def=20)

DISPLAY_DEGREE      int    # int or string composed of 1 or 4 digits in [0,4]
                           # (if only one digit is given, it is duplicated to 4 digits)
                 or string # 1st digit : general display degree
                           # 2nd digit : search display degree
                           # 3nd digit : poll display degree
                           # 4sd digit : updates display degree
                           # each digit:
                           #  0: no display
                           #  1: minimal display
                           #  2: normal/default display
                           #  3: detailed display
                           #  4: full/debug display

DISPLAY_STATS  str_list    # in normal display mode, what informations are displayed
                           # (at each feasible success)
                           # str_list is a list of strings that can include these keywords:
                           #   EVAL      evaluations (includes cache-hits)
                           #   SIM_BBE   simulated black-box evaluations (includes initial cache-hits)
                           #   BBE       black-box evaluations
                           #   BBO       all black-box outputs
                           #   OBJ       objective function value
                           #   TIME      wall-clock time
                           #   STAT_SUM  the sum stat (STAT_SUM)
                           #   STAT_AVG  the avg stat (STAT_AVG)
                           #   SOL       solution, with format iSOLj where i and j are two
                           #             (optional) strings: i will be displayed before each
                           #             coordinate, and j after each coordinate
                           #             (except the last)

                           # example (with two variables):
                           #   DISPLAY_STATS $BBE$ & ( $SOL, ) & $OBJ$ \\
                           # displays:
                           #   $1$ & ( $10$ , $5$ ) & $-703.4734809$ \\

                           # default:
                           # DISPLAY_STATS BBE OBJ

STATS_FILE fname str_list  # the same but for a display into file 'fname'

TMP_DIR             string # unique, optional; temporary directory for black-box i/o files
                           # default value equal to PROBLEM_DIR
                           # (NOMAD will be more efficient with a local temp. dir.)

SOLUTION_FILE       string # save of the current best feasible point, def.=nothing
                           # (the run tag is added to the file name)

HISTORY_FILE        string # file containing all evaluated points with format ( x1 x2 ... xn )
                           # for each line

ADD_SEED_TO_FILE_NAMES b   # b in { yes , no , y , n } ; def=yes
                           # if the seed is added to the file names corresponding to parameters
                           # SOLUTION_FILE, HISTORY_FILE and FILE_STATS

CACHE_FILE          string # optional; if the cache file does not exist, it will be created
SGTE_CACHE_FILE     string # the same for a surrogate cache file (can not be the same as
                           # CACHE_FILE)
CACHE_SAVE_PERIOD   i (int)# the cache files are saved every i iterations (def=25)

SNAP_TO_BOUNDS      b      # b in { yes , no , y , n } ; def=yes
                           # optional; snap points outside bounds on the boundary

LH_SEARCH p0 pi            # Latin-Hypercube search: p0: number of search points in initial search
                           #                         pi: number of search points at each iteration

SPECULATIVE_SEARCH  b      # b in { yes , no , y , n } ; def=yes
                           # optional; MADS speculative search

MAX_BB_EVAL         int    # maximum number of black-box evaluations
MAX_SGTE_EVAL       int    # maximum number of surrogate evaluations
MAX_EVAL            int    # maximum number of evaluations (includes cache-hits and black-box evaluations,
                           #   does not include surrogate evaluations)
MAX_SIM_BB_EVAL     int    # maximum number of simulated black-box evaluations (includes initial cache hits)
MAX_ITERATIONS      int    # maximum number of iterations
MAX_TIME            int    # maximum wall-clock time (in seconds)
MAX_MESH_INDEX      int    # the algorithm terminates if l_{k+1} > MAX_MESH_INDEX

F_TARGET            real   # the algorithm terminates if f(x_k) <= F_TARGET
STAT_SUM_TARGET     real   # the algorithm terminates if the statistic STAT_SUM
                           #   reaches STAT_SUM_TARGET

#-----------------------#
#  Starting point (x0)  #
#-----------------------#
# Several starting points can be provided
# if no X0 is indicated, the best evaluated point from CACHE_FILE will be considered,
# or points from the initial Latin-Hypercube search (p0 in LH_SEARCH)

       X0   cache_file_name         # file       : cache file containing several points
                                    #              (they can be already evaluated or not)
                                    #              (cache_file_name can be the same as
                                    #              CACHE_FILE)
and/or X0   file_name               # file       : one x0 point in the txt file 'file_name'
and/or X0   [v_0 v_1 ... v_{n-1} ]  # vector     : ith coord. of the current x0 set to v_i
                                    #              and so on

and/or X0   (v_0 v_1 ... v_{n-1}    # vector     : the same than []

and/or X0   k i   v                 # index      : ith coordinate of the kth x0 point is
                                    #              set to v
and/or X0   k i-j v                 # index-range: variables x_i to x_j in the kth x0 point
                                    #              are set to v
and/or X0     i   v                 # index      : the same as 'X0 k i   v' with k=0
and/or X0     i-j v                 # index-range: the same as 'X0 k i-j v' with k=0

# Example (with n=3) :

  X0 * 0.0
  X0 0 5.0
  X0 1 * 1.0
  X0 1 0 -5.0

  # corresponds to two starting points [5.0 0.0 0.0] and [-5.0 1.0 1.0]

#-------------------#
#  Fixed Variables  #
#-------------------#
       FIXED_VARIABLE i   v                  # index      : variable x_i fixed to v
and/or FIXED_VARIABLE i-j v                  # index-range: variables x_i to x_j fixed to v
or     FIXED_VARIABLE [v_0 v_1 ... v_{n-1}]  # vector     : variable x_i fixed to v_i
                                             #              and so on
or     FIXED_VARIABLE (v_0 v_1 ... v_{n-1})  # vector     : the same
or     FIXED_VARIABLE file_name              # file       : contains n values

or     FIXED_VARIABLE i                      # index      : variable x_i fixed to x0[i] (only one x0 must be defined)
or     FIXED_VARIABLE i-j                    # index-range: variables x_i to x_j fixed to x0[i] to x0[j]

# the vector and file forms cannot be used at the same time as both the index forms

#----------#
#  Bounds  #
#----------#
# same type of entries than FIXED_VARIABLE with keywords LOWER_BOUND and UPPER_BOUND

# Example:

  LOWER_BOUND  0-2  -5.0
  LOWER_BOUND  3     0.0
  LOWER_BOUND  5-6  -4.0
  UPPER_BOUND  0-5   8.0

# equivalent to:

  LOWER_BOUND [ -5.0 -5.0 -5.0 0.0    - -4.0 -4.0 ] # '-' or '-inf' means that x_4 has
                                                    # no lower bound
  UPPER_BOUND [  8.0  8.0  8.0 8.0  8.0  8.0  inf ] # '-' or 'inf' or '+inf' means that x_6
                                                    # has no upper bound
# equivalent to:

  LOWER_BOUND points/lb.txt  # the files "lb.txt" and "ub.txt" are in PROBLEM_DIR/points
  UPPER_BOUND points/ub.txt  # and have to contain n values each

#---------------#
#  Black-boxes  #
#---------------#

BB_INPUT_TYPE [ t1 t2 ... tn ]      # black-box input types (one type/variable)
or BB_INPUT_TYPE ( t1 t2 ... tn )   # idem
or BB_INPUT_TYPE i   t              # ti in { R , C , B , I } or { Real , Cat , Bin , Int }
or BB_INPUT_TYPE i-j t              #  R: real/continuous variable
                                    #  C: categorical variable
                                    #  B: binary variable
                                    #  I: integer variable
                                    # default: all variables are considered continuous (R)

BB_INPUT_INCLUDE_SEED yes/no        # if set to 'yes', the seed of the current execution is put
                                    # as the first entry in all black-box input files;
                                    # default to 'no'

BB_INPUT_INCLUDE_TAG yes/no         # if set to 'yes', the tag of a point is put as the first
                                    # (or second if the seed is given)
                                    # entry in all black-box input files; default to 'no'

BB_REDIRECTION yes/no  # . if NOMAD uses a redirection ('>') to create the black-box output files
                       # . if no, the black-box has to explicitely write its outputs in the file
                       #   with the following format:
                       #   TMP_DIR/BLACK_BOX_OUTPUT_FILE_PREFIX.SEED.TAG.BLACK_BOX_OUTPUT_FILE_EXT
                       # . SEED and TAG can be obtained with parameters BB_INPUT_INCLUDE_SEED and
                       #   BB_INPUT_INCLUDE_TAG
                       # . BLACK_BOX_OUTPUT_FILE_PREFIX and BLACK_BOX_OUTPUT_FILE_EXT are
                       #   constants defined in 'defines.hpp'
                       # . default to 'yes'

BB_OUTPUT_TYPE   v_1    v_2    ...  # v_i in { OBJ , EB , PB , PEB , F , STAT_AVG , STAT_SUM ,
                                               NOTHING , - }
                                    #  OBJ          : objective value to minimize
                                    #  EB           : constraint treated with Extreme Barrier
                                    #  PB           : constraint treated with Progressive Barrier
                                    #  PEB          : hybrid constraint PB/EB
                                    #  F            : constraint treated with Filter
                                    #  STAT_AVG     : the average of this value will be computed
                                    #  STAT_SUM     : the sum
                                    #  NOTHING or - : the output is ignored

                                    # STAT_SUM and STAT_AVG: have to be unique and
                                    #   are updated at every new black-box evaluation

                                    # NOTHING or - : the output is ignored

BB_EXE           b1.exe b2.exe ...  # . black-boxes executables
                                    #   (optional if a custom Evaluator class with eval_x()
                                    #    is defined)
                                    # . only one string can be used if a single black-box
                                    #   gives several outputs
                                    # . if a '$' character is put at first position,
                                    #   the executable is considered as a global command and
                                    #   no path will be added (example: '$python')

# examples:

  BB_EXE         bb.exe             # defines that 'bb.exe' is an executable
  BB_OUTPUT_TYPE OBJ EB EB          # with 3 outputs

  BB_EXE         bb1.exe bb2.exe    # defines two black-boxes 'bb1.exe' and 'bb2.exe'
  BB_OUTPUT_TYPE OBJ     EB         # with one output each

  BB_EXE "$python bb.py"            # the black-box is a python script: it will be used
                                    # as the command 'python PROBLEM_DIR/bb.py'

  BB_EXE "$nice bb.exe"             # to call 'PROBLEM_DIR/bb.exe' in nice mode


SGTE_EXE   bb_exe_name sgte_name    # . associates the surrogate executable file 'sgte_name'
                                    #   with the black-box executable 'bb_exe'
                                    # . the two executables must have the same number
                                    #   of outputs
                                    # . if surrogates are used, every black-box executable
                                    #   has to have a surrogate

or SGTE_EXE sgte_name               # . when only one black-box executable is used
                                    # . SGTE_EXE cannot be used if no BB_EXE is defined

SGTE_EVAL_SORT   yes/no             # if surrogates are used to sort list of points that have
                                    # to be evaluated; def=yes if surrogates are available

SGTE_COST        i                  # i surrogate evaluations count as one bb eval
                                    # integer, >0, def=none
#-------------------#
#  Variable groups  #
#-------------------#

VARIABLE_GROUP i-j or i             # defines a group of variables with variables xi to xj,
                                    # or just the variable xi

                                    # variables in one group can be of different types
                                    # (except for categorical variables)

                                    # to define some particular types of directions or a
                                    # particular Halton seed for this group, use the NOMAD
                                    # library and Parameters::set_VARIABLE_GROUP()

                                    # in addition to the groups defined in the parameters,
                                    # NOMAD will create one group for all continous, integer,
                                    # and binary variables, and one group for categorical
                                    # variables

                                    # if a group contains only binary variables, directions
                                    # of type _GPS_BINARY_ will be automatically used

#---------------#
#    Barrier    #
#---------------#
H_MIN   v   # x is feasible if h(x) >= H_MIN; default = 0.0
H_MAX_0 v   # initial value of h_max (will be eventually decreased throughout the algorithm)
H_NORM  v   # norm used to compute h; v in { L1 , L2 , Linf }; default = L2
RHO     v   # value of the rho parameter of the progressive barrier (the trigger)
            #   (good value ~ f(x0) / 10, default=0.1)

#---------------#
#   Directions  #
#---------------#
DIRECTION_TYPE           a1 a2 a3 a4  # type of directions for the poll
SEC_POLL_DIRECTION_TYPE  a1 a2 a3 a4  # type of directions for the secondary poll

  # a1 in { ORTHO , LT , GPS }
  # a2 in { 1 , 2 , N+1 , 2N }
  # a3 in { STATIC , RAND(OM)}
  # a4 in { UNIFORM }

# The following combinations are possible, for a total of 14 different directions types:
DIRECTION_TYPE ORTHO 1                   #  1. Ortho-MADS,   1
DIRECTION_TYPE ORTHO 2                   #  2. Ortho-MADS,   2
DIRECTION_TYPE ORTHO                     #  3. Ortho-MADS,  2n
DIRECTION_TYPE ORTHO 2N                  #  3. Ortho-MADS,  2n
DIRECTION_TYPE LT    1                   #  4. LT-MADS   ,   1
DIRECTION_TYPE LT    2                   #  5. LT-MADS   ,   2
DIRECTION_TYPE LT    N+1                 #  6. LT-MADS   , n+1
DIRECTION_TYPE LT                        #  7. LT-MADS   ,  2n
DIRECTION_TYPE LT    2N                  #  7. LT-MADS   ,  2n
DIRECTION_TYPE GPS   BINARY or BIN       #  8. GPS only for binary variables
DIRECTION_TYPE GPS   N+1                 #  9. GPS       , n+1, static
DIRECTION_TYPE GPS   N+1 STATIC          #  9. GPS       , n+1, static
DIRECTION_TYPE GPS   N+1 STATIC UNIFORM  # 10. GPS       , n+1, static, uniform angles
DIRECTION_TYPE GPS   N+1 RAND            # 11. GPS       , n+1, random
DIRECTION_TYPE GPS   N+1 RAND   UNIFORM  # 12. GPS       , n+1, random, uniform angles
DIRECTION_TYPE GPS                       # 13. GPS       ,  2n, static
DIRECTION_TYPE GPS   2N                  # 13. GPS       ,  2n, static
DIRECTION_TYPE GPS   2N  STATIC          # 13. GPS       ,  2n, static
DIRECTION_TYPE GPS   2N  RAND            # 14. GPS       ,  2n, random

# The 13 different direction types can be chosen together
# If nothing indicated, [Ortho-MADS 2n] is considered for the poll
# Default directions for sec. poll are [Ortho-MADS 2] or [LT-MADS 2] or [GPS n+1 static]

HALTON_SEED          seed    # Halton seed for Ortho-MADS directions
                             # default = n^st prime number
#------------#
#    Mesh    #
#------------#
MESH_UPDATE_BASIS         tau # real > 0 , default=4.0
MESH_COARSENING_EXPONENT  w+  # integer >= 0, def=1
MESH_REFINING_EXPONENT    w-  # integer < 0, def=-1
INITIAL_MESH_INDEX        l0  # integer, def=0


INITIAL_MESH_SIZE     real   # initial mesh size for all variables
INITIAL_MESH_SIZE i   real   # for variable i
INITIAL_MESH_SIZE i-j real   # for variables i to j
                             # all values > 0, default = r0.1
                             # (see the signification of 'r' below)

MIN_MESH_SIZE         real   # min. mesh size for all variables
MIN_MESH_SIZE     i   real   # for variable i
MIN_MESH_SIZE     i-j real   # for variables i-j
                             # all values > 0, no default

MIN_POLL_SIZE         real   # min. poll size for all variables
MIN_POLL_SIZE     i   real   # for variable i
MIN_POLL_SIZE     i-j real   # for variables i-j
                             # all values > 0, no default

# all values for INITIAL_MESH_SIZE, MIN_MESH_SIZE, or MIN_POLL_SIZE
# can be preceded by 'r', to indicate a relative-to-bounds value.

# example:

INITIAL_MESH_SIZE r0.1   # means that all (Delta_0^m)i's are taken to be
                         # 0.1 x ( upper bound(i) - lower bound(i) )

#-----------------------------------------------------------#
#  Opportunistic strategy (applies to both poll and search) #
#-----------------------------------------------------------#

OPPORTUNISTIC_EVAL b      # b in { yes , no , y , n } (bool); default=yes
                          # if the evaluation of a list of points terminates after the
                          # first success
                          # if yes, options can be defined via the following parameters:

OPPORTUNISTIC_MIN_NB_SUCCESS i     # int, no default, don't terminate before i successes
OPPORTUNISTIC_MIN_EVAL       i     # int, no default, don't terminate before i evaluations
OPPORTUNISTIC_MIN_F_IMPRVMT  r     # real, no default, terminate only if f is reduced by r%
OPPORTUNISTIC_LUCKY_EVAL     bool  # no default, perform an additional black-box evaluation
