nomad
nomad copied to clipboard
Eval OK but output not matching (Matlab 2022a/Windows 10 x64)
I am playing with the example provided in Matlab:
fun = @(x) [-x(1) - x(2) - x(3);
(x(2) - 1./2.)*(x(2) - 1./2.) + (sin(x(3)) - 1./2.)*(x(3) - 1./2.) - 1/4 - fcn(x); %%%%Changed here
x(1) - x(2);
x(1) + x(3) + sin(x(4)^3) - 2]; %%%Changed here
ub = [1;10;10;5];
lb = [0;0;0;0];
x0 = [0;0;1;0]; %%%Changed here
params = struct('display_degree','2', 'bb_output_type','OBJ PB PB PB','max_bb_eval','100', 'eval_queue_sort','dir_last_success'); %%%%Changed here
[x,fval,hinf,exit_status,nfeval] = nomadOpt(fun,x0,lb,ub,params);
function res = fcn(x)
res = x(3).^5;
end
When I run the code, I get:

I don't understand where the warnings are coming from if evaluating the function fun separately works:
It seems that the problem is related to the fourth constraint, and in particular to sin(x(4)^3) because if I change it to sin(x(4)) I do not get the warning.
Any help would be appreciated!
Default example that I started with (runs w/o warnings):
% PROBLEM 4 [fval = -2.5]
clc
fun = @(x) [-x(1) - x(2) - x(3);
(x(2) - 1./2.)*(x(2) - 1./2.) + (x(3) - 1./2.)*(x(3) - 1./2.) - 1/4;
x(1) - x(2);
x(1) + x(3) + x(4) - 2];
ub = [1;10;10;5];
lb = [0;0;0;0];
x0 = [0;0;0;0];
params = struct('display_degree','2', 'bb_output_type','OBJ PB PB PB','bb_input_type','(B R R I)', 'max_bb_eval','50', 'eval_queue_sort','dir_last_success');
[x,fval,hinf,exit_status,nfeval] = nomadOpt(fun,x0,lb,ub,params);
There is a bug when interpreting the matlab blackbox eval for Nomad.
The line 456 of file $NOMAD_HOME/interfaces/Matlab_MEX/Source/nomadmex.cpp should be
bboStr += bbo.tostring() + " " ;
This modif has been applied to the Master and develop branches of bbopt/nomad.
Thanks for reporting this.