|
482 | 482 | if opt.verbose |
483 | 483 | if opt.step_control, s = '-sc'; else, s = ''; end |
484 | 484 | 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)', ... |
486 | 486 | s, v.Version, v.Date, ls); |
487 | 487 | 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', ... |
491 | 491 | i, f/opt.cost_mult, '', feascond, gradcond, compcond, costcond); |
492 | 492 | end |
493 | 493 | end |
494 | 494 | if feascond < opt.feastol && gradcond < opt.gradtol && ... |
495 | 495 | compcond < opt.comptol && costcond < opt.costtol |
496 | 496 | converged = 1; |
497 | 497 | if opt.verbose |
498 | | - fprintf('\nConverged!\n'); |
| 498 | + mp_printf('\nConverged!\n'); |
499 | 499 | end |
500 | 500 | end |
501 | 501 |
|
|
508 | 508 | lambda = struct('eqnonlin', lam(1:neqnln), 'ineqnonlin', mu(1:niqnln)); |
509 | 509 | if nonlinear |
510 | 510 | 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.'); |
512 | 512 | end |
513 | 513 | Lxx = hess_fcn(x, lambda, opt.cost_mult); |
514 | 514 | else |
|
527 | 527 | % ]; |
528 | 528 | % rc = 1/condest(AAA); |
529 | 529 | % if rc < 1e-22 |
530 | | -% fprintf('my RCOND = %g\n', rc); |
| 530 | +% mp_printf('my RCOND = %g\n', rc); |
531 | 531 | % n = size(AAA, 1); |
532 | 532 | % AAA = AAA + 1e-3 * speye(n,n); |
533 | 533 | % end |
534 | 534 | % bbb = [-N; -g]; |
535 | 535 | % dxdlam = AAA \ bbb; |
536 | 536 | if any(isnan(dxdlam)) || norm(dxdlam) > max_stepsize |
537 | 537 | if opt.verbose |
538 | | - fprintf('\nNumerically Failed\n'); |
| 538 | + mp_printf('\nNumerically Failed\n'); |
539 | 539 | end |
540 | 540 | eflag = -1; |
541 | 541 | break; |
|
598 | 598 | end |
599 | 599 | L1 = f1 + lam' * g1 + mu' * (h1+z) - gamma * sum(log(z)); |
600 | 600 | if opt.verbose > 2 |
601 | | - fprintf('\n %3d %10g', -j, norm(dx1)); |
| 601 | + mp_printf('\n %3d %10g', -j, norm(dx1)); |
602 | 602 | end |
603 | 603 | rho = (L1 - L) / (Lx' * dx1 + 0.5 * dx1' * Lxx * dx1); |
604 | 604 | if rho > rho_min && rho < rho_max |
|
676 | 676 | end |
677 | 677 |
|
678 | 678 | 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', ... |
680 | 680 | i, f/opt.cost_mult, norm(dx), feascond, gradcond, compcond, costcond); |
681 | 681 | end |
682 | 682 | if feascond < opt.feastol && gradcond < opt.gradtol && ... |
683 | 683 | compcond < opt.comptol && costcond < opt.costtol |
684 | 684 | converged = 1; |
685 | 685 | if opt.verbose |
686 | | - fprintf('\nConverged!\n'); |
| 686 | + mp_printf('\nConverged!\n'); |
687 | 687 | end |
688 | 688 | else |
689 | 689 | if any(isnan(x)) || alphap < alpha_min || alphad < alpha_min || ... |
690 | 690 | gamma < eps || gamma > 1/eps |
691 | 691 | if opt.verbose |
692 | | - fprintf('\nNumerically Failed\n'); |
| 692 | + mp_printf('\nNumerically Failed\n'); |
693 | 693 | end |
694 | 694 | eflag = -1; |
695 | 695 | break; |
|
703 | 703 |
|
704 | 704 | if opt.verbose |
705 | 705 | if ~converged |
706 | | - fprintf('\nDid not converge in %d iterations.\n', i); |
| 706 | + mp_printf('\nDid not converge in %d iterations.\n', i); |
707 | 707 | end |
708 | 708 | end |
709 | 709 |
|
|
0 commit comments