Journalist Class Reference

#include <IpJournalist.hpp>

Inheritance diagram for Journalist:

ReferencedObject

List of all members.


Detailed Description

Class responsible for all message output.

This class is responsible for all messaging and output. The "printing" code or "author" should send ALL messages to the Journalist, indicating an appropriate category and print level. The journalist then decides, based on reader specified acceptance criteria, which message is actually printed in which journals. This allows the printing code to send everything, while the "reader" can decide what they really want to see.

Authors: Authors use the Journals: You can add as many Journals as you like to the Journalist with the AddJournal or the AddFileJournal methods. Each one represents a different printing location (or file). Then, you can call the "print" methods of the Journalist to output information to each of the journals.

Acceptance Criteria: Each print message should be flagged appropriately with an EJournalCategory and EJournalLevel.

The AddFileJournal method returns a pointer to the newly created Journal object (if successful) so you can set Acceptance criteria for that particular location.

Public Member Functions

Constructor / Desructor.
 Journalist ()
 Constructor.
virtual ~Journalist ()
 Destructor.
Author Methods.
These methods are used by authoring code, or code that wants to report some information.

void Printf (EJournalLevel level, EJournalCategory category, const char *format,...) const
 Method to print a formatted string.
void PrintStringOverLines (EJournalLevel level, EJournalCategory category, Index indent_spaces, Index max_length, const std::string &line) const
 Method to print a long string including indentation.
void PrintfIndented (EJournalLevel level, EJournalCategory category, Index indent_level, const char *format,...) const
 Method to print a formatted string with indentation.
void VPrintf (EJournalLevel level, EJournalCategory category, const char *pformat, va_list ap) const
 Method to print a formatted string using the va_list argument.
void VPrintfIndented (EJournalLevel level, EJournalCategory category, Index indent_level, const char *pformat, va_list ap) const
 Method to print a formatted string with indentation, using the va_list argument.
bool ProduceOutput (EJournalLevel level, EJournalCategory category) const
 Method that returns true if there is a Journal that would write output for the given JournalLevel and JournalCategory.
void FlushBuffer () const
 Method that flushes the current buffer for all Journalists.
Reader Methods.
These methods are used by the reader.

The reader will setup the journalist with each output file and the acceptance criteria for that file.

Use these methods to setup the journals (files or other output). These are the internal objects that keep track of the print levels for each category. Then use the internal Journal objects to set specific print levels for each category (or keep defaults).

bool AddJournal (const SmartPtr< Journal > jrnl)
 Add a new journal.
SmartPtr< JournalAddFileJournal (const std::string &location_name, const std::string &fname, EJournalLevel default_level=J_WARNING)
 Add a new FileJournal.
SmartPtr< JournalGetJournal (const std::string &location_name)
 Get an existing journal.


Constructor & Destructor Documentation

Journalist (  ) 

Constructor.

~Journalist (  )  [virtual]

Destructor.

..


Member Function Documentation

void Printf ( EJournalLevel  level,
EJournalCategory  category,
const char *  format,
  ... 
) const

Method to print a formatted string.

References Journalist::VPrintf().

Referenced by BacktrackingLineSearch::ActivateFallbackMechanism(), QualityFunctionMuOracle::CalculateMu(), ProbingMuOracle::CalculateMu(), LoqoMuOracle::CalculateMu(), FilterLSAcceptor::CheckAcceptabilityOfTrialPoint(), RestoFilterConvergenceCheck::CheckConvergence(), StandardScalingBase::DetermineScaling(), GradientScaling::DetermineScalingParametersImpl(), BacktrackingLineSearch::FindAcceptableTrialPoint(), TSymLinearSolver::IncreaseQuality(), FilterLSAcceptor::IsAcceptableToCurrentIterate(), DefaultIterateInitializer::least_square_mults(), StdAugSystemSolver::MultiSolve(), IpoptAlgorithm::Optimize(), RegisteredOption::OutputDescription(), RegisteredOption::OutputLatexDescription(), RegisteredOptions::OutputOptionDocumentation(), RegisteredOption::OutputShortDescription(), RestoRestorationPhase::PerformRestoration(), MinC_1NrmRestorationPhase::PerformRestoration(), PDPerturbationHandler::PerturbForSingularity(), Filter::Print(), TimingStatistics::PrintAllTimingStatistics(), ZeroMatrix::PrintImpl(), SymTMatrix::PrintImpl(), SymScaledMatrix::PrintImpl(), SumSymMatrix::PrintImpl(), SumMatrix::PrintImpl(), ScaledMatrix::PrintImpl(), MultiVectorMatrix::PrintImpl(), LowRankUpdateSymMatrix::PrintImpl(), IdentityMatrix::PrintImpl(), GenTMatrix::PrintImpl(), ExpansionMatrix::PrintImpl(), DiagMatrix::PrintImpl(), DenseSymMatrix::PrintImpl(), DenseGenMatrix::PrintImpl(), CompoundVector::PrintImpl(), CompoundSymMatrix::PrintImpl(), CompoundMatrix::PrintImpl(), Journalist::PrintStringOverLines(), OrigIpoptNLP::PrintTimingStatistics(), DefaultIterateInitializer::push_variables(), OptionsList::ReadFromStream(), IpoptException::ReportException(), WarmStartIterateInitializer::SetInitialIterates(), RestoIterateInitializer::SetInitialIterates(), PDFullSpaceSolver::Solve(), LowRankAugSystemSolver::Solve(), FilterLSAcceptor::TryCorrector(), FilterLSAcceptor::TrySecondOrderCorrection(), MonotoneMuUpdate::UpdateBarrierParameter(), AdaptiveMuUpdate::UpdateBarrierParameter(), LimMemQuasiNewtonUpdater::UpdateHessian(), RestoIterationOutput::WriteOutput(), and OrigIterationOutput::WriteOutput().

