bbopt / nomad

NOMAD - A blackbox optimization software
https://nomad-4-user-guide.readthedocs.io/
GNU Lesser General Public License v3.0
114 stars 24 forks source link

Pynomad with LH_SEARCH #74

Closed coucou54 closed 6 months ago

coucou54 commented 2 years ago

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 the attribute BB_MAX_BLOCK_SIZE has not been checked

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

ctribes commented 2 years ago

To use the LH_SEARCH and no X0, do the following

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.

stumarcus314 commented 6 months ago

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.

}

ctribes commented 6 months ago

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