1- function testprima(release , precision , nrun , test_classical )
1+ function testprima(release , precision , nrun , test_classical , verbose )
22% TESTPRIMA tests prima on a few VERY simple problems.
33% release is a boolean that controls whether to test prima in release mode (true) or not (false).
44% In release mode, the testing precision is relaxed and the testing results are not printed.
@@ -7,6 +7,8 @@ function testprima(release, precision, nrun, test_classical)
77% default value is 1, meaning that no perturbation will be added to x0. If nrun > 1, a tiny
88% quasi-random perturbation will be added to x0 in each run.
99% test_classical is a boolean that controls whether to test the classical version of prima.
10+ % verbose is a boolean that controls whether the solvers print messages. In release mode, it will
11+ % be ignored and the solvers will not print messages.
1012%
1113% Note: Do NOT follow the syntax here when you use prima. This file is
1214% written for testing purpose, and it uses quite atypical syntax. See
@@ -50,6 +52,10 @@ function testprima(release, precision, nrun, test_classical)
5052if nargin < 4
5153 test_classical = false ;
5254end
55+ if nargin < 5
56+ verbose = false ;
57+ end
58+ verbose = verbose && ~release ; % In release mode, the solvers will not print messages regardless of the value of `verbose`.
5359
5460options.debug = true ;
5561options.chkfunval = true ;
@@ -129,9 +135,8 @@ function testprima(release, precision, nrun, test_classical)
129135 problem.x0 = x0 ;
130136 options.solver = solver ;
131137 options.classical = clflag ;
138+ options.iprint = round(4 *(2 * rand() - 1 )) * verbose ;
132139 problem.options = options ;
133- % problem.options.iprint = round(4*(2*rand() - 1)) * (1 - release);
134- problem.options.iprint = 0 ;
135140
136141 switch type
137142 case ' unconstrained'
@@ -163,7 +168,7 @@ function testprima(release, precision, nrun, test_classical)
163168
164169 xs = prima(problem );
165170
166- % Remove the *_output.txt files produced when iprint < 0.
171+ % Remove the *_output.txt files produced when options. iprint < 0.
167172 if ~isempty(dir(' *_output.txt' ))
168173 delete(' *_output.txt' );
169174 end
0 commit comments