Print Level = 1is an example of a string used to set an optional parameter. For each option the string contains one or more of the following items:
– | a mandatory keyword; |
– | a phrase that qualifies the keyword; |
– | a number that specifies an integer or double value. Such numbers may be up to contiguous characters in Fortran's I, F, E or D formats, terminated by a space if this is not the last item on the line. |
[lwsav, iwsav, rwsav, inform] = e04uj('Nolist', lwsav, iwsav, rwsav);suppresses printing of this and subsequent options. Printing will automatically be turned on again after a call to nag_opt_nlp1_sparse_solve (e04ug) and may be turned on again at any time using the keyword List.
None.
Open in the MATLAB editor: e04uj_example
function e04uj_example fprintf('e04uj example results\n\n'); n = int64(4); m = int64(6); ncnln = int64(3); nonln = int64(4); njnln = int64(2); iobj = int64(6); a = [1e25; 1e25; 1e25; 1; -1; 1e25; 1e25; 1e25; -1; 1; 3; -1; -1; 2]; ha = int64([ 1; 2; 3; 5; 4; 1; 2; 3; 5; 4; 6; 1; 2; 6]); ka = int64([ 1; 6; 11; 13; 15]); bl = [-0.55; -0.55; 0; 0; -894.8; -894.8; -1294.8; -0.55; -0.55; -1e25]; bu = [ 0.55; 0.55; 1200; 1200; -894.8; -894.8; -1294.8; 1e25; 1e25; 1e25]; start = 'C'; names = {''}; ns = int64(0); xs = [ 0; 0; 0; 0; 0; 0; 0; 0; 0; 0]; istate(1:10) = int64(0); clamda = [ 0; 0; 0; 0; 0; 0; 0; 0; 0; 0]; leniz = int64(1000); lenz = int64(1000); [cwsav,lwsav,iwsav,rwsav,ifail] = e04wb('e04ug'); [lwsav,iwsav,rwsav,ifail] = e04uj(... 'Print level = 0', lwsav, iwsav, rwsav); [a, ns, xs, istate, clamda, miniz, minz, ninf, sinf, ... obj, user, lwsav, iwsav, rwsav, ifail] = ... e04ug(... @confun, @objfun, n, m, ncnln, nonln, njnln, ... iobj, a, ha, ka, bl, bu, start, names, ns, xs, istate, clamda, ... lwsav, iwsav, rwsav, 'lenz', lenz, 'leniz', leniz); fprintf('\nMinimum found at x: '); fprintf(' %9.4f',xs(1:n)); fprintf('\nMinimum value : %9.4f\n\n',obj); function [mode, f, fjac, user] = ... confun(mode, ncnln, njnln, nnzjac, x, fjac, nstate, user) f = zeros(ncnln, 1); if (mode == 0 || mode == 2) f(1) = 1000*sin(-x(1)-0.25) + 1000*sin(-x(2)-0.25); f(2) = 1000*sin(x(1)-0.25) + 1000*sin(x(1)-x(2)-0.25); f(3) = 1000*sin(x(2)-x(1)-0.25) + 1000*sin(x(2)-0.25); end if (mode == 1 || mode == 2) % nonlinear jacobian elements for column 1. fjac(1) = -1000*cos(-x(1)-0.25); fjac(2) = 1000*cos(x(1)-0.25) + 1000*cos(x(1)-x(2)-0.25); fjac(3) = -1000*cos(x(2)-x(1)-0.25); % nonlinear jacobian elements for column 2. fjac(4) = -1000*cos(-x(2)-0.25); fjac(5) = -1000*cos(x(1)-x(2)-0.25); fjac(6) = 1000*cos(x(2)-x(1)-0.25) + 1000*cos(x(2) -0.25); end function [mode, objf, objgrd, user] = ... objfun(mode, nonln, x, objgrd, nstate, user) if (mode == 0 || mode == 2) objf = 1.0e-6*x(3)^3 + 2.0e-6*x(4)^3/3; end if (mode == 1 || mode == 2) objgrd(1) = 0; objgrd(2) = 0; objgrd(3) = 3.0e-6*x(3)^2; objgrd(4) = 2.0e-6*x(4)^2; end
e04uj example results Minimum found at x: 0.1189 -0.3962 679.9453 1026.0671 Minimum value : 5126.4981