Skip to content

Commit

Permalink
240407.130253.HKT revise isequiv.m and verify.m regarding yw
Browse files Browse the repository at this point in the history
  • Loading branch information
zaikunzhang committed Apr 7, 2024
1 parent 1bbe3bf commit de84085
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
18 changes: 5 additions & 13 deletions matlab/tests/private/isequiv.m
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ function isequiv(solvers, options)
disp(['prob_end_dir = ', prob_end_dir]);
disp(['prob_end_time_dir = ', prob_end_time_dir]);
disp(['prob_end_runs_dir = ', prob_end_runs_dir]);

fprintf('\n\nSucceed!\n\n'); % Declare success if we arrive here without an error.
fprintf('\nThe seed is\t\t%d\n', options.yw);
fprintf('\nSucceed!\n\n'); % Declare success if we arrive here without an error.

return

Expand All @@ -277,16 +277,8 @@ function isequiv(solvers, options)
n = length(x0);

% Some randomization
% Set seed using pname, n, and ir. We ALTER THE SEED weekly to test the solvers as much as possible.
% N.B.: The weeknum function considers the week containing January 1 to be the first week of the
% year, and increments the number every SUNDAY.
if isfield(options, 'yw')
yw = options.yw;
elseif isfield(options, 'seed')
yw = options.seed;
else
yw = year_week('Asia/Shanghai');
end
% Set seed using pname, n, and ir. We ALTER THE RANDOM SEED weekly to test the solvers as much as possible.
yw = options.yw;
rseed = max(0, min(2^32 - 1, sum(pname) + n + ir + yw)); % A random seed defined by the current test and yw
orig_rng_state = rng(); % Save the current random number generator settings
rng(rseed); % Set the random seed for reproducibility
Expand Down Expand Up @@ -630,7 +622,7 @@ function isequiv(solvers, options)
cd(options.olddir);
keyboard
end
error('PRIMA:VerificationFailure', 'Verification failed!');
error('PRIMA:VerificationFailure', 'Verification failed on %s at the %dth run with seed %d!', pname, ir, yw);
end

return
Expand Down
1 change: 1 addition & 0 deletions matlab/tests/verify.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function verify(varargin)
else
yw = year_week('Asia/Shanghai');
end
options.yw = yw; % options.yw is needed in `isequiv`.
if mod(yw, 4) == 0
options.integer_kind = 0;
else
Expand Down

0 comments on commit de84085

Please sign in to comment.