-
Notifications
You must be signed in to change notification settings - Fork 91
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
results are not apparently deterministic? #15
Comments
Interesting! I'm not entirely sure where randomness my be introduced. |
(Sorry, didn't mean to close it. Re-opened.) |
deczky3_socp_test.gdb.session.txt |
This hack seems to fix my problem:
|
Thanks for finding this! |
I left my former job and no longer have access to Matlab, so I cannot test this issue. I have notified a former colleague (@cerebellum-github ?) regarding this fix, hoping he can confirm the issue is resolved. |
The following, copied from the original post, works for me in Octave (built on my machine under Fedora 23 from the octave-4.0.0.tar.xz source without native graphics using "./configure --without-fltk --disable-gui --disable-java"):
|
Sorry, I didn't read the documentation of md5sum carefully enough. Try again. This works for me:
|
Fix compiler warnings about uninitialised variables and issue #15
Finally closed by #58 thanks to @robertgj 😊 👍 This program runs in Octave 5.2.0 and Matlab R2020b (with the old and new mexa64 binaries 😕 maybe only an Octave issue). install_sedumi
format long e
sed_A = sparse([1e-06 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.000374569348444187 0 -0.000143510377232224 0 -0.000107308290246781 0 -0.00023475302385101 0 -0.000222588804655496 0 -0.00039621568504792 0 -0.000175372571085547 0 0 0 0 0 0 0 0;0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0;0 0 0 0 0 1 0 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 0 0.00166011586827782 0 5.08618097827969e-05 0 0.000550274603301129 0 -1.24577387791141e-05 0 2.80912803114481e-05 0 0.000787997869564677 0 0 -1 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.00131496023553193 0 -2.85427725918689e-05 0 -6.40917512673142e-05 0 -6.48347565119609e-05 0 -9.88411732133345e-05 0 0 0 -1 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.00116855302122233 0 -1.40653733430151e-05 0 1.38084332511408e-05 0 0.00052463330628182 0 0 0 0 -1 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.00177126319840008 0 0.000136498835240328 0 -0.000139615027512656 0 0 0 0 0 -1 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.00218208935736517 0 -0.000117739846758266 0 0 0 0 0 0 -1 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.00170708755797057 0 0 0 0 0 0 0 -1;-1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0]);
sed_b = [-5e-08;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0];
sed_c = [0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0];
sed_K = struct(sprintf('f'), {0}, sprintf('l'), {17}, sprintf('q'), {[2 2 2 2 2 2 2 8]}, sprintf('r'), {0});
pars = struct(sprintf('fid'), {0}, sprintf('maxiter'), {100});
if (exist ("OCTAVE_VERSION", "builtin") == 5)
expected = '287ab8afc72fef3240296fe3d62c81be'; % Octave 5.2.0
else
expected = '71ed00585640dbc3f14990e38a2db1aa'; % Matlab R2020b
end
% run sedumi 200 times, and hash the output:
for i=1:200
[x,y,info] = sedumi(sed_A,sed_b,sed_c,sed_K,pars);
xstr=sprintf('%16.10g ',x);
if (exist ("OCTAVE_VERSION", "builtin") == 5)
myhash = hash("md5", xstr);
else
mhash = java.security.MessageDigest.getInstance('MD5');
mhash.update(typecast(x,'uint8'));
myhash = lower(sprintf('%02X',typecast(mhash.digest,'uint8')));
end
if (~strcmp (myhash, expected))
error('Expected myhash to be %s, but got %s', expected, myhash);
end
end
disp ('done')
|
I am hunting down a bug that we have traced back to
sedumi
not being deterministic. I have a MWE:In any one Matlab instance, I tend to get the same results. In different Matlab instances, I can get different output. I have gotten all the following output hashes:
and a few more. I have confirmed that the different hashes correspond to different output. Typically the variation is on the order of 1e-7, indicating some kind of single to double conversion might be at fault.
This is in Matlab r2007b on a linux machine. I have confirmed the results on a few diffferent linux machines all running r2007b. I have code which sets the random seed used by Matlab, and it does not appear to fix the issue. I have also tried setting
maxNumCompThreads(1)
to see if multithreading causes the problem. It does not appear to.edit: I am using SeDuMi 1.21
The text was updated successfully, but these errors were encountered: