@@ -823,11 +823,14 @@ void IPM::PrintHeader() {
823823 h_logging_stream
824824 << (kTerminationLogging ? " \n " : " " )
825825 << " " << Format (" Iter" , 4 )
826- << " " << Format (" P.res" , 8 ) << " " << Format (" D.res" , 8 )
827- << " " << Format (" P.obj" , 15 ) << " " << Format (" D.obj" , 15 )
828- << " " << Format (" mu" , 8 );
826+ << " " << Format (" primal obj" , 15 )
827+ << " " << Format (" dual obj" , 15 )
828+ << " " << Format (" pinf" , 9 )
829+ << " " << Format (" dinf" , 9 )
830+ << " " << Format (" gap" , 8 );
831+ // h_logging_stream << " " << Format("mu", 8);
829832 if (!control_.timelessLog ())
830- h_logging_stream << " " << Format (" Time " , 7 );
833+ h_logging_stream << " " << Format (" time " , 7 );
831834 control_.hLog (h_logging_stream);
832835 control_.Debug ()
833836 << " " << Format (" stepsizes" , 9 )
@@ -842,16 +845,29 @@ void IPM::PrintOutput() {
842845 const bool ipm_optimal = iterate_->feasible () && iterate_->optimal ();
843846
844847 if (kTerminationLogging ) PrintHeader ();
848+ double logging_pobj = iterate_->pobjective_after_postproc ();
849+ double logging_dobj = iterate_->dobjective_after_postproc ();
850+ double logging_presidual = iterate_->presidual ();
851+ double logging_dresidual = iterate_->dresidual ();
852+
853+ // Now logging relative primal and dual infeasibility, and also
854+ // the relative primal dual objective gap
855+ logging_presidual /= (1.0 + iterate_->bounds_measure_ );
856+ logging_dresidual /= (1.0 + iterate_->costs_measure_ );
857+ double logging_gap = std::abs (logging_pobj - logging_dobj) /
858+ (1.0 +0.5 *std::fabs (logging_pobj + logging_dobj));
859+
845860 std::stringstream h_logging_stream;
846861 h_logging_stream.str (std::string ());
847862 h_logging_stream
848863 << " " << Format (info_->iter , 3 )
849864 << (ipm_optimal ? " *" : " " )
850- << " " << Scientific (iterate_->presidual (), 8 , 2 )
851- << " " << Scientific (iterate_->dresidual (), 8 , 2 )
852- << " " << Scientific (iterate_->pobjective_after_postproc (), 15 , 8 )
853- << " " << Scientific (iterate_->dobjective_after_postproc (), 15 , 8 )
854- << " " << Scientific (iterate_->mu (), 8 , 2 );
865+ << " " << Scientific (logging_pobj, 15 , 8 )
866+ << " " << Scientific (logging_dobj, 15 , 8 )
867+ << " " << Scientific (logging_presidual, 9 , 2 )
868+ << " " << Scientific (logging_dresidual, 9 , 2 )
869+ << " " << Scientific (logging_gap, 8 , 2 );
870+ // h_logging_stream << " " << Scientific(iterate_->mu(), 8, 2);
855871 if (!control_.timelessLog ())
856872 h_logging_stream << " " << Fixed (control_.Elapsed (), 6 , 0 ) << " s" ;
857873 control_.hLog (h_logging_stream);
0 commit comments