Setting number of threads for optimizer (bug and workaround)

53 views
Skip to first unread message

Reinhold B

unread,
Feb 12, 2014, 10:03:53 AM2/12/14
to yal...@googlegroups.com
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
yalmip_optimizer_options.m

Johan Löfberg

unread,
Feb 12, 2014, 10:08:37 AM2/12/14
to yal...@googlegroups.com
Cplex options are currently broken, and this has been acknowledged by IBM. Hopefully they sort out this mess in the next release

https://www.ibm.com/developerworks/community/forums/html/topic?id=7dce2826-4858-4136-bbd4-a31fb7fadd90&ps=100

Display options are broken even worse (not consistent between 12.5 and 12.6, thus forcing me to turn on options which aren't sure to be there in another version)

Reinhold B

unread,
Feb 12, 2014, 12:01:45 PM2/12/14
to yal...@googlegroups.com
Thanks for the answer.

Meanwhile I stick to my workaround.
Reply all
Reply to author
Forward
0 new messages