bande::Solutions Class Reference

Handle solutions once they are found. More...

#include <Solutions.hh>

Collaboration diagram for bande::Solutions:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Solutions ()
 Constructor.
virtual ~Solutions ()
 Destructor.
void writeToFile (const std::string &file)
 Write all future solutions to the specified file.
void writeToFile (const char *file)
 Write all future solutions to the specified file.
void writeToStream (std::ostream &outStream)
 Write all future solutions to the specified stream.
void solution (const IntegerProgram &ip)
 Method invoked for every solution found.

Private Member Functions

void writeSolution (const IntegerProgram &ip)
 Write solution to output stream.
void clearOut ()
 Ensure proper cleanup.

Private Attributes

std::ostream * out
 Pointer to the stream to which solutions are written.
bool ownOut
 Indicates own was created by this object.

Detailed Description

Handle solutions once they are found.

Definition at line 32 of file Solutions.hh.


Member Function Documentation

void bande::Solutions::clearOut (  )  [private]

Ensure proper cleanup.

This deletes the output stream if this object created it in the first place.

Definition at line 57 of file Solutions.cc.

References out, and ownOut.

Referenced by writeToFile(), writeToStream(), and ~Solutions().

void bande::Solutions::solution ( const IntegerProgram ip  ) 

Method invoked for every solution found.

Right now it only writes the solution, but a future version might store the solution for postprocessing or something like this.

Parameters:
ip the integer program in the starte representing the current solution.

Definition at line 73 of file Solutions.cc.

References writeSolution().

Referenced by bande::BranchControl::branch().

void bande::Solutions::writeSolution ( const IntegerProgram ip  )  [private]

Write solution to output stream.

The solution is written as a single line, with columns separated by tabs. Each column gives the name of one problem variable, an equals sign, and the value of that variable in the current solution. Variables with a value of zero are omitted.

Parameters:
ip the integer program in the starte representing the current solution.

Definition at line 88 of file Solutions.cc.

References bande::IntegerProgram::getColName(), bande::IntegerProgram::getIntSolution(), bande::IntegerProgram::getNumCols(), and out.

Referenced by solution().

void bande::Solutions::writeToFile ( const char *  file  ) 

Write all future solutions to the specified file.

Parameters:
file the file to which solutions will be written.

Definition at line 35 of file Solutions.cc.

References clearOut(), out, and ownOut.

void bande::Solutions::writeToFile ( const std::string &  file  )  [inline]

Write all future solutions to the specified file.

Parameters:
file the file to which solutions will be written.

Definition at line 49 of file Solutions.hh.

References writeToFile().

Referenced by bande::Settings::run(), and writeToFile().

void bande::Solutions::writeToStream ( std::ostream &  outStream  ) 

Write all future solutions to the specified stream.

The stream will nod be closed at the end.

Parameters:
outStream the stream to which solutions will be written.

Definition at line 46 of file Solutions.cc.

References clearOut(), out, and ownOut.


Member Data Documentation

Indicates own was created by this object.

If this is the case, then we should take care of its eventual destruction as well.

Definition at line 70 of file Solutions.hh.

Referenced by clearOut(), writeToFile(), and writeToStream().


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

Generated on Fri Aug 21 08:17:19 2009 for bande by  doxygen 1.6.0