@@ -821,13 +821,15 @@ void IPM::PrintHeader() {
821821 std::stringstream h_logging_stream;
822822 h_logging_stream.str (std::string ());
823823 h_logging_stream
824- << (kTerminationLogging ? " \n " : " " )
825- << " " << 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 );
824+ << " " << Format (" Iter" , 4 )
825+ << " " << Format (" primal obj" , 15 )
826+ << " " << Format (" dual obj" , 15 )
827+ << " " << Format (" pinf" , 9 )
828+ << " " << Format (" dinf" , 9 )
829+ << " " << Format (" gap" , 8 );
830+ // h_logging_stream << " " << Format("mu", 8);
829831 if (!control_.timelessLog ())
830- h_logging_stream << " " << Format (" Time " , 7 );
832+ h_logging_stream << " " << Format (" time " , 7 );
831833 control_.hLog (h_logging_stream);
832834 control_.Debug ()
833835 << " " << Format (" stepsizes" , 9 )
@@ -841,17 +843,29 @@ void IPM::PrintHeader() {
841843void IPM::PrintOutput () {
842844 const bool ipm_optimal = iterate_->feasible () && iterate_->optimal ();
843845
844- if (kTerminationLogging ) PrintHeader ();
846+ double logging_pobj = iterate_->pobjective_after_postproc ();
847+ double logging_dobj = iterate_->dobjective_after_postproc ();
848+ double logging_presidual = iterate_->presidual ();
849+ double logging_dresidual = iterate_->dresidual ();
850+
851+ // Now logging relative primal and dual infeasibility, and also
852+ // the relative primal dual objective gap
853+ logging_presidual /= iterate_->bounds_measure_ ;
854+ logging_dresidual /= iterate_->costs_measure_ ;
855+ double logging_gap = std::abs (logging_pobj - logging_dobj) /
856+ (1.0 +0.5 *std::fabs (logging_pobj + logging_dobj));
857+
845858 std::stringstream h_logging_stream;
846859 h_logging_stream.str (std::string ());
847860 h_logging_stream
848861 << " " << Format (info_->iter , 3 )
849862 << (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 );
863+ << " " << Scientific (logging_pobj, 15 , 8 )
864+ << " " << Scientific (logging_dobj, 15 , 8 )
865+ << " " << Scientific (logging_presidual, 9 , 2 )
866+ << " " << Scientific (logging_dresidual, 9 , 2 )
867+ << " " << Scientific (logging_gap, 8 , 2 );
868+ // h_logging_stream << " " << Scientific(iterate_->mu(), 8, 2);
855869 if (!control_.timelessLog ())
856870 h_logging_stream << " " << Fixed (control_.Elapsed (), 6 , 0 ) << " s" ;
857871 control_.hLog (h_logging_stream);
0 commit comments