void PrintStringOverLines ( EJournalLevel  level,
EJournalCategory  category,
Index  indent_spaces,
Index  max_length,
const std::string &  line 
) const

Method to print a long string including indentation.

The string is printed starting at the current position. If the position (counting started at the current position) exceeds max_length, a new line is inserted, and indent_spaces many spaces are printed before the string is continued. This is for example used during the printing of the option documentation.

References DBG_ASSERT, fkinkryx::i, and Journalist::Printf().

Referenced by RegisteredOption::OutputLatexDescription(), and RegisteredOption::OutputShortDescription().

void PrintfIndented ( EJournalLevel  level,
EJournalCategory  category,
Index  indent_level,
const char *  format,
  ... 
) const

void VPrintf ( EJournalLevel  level,
EJournalCategory  category,
const char *  pformat,
va_list  ap 
) const

Method to print a formatted string using the va_list argument.

References fkinkryx::i.

Referenced by Journalist::Printf().

void VPrintfIndented ( EJournalLevel  level,
EJournalCategory  category,
Index  indent_level,
const char *  pformat,
va_list  ap 
) const

Method to print a formatted string with indentation, using the va_list argument.

References fkinkryx::i.

Referenced by Journalist::PrintfIndented().

bool ProduceOutput ( EJournalLevel  level,
EJournalCategory  category 
) const

Method that returns true if there is a Journal that would write output for the given JournalLevel and JournalCategory.

This is useful if expensive computation would be required for a particular output. The author code can check with this method if the computations are indeed required.

References fkinkryx::i.

Referenced by GradientScaling::DetermineScalingParametersImpl(), MinC_1NrmRestorationPhase::PerformRestoration(), Vector::Print(), Matrix::Print(), Filter::Print(), TimingStatistics::PrintAllTimingStatistics(), and OrigIpoptNLP::PrintTimingStatistics().

void FlushBuffer (  )  const

Method that flushes the current buffer for all Journalists.

Calling this method after one optimization run helps to avoid cluttering output with that produced by other parts of the program (e.g. written in Fortran)

References fkinkryx::i.

bool AddJournal ( const SmartPtr< Journal jrnl  ) 

Add a new journal.

The location_name is a string identifier, which can be used to obtain the pointer to the new Journal at a later point using the GetJournal method. The default_level is used to initialize the * printing level for all categories.

References DBG_ASSERT, Journalist::GetJournal(), Ipopt::IsNull(), and Ipopt::IsValid().

Referenced by Journalist::AddFileJournal().

SmartPtr< Journal > AddFileJournal ( const std::string &  location_name,
const std::string &  fname,
EJournalLevel  default_level = J_WARNING 
)

Add a new FileJournal.

fname is the name of the * file to which this Journal corresponds. Use fname="stdout" * for stdout, and use fname="stderr" for stderr. This method * returns the Journal pointer so you can set specific acceptance criteria. It returns NULL if there was a problem creating a new Journal.

Parameters:
fname  identifier

References Journalist::AddJournal(), and Ipopt::GetRawPtr().

SmartPtr< Journal > GetJournal ( const std::string &  location_name  ) 

Get an existing journal.

You can use this method to change the acceptance criteria at runtime.

References fkinkryx::i.

Referenced by Journalist::AddJournal().


The documentation for this class was generated from the following files:

Generated on Fri Sep 26 07:44:26 2008 for SimTKcore by  doxygen 1.5.6