nomad icon indicating copy to clipboard operation
nomad copied to clipboard

Evaluation fails for X0

Open ctribes opened this issue 1 year ago • 3 comments
trafficstars

When Nomad fails to evaluate the provided X0 it will stops immediately with a message that will look like that

BBE ( SOL ) OBJ CONS_H

1	(   5          5          5          5          5          5          5          5          5          5        )	inf inf

X0 evaluation failed for X0 = ( 5 5 5 5 5 5 5 5 5 5 )

A termination criterion is reached: No termination (all). Problem with starting point evaluation (Algo) No more points to evaluate

This can happen when using the batch mode with a standalone blackbox code. In that case, it is recommended to first check the outputs given by the blackbox outside of a Nomad run (put X0 coordinates in a text file and run the blackbox as ./bb.exe X0.txt). The number of outputs must match the outputs as described in the BB_OUTPUT_TYPE parameter.

If the number of outputs produced by the blackbox matches the BB_OUTPUT_TYPE size it is possible that the outputs total length exceeds the evaluator's buffer. This will not happen in most case with a few blackbox outputs considered.

A patch is available in the develop branch (not master). With the patched code, during execution a more explicit message will be provided if X0 fails to evaluate. The message also suggest to change the buffer maximum size in the $NOMAD_HOME/src/Util/defines.hpp if necessary.

ctribes avatar May 08 '24 20:05 ctribes

Hi, I've met the same problem with PyNomad, which provided the following message

Warning: Dimension 162 is greater than (or equal to) 50. Models are disabled.

BBE BBO OBJ
1 4109.98 -6.25 [ -70.    -90.    ...    -130.  ] inf

X0 evaluation failed for X0 = ( 1 1 1 1 1 ... 5 5 )

A termination criterion is reached: No termination (all). Problem with starting point evaluation (Algo) No more points to evaluate

How can I check to make sure PyNomad is working?

Kongbai-ddl avatar Sep 21 '24 12:09 Kongbai-ddl

You can check that PyNomad is working with the provided simple examples in https://github.com/bbopt/nomad/tree/master/examples/advanced/library/PyNomad. It should work as the output you provided shows that PyNomad is a valid binary.

The python blackbox must follow the same type of structure as in

`` def bb(x):

try:

    x0 = x.get_coord(0)

    x1 = x.get_coord(1)

    f1 = (x0-1.0)*(x0-1.0)+(x0-x1)*(x0-x1)

    f2 = (x0-x1) * (x0-x1) + (x1-3) * (x1-3)

    rawBBO = str(f1) + " " + str(f2)

    x.setBBO(rawBBO.encode("UTF-8"))

except:

    print("Unexpected eval error", sys.exc_info()[0])

    return 0

return 1 # 1: success 0: failed evaluation

``

The return 1 is important. The outputs of the bb must be reported via x.setBBO(rawBBO.encode("UTF-8")) Also, I suggest to put your code within the "try/except" structure to cache error from your calculation.

ctribes avatar Sep 21 '24 18:09 ctribes

Got it, thanks for your help

Kongbai-ddl avatar Sep 22 '24 06:09 Kongbai-ddl