Skip to content

Commit be643ff

Browse files
committed
Switch from use of fprintf() to redirectable mp_printf().
1 parent 043b45d commit be643ff

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

lib/mips.m

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -482,20 +482,20 @@
482482
if opt.verbose
483483
if opt.step_control, s = '-sc'; else, s = ''; end
484484
v = mipsver('all');
485-
fprintf('MATPOWER Interior Point Solver -- MIPS%s, Version %s, %s\n (using %s linear solver)', ...
485+
mp_printf('MATPOWER Interior Point Solver -- MIPS%s, Version %s, %s\n (using %s linear solver)', ...
486486
s, v.Version, v.Date, ls);
487487
if opt.verbose > 1
488-
fprintf('\n it objective step size feascond gradcond compcond costcond ');
489-
fprintf('\n---- ------------ --------- ------------ ------------ ------------ ------------');
490-
fprintf('\n%3d %12.8g %10s %12g %12g %12g %12g', ...
488+
mp_printf('\n it objective step size feascond gradcond compcond costcond ');
489+
mp_printf('\n---- ------------ --------- ------------ ------------ ------------ ------------');
490+
mp_printf('\n%3d %12.8g %10s %12g %12g %12g %12g', ...
491491
i, f/opt.cost_mult, '', feascond, gradcond, compcond, costcond);
492492
end
493493
end
494494
if feascond < opt.feastol && gradcond < opt.gradtol && ...
495495
compcond < opt.comptol && costcond < opt.costtol
496496
converged = 1;
497497
if opt.verbose
498-
fprintf('\nConverged!\n');
498+
mp_printf('\nConverged!\n');
499499
end
500500
end
501501

@@ -508,7 +508,7 @@
508508
lambda = struct('eqnonlin', lam(1:neqnln), 'ineqnonlin', mu(1:niqnln));
509509
if nonlinear
510510
if isempty(hess_fcn)
511-
fprintf('mips: Hessian evaluation via finite differences not yet implemented.\n Please provide your own hessian evaluation function.');
511+
mp_printf('mips: Hessian evaluation via finite differences not yet implemented.\n Please provide your own hessian evaluation function.');
512512
end
513513
Lxx = hess_fcn(x, lambda, opt.cost_mult);
514514
else
@@ -527,15 +527,15 @@
527527
% ];
528528
% rc = 1/condest(AAA);
529529
% if rc < 1e-22
530-
% fprintf('my RCOND = %g\n', rc);
530+
% mp_printf('my RCOND = %g\n', rc);
531531
% n = size(AAA, 1);
532532
% AAA = AAA + 1e-3 * speye(n,n);
533533
% end
534534
% bbb = [-N; -g];
535535
% dxdlam = AAA \ bbb;
536536
if any(isnan(dxdlam)) || norm(dxdlam) > max_stepsize
537537
if opt.verbose
538-
fprintf('\nNumerically Failed\n');
538+
mp_printf('\nNumerically Failed\n');
539539
end
540540
eflag = -1;
541541
break;
@@ -598,7 +598,7 @@
598598
end
599599
L1 = f1 + lam' * g1 + mu' * (h1+z) - gamma * sum(log(z));
600600
if opt.verbose > 2
601-
fprintf('\n %3d %10g', -j, norm(dx1));
601+
mp_printf('\n %3d %10g', -j, norm(dx1));
602602
end
603603
rho = (L1 - L) / (Lx' * dx1 + 0.5 * dx1' * Lxx * dx1);
604604
if rho > rho_min && rho < rho_max
@@ -676,20 +676,20 @@
676676
end
677677

678678
if opt.verbose > 1
679-
fprintf('\n%3d %12.8g %10.5g %12g %12g %12g %12g', ...
679+
mp_printf('\n%3d %12.8g %10.5g %12g %12g %12g %12g', ...
680680
i, f/opt.cost_mult, norm(dx), feascond, gradcond, compcond, costcond);
681681
end
682682
if feascond < opt.feastol && gradcond < opt.gradtol && ...
683683
compcond < opt.comptol && costcond < opt.costtol
684684
converged = 1;
685685
if opt.verbose
686-
fprintf('\nConverged!\n');
686+
mp_printf('\nConverged!\n');
687687
end
688688
else
689689
if any(isnan(x)) || alphap < alpha_min || alphad < alpha_min || ...
690690
gamma < eps || gamma > 1/eps
691691
if opt.verbose
692-
fprintf('\nNumerically Failed\n');
692+
mp_printf('\nNumerically Failed\n');
693693
end
694694
eflag = -1;
695695
break;
@@ -703,7 +703,7 @@
703703

704704
if opt.verbose
705705
if ~converged
706-
fprintf('\nDid not converge in %d iterations.\n', i);
706+
mp_printf('\nDid not converge in %d iterations.\n', i);
707707
end
708708
end
709709

lib/mipsver.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@
3434
rv = v.Version;
3535
end
3636
else
37-
fprintf('%-22s Version %-9s %11s\n', v.Name, v.Version, v.Date);
37+
mp_printf('%-22s Version %-9s %11s\n', v.Name, v.Version, v.Date);
3838
end

0 commit comments

Comments
 (0)