nomad icon indicating copy to clipboard operation
nomad copied to clipboard

Pynomad with LH_SEARCH

Open coucou54 opened this issue 3 years ago • 1 comments

Hi, I want to use LH_SEARCH with pynomad but it asks me x0. According to documentation, I dont need x0 when I use LH. I didnot find any example or help about this in the doc.
Here is my code: lb = [ 0 , .0001 , 1, 2 , .1 , 0.1, 0, 5 , 10, 5] ub = [20, 1, 100, 10, 1, 1, 50, 40, 400, 400] LH_SEARCH = [5 , 15]
params = ["BB_OUTPUT_TYPE OBJ EB EB EB EB", "DISPLAY_DEGREE 10","MAX_BB_EVAL 10", "DISPLAY_STATS BBE OBJ"]

result = PyNomad.optimize(bb, LH_SEARCH, lb, ub, params) I got the following error: NOMAD Parameter Error: The lower bound size is inconsistent with X0 size NOMAD exception (report to developper): NOMAD::Exception thrown (C:\projets\Depots\bbot\nomad\src\Param../Param/Parameters.hpp, 426) Parameter to be checked. In getAttributeValue<T> the attribute BB_MAX_BLOCK_SIZE has not been checked

I have 10 parameters, please help me. Thanks in advance

coucou54 avatar May 13 '22 20:05 coucou54

To use the LH_SEARCH and no X0, do the following

  • Set an empty X0 (X0=[])
  • provide LH_SEARCH in params: params = [....,"LH_SEARCH 10 0", "EVAL_OPPORTUNISTIC false"]

Please note it is also possible to provide several x0 in the params: `params=[...., "X0 *1 ","X0 * 0","X0 * 0.5"]

With LH or multiple X0, to force Nomad to evaluate all points, the "EVAL_OPPORTUNISTIC false" must be provided. Otherwise, Nomad will switch to default Mads algo after the first evaluation success.

ctribes avatar May 16 '22 13:05 ctribes

In this example, why is it necessary to provide the parameter "EVAL_OPPORTUNISTIC false"? The help documentation indicates that evaluation of starting points and Latin hypercube sampling is not opportunistic.


nomadOpt('-h opportunistic')

X0 {

. Vector of starting point(s)

. Arguments: text file name or DIMENSION reals

. More than one starting point can be defined in a separate text file (X0 x0s.txt) with one point per line. A single point can be provided in the parameter file: X0 (0 0 0).

. All points are evaluated: X0 evaluations are not opportunistic. Initial LH_SEARCH points are handled as X0s (no opportunism for evaluation).

nomadOpt('-h EVAL_OPPORTUNISTIC')


-------------------------------- BASIC PARAMETERS -----------------------------

LH_SEARCH {

. Latin-Hypercube sampling (search)

. Arguments: two size_t p0 and pi < INF.

. p0: number of initial LH search points. These points are handled as X0s (no opportunism for evaluation).

. pi: LH search points at each iteration. The iteration search can be opportunistic or not (parameter EVAL_OPPORTUNISTIC).

. Example: LH_SEARCH 100 0

. No default value.

}

stumarcus314 avatar Feb 18 '24 21:02 stumarcus314

The comment refers to a previous version of Nomad. In version 4.4.0, initial LH and X0s are always evaluated non-opportunistically.

ctribes avatar Feb 19 '24 13:02 ctribes