Hello,
I need to limit the number of threads cplex is using. But when I try to do this with
options.cplex.threads it does not work.
When I tried to figure out why, I used a modified version of the unit commitment model (see attached file).
Even for sdpsolve this problem exists.
For me it seems that the cplex interface does not handle options struct as expected (using whatever is in it).
If the options struct is not a full struct like cplexoptimset('cplex') produces, the options are ignored. When setting options.cplex.Display = 'on'; in call_cplexibm_qcmiqp.m, the rest of the options are ignored.
I fixed this for me with adding a function
function opts = cplexmergeoptions(newopts)
opts = cplexoptimset('cplex');
opts = merge(opts, newopts);
function out = merge(out, in)
in_fields = fieldnames(in);
out_fields = fieldnames(out);
for i = 1:length(in_fields)
if ismember(in_fields{i},out_fields)
if isstruct(out.(in_fields{i}))
out.(in_fields{i}) = merge(out.(in_fields{i}), in.(in_fields{i}));
else
out.(in_fields{i}) = in.(in_fields{i});
end
else
warning('cplexmergeoptions:NotSupportedOption','"%s" is not a supported option - discarded',in_fields{i});
end
end
end
end
And before returning the options from yalmip2cplex I apply this function.
I'm not sure if this introduces other bugs and may be solved in nicer (faster?) way.
Greetings
Reinhold
Using Cplex 12.5, win 64