Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluation fails for X0 #168

Open
ctribes opened this issue May 8, 2024 · 3 comments
Open

Evaluation fails for X0 #168

ctribes opened this issue May 8, 2024 · 3 comments

Comments

@ctribes
Copy link
Contributor

ctribes commented May 8, 2024

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.

@Kongbai-ddl
Copy link

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?

@ctribes
Copy link
Contributor Author

ctribes commented Sep 21, 2024

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.

@Kongbai-ddl
Copy link

Got it, thanks for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants