bbopt / nomad

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

What dose 'Mesh minimum precision reached' mean? #173

Open JinsongLiu6 opened 1 week ago

JinsongLiu6 commented 1 week ago

When I successfully solve some problems, it appears in the log: 'Mesh minimum precision reached (Algo) '. I did't find the explanation of 'Mesh minimum precision' in the parameters, is it MIN_MESH_SIZE or MIN_FRAME_SIZE? What is the default value and how can I adjust it?

ctribes commented 1 week ago

The 'Mesh minimum precision reached (Algo)' stopping criterion corresponds to the situation where Nomad cannot produce new points within its precision. It happens when the mesh size is small enough. This is an inner stopping criterion not controlled by user.

As mentioned in the user guide, parameters MIN_MESH_SIZE and MIN_FRAME_SIZE have no default value.

If you want a finer control on the mesh/frame stopping criterion you should set MIN_MESH_SIZE OR MIN_FRAME_SIZE (one is enough as they are related). Please note that the 'Mesh minimum precision' criterion is still active, so it may be triggered before the MIN_MESH_SIZE criterion if you provide a value that is too small.

Please note, that you can also control the minimum granularity of the variables. This can be set if you know in advance, for some (or all) variables, that adding more digits than necessary to variables is meaningless for a given problem. In that case, you should set a proper MAX_BB_EVAL to prevent the algo to spin for too long.

JinsongLiu6 commented 6 days ago

Thanks for your reply. As for stopping criterion, is it possible to stop when the infeasibility is less than a certain value for feasibility problems?

ctribes commented 6 days ago

I recommend to check the following parameters in the user guide to see what better suits you

H_MIN STOP_IF_FEASIBLE STOP_IF_PHASE_ONE_SOLUTION -> requires initially infeasible constraint to be set to EB

If you cannot find something that works for you, you may want to use NOMAD in library mode and specify a custom callback function to stop according to your own criterion.

JinsongLiu6 commented 5 days ago

The parameter STOP_IF_FEASIBLE works for me.

But what is the default tolerance of infeasibility and how can I set a certain tolerance of infeasibility? Because I can not find the parameter H_MIN in the user guide, and I tried

PyNomad.help('H_MIN') but I get No help found for H_MIN

I also tried to set H_MIN=0.1 in the params as I guess nomad stops if infeasibility < H_MIN when setting STOP_IF_FEASIBLE=true, but it seems not work.

ctribes commented 5 days ago

The PyNomad help do not like the "_". You can try with "hmin" or "feasibility".

I will check that the combining H_MIN and STOP_IF_FEASIBLE works.

ctribes commented 4 days ago

Sorry, h_min is not available in version 4.4.0. But the good news is that it is available in the development version. and H_MIN and STOP_IF_FEASIBLE can work together.

An alternative solution consists in "shifting" your constraints. Let's say you compute 'g1(x)'. The constraint is 'g1(x)<=0'. You can return 'g2(x)=g1(x)-s' instead.

ctribes commented 4 days ago

... the development version is private and will not be released before end of 2024.

JinsongLiu6 commented 4 days ago

OK, I will try the new version when it is available. And what is the default infeasibility tolerance when STOP_IF_FEASIBLE=true?

ctribes commented 4 days ago

h(x)<epsilon with DEFAULT_EPSILON = 1e-13. Note: it is not recommended to modify epsilon. It is used for all comparisons of NOMAD::Double.

JinsongLiu6 commented 3 days ago

OK, thanks for your patient reply