Detailed Description

Polyhedron in R^n.

This class is a container to hold a matrix A and a vector B to represent the polyhedron {x| Ax<=b}. It provides basic member access and token IO.

To facilitate the ussage of an external library (e.g. PPL) that implements operations on polyhedra, the Polyhedron container can record untyped user data in a (void*) entry. See hyb_compute.cpp for a PLL based implemenation of a reachability analysis.

The token format is as follows:

<AMatrix rows="4" columns="2">
1 0
-1 0
0 1
0 -1
</AMatrix>
<BVector count="4">
1
0
1
0
</BVector>
Polyhedron(void)
Default constructor - sets dimension to 0.

Definition at line 674 of file hyb_parameter.h.

#include <hyb_parameter.h>

Public Member Functions

 Polyhedron (void)
 Default constructor - sets dimension to 0. More...
 
 Polyhedron (int dim)
 Constructor by dimension. More...
 
 Polyhedron (const Polyhedron &rSrc)
 Copy-constructor. More...
 
 Polyhedron (const std::string &rFileName)
 Construct from file. More...
 
virtual ~Polyhedron (void)
 Destructor. More...
 
virtual const std::string & Name (void) const
 Object name. More...
 
virtual void Name (const std::string &name)
 Object name. More...
 
void Clear (void)
 Clear all. More...
 
Idx Size (void) const
 Get size. More...
 
int Dimension (void) const
 Get dimension. More...
 
void Dimension (int dim)
 Set dimension. More...
 
const MatrixA (void) const
 Get A matrix. More...
 
const VectorB (void) const
 Get B vector. More...
 
void AB (const Matrix &rA, const Vector &rB)
 Set A matrix and B vector. More...
 
void UserData (Type *data) const
 Set user data. More...
 
TypeUserData (void) const
 Get user data. More...
 
- Public Member Functions inherited from faudes::Type
 Type (void)
 Constructor. More...
 
 Type (const Type &rType)
 Copy constructor. More...
 
virtual ~Type (void)
 Destructor. More...
 
virtual TypeNew (void) const
 Construct on heap. More...
 
virtual TypeCopy (void) const
 Construct on heap. More...
 
virtual const TypeCast (const Type *pOther) const
 Cast other object to this type. More...
 
virtual TypeAssign (const Type &rSrc)
 Assign configuration data from other object. More...
 
virtual Typeoperator= (const Type &rSrc)
 Assign configurationdata from other object. More...
 
virtual bool Equal (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual bool operator== (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual bool operator!= (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual const std::string & TypeName (void) const
 Get objects's type name. More...
 
void Write (const Type *pContext=0) const
 Write configuration data to console. More...
 
void Write (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 Write configuration data to a file. More...
 
void Write (const std::string &pFileName, std::ios::openmode openmode) const
 Write configuration data to a file. More...
 
void Write (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to TokenWriter. More...
 
virtual void XWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to an XML file. More...
 
void XWrite (const Type *pContext=0) const
 Write configuration data in XML format to concole Note: this write function uses the virtual function DoXWrite(), to be reimplemented by derived classes. More...
 
void XWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in XML format to TokenWriter. More...
 
std::string ToString (const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to a string. More...
 
std::string ToText (const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to a formated string. More...
 
void DWrite (const Type *pContext=0) const
 Write configuration data to console, debugging format. More...
 
void DWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 Write configuration data to a file, debugging format. More...
 
void DWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in debug format to TokenWriter. More...
 
void SWrite (TokenWriter &rTw) const
 Write statistics comment to TokenWriter. More...
 
void SWrite (void) const
 Write statistics comment to console. More...
 
std::string ToSText (void) const
 Write statistics to a string. More...
 
void Read (const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from file with label specified. More...
 
void FromString (const std::string &rString, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from a string. More...
 
void Read (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from TokenReader with label sepcified. More...
 

Protected Member Functions

virtual PolyhedronDoAssign (const Polyhedron &rSrc)
 Assign from other polyhedron. More...
 
virtual bool DoEqual (const Polyhedron &rOther) const
 Test equality. More...
 
virtual void DoWrite (TokenWriter &tw, const std::string &rLabel="", const Type *pContext=0) const
 Write to TokenWriter, see Type::Write for public wrappers. More...
 
virtual void DoSWrite (TokenWriter &tw) const
 Write statistic info to TokenWriter, see Type::SWrite for public wrapper. More...
 
virtual void DoRead (TokenReader &tr, const std::string &rLabel="", const Type *pContext=0)
 Read from TokenReader, see Type::Read for public wrappers. More...
 
- Protected Member Functions inherited from faudes::Type
void DoAssign (const Type &rSrc)
 Assign configuration data from other object. More...
 
bool DoEqual (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual void DoXWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data of this object to TokenWriter in XML format. More...
 
virtual void DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in debugging format to TokenWriter. More...
 
virtual const TypeDefinitionTypeDefinitionp (void) const
 Get objects's type definition. More...
 
virtual Token XBeginTag (const std::string &rLabel="", const std::string &rFallbackLabel="") const
 

Protected Attributes

std::string mName
 name More...
 
Matrix mA
 Polyhedron: data. More...
 
Vector mB
 Polyhedron: data. More...
 
TypempUserData
 User data. More...
 

Constructor & Destructor Documentation

◆ Polyhedron() [1/4]

Polyhedron::Polyhedron ( void  )

Default constructor - sets dimension to 0.

Definition at line 590 of file hyb_parameter.cpp.

◆ Polyhedron() [2/4]

Polyhedron::Polyhedron ( int  dim)

Constructor by dimension.

Parameters
dimdimension

Definition at line 599 of file hyb_parameter.cpp.

◆ Polyhedron() [3/4]

Polyhedron::Polyhedron ( const Polyhedron rSrc)

Copy-constructor.

Definition at line 616 of file hyb_parameter.cpp.

◆ Polyhedron() [4/4]

Polyhedron::Polyhedron ( const std::string &  rFileName)

Construct from file.

Definition at line 626 of file hyb_parameter.cpp.

◆ ~Polyhedron()

Polyhedron::~Polyhedron ( void  )
virtual

Destructor.

Definition at line 637 of file hyb_parameter.cpp.

Member Function Documentation

◆ A()

const Matrix & Polyhedron::A ( void  ) const

Get A matrix.

Definition at line 693 of file hyb_parameter.cpp.

◆ AB()

void Polyhedron::AB ( const Matrix rA,
const Vector rB 
)

Set A matrix and B vector.

Parameters
rAA matrix
rBB vector
Exceptions
Exception
  • dimension missmatch (id 700);

Definition at line 703 of file hyb_parameter.cpp.

◆ B()

const Vector & Polyhedron::B ( void  ) const

Get B vector.

Definition at line 698 of file hyb_parameter.cpp.

◆ Clear()

void Polyhedron::Clear ( void  )
virtual

Clear all.

Sets dimension to 0

Reimplemented from faudes::Type.

Definition at line 661 of file hyb_parameter.cpp.

◆ Dimension() [1/2]

void Polyhedron::Dimension ( int  dim)

Set dimension.

This will invalidate A and B.

Parameters
dimNew dimension

Definition at line 673 of file hyb_parameter.cpp.

◆ Dimension() [2/2]

int Polyhedron::Dimension ( void  ) const

Get dimension.

Gets the dimension of the polyhedron (number of columns of A).

Returns
dimension

Definition at line 687 of file hyb_parameter.cpp.

◆ DoAssign()

Polyhedron & Polyhedron::DoAssign ( const Polyhedron rSrc)
protectedvirtual

Assign from other polyhedron.

Parameters
rSrcSource to copy from
Returns
Ref to this polyhedron

Definition at line 643 of file hyb_parameter.cpp.

◆ DoEqual()

bool Polyhedron::DoEqual ( const Polyhedron rOther) const
protectedvirtual

Test equality.

Note: this test refers to the plain parameters as oposed to the actual polyhedron.

Parameters
rOtherOther object to compare with.
Returns
True on match.

Definition at line 653 of file hyb_parameter.cpp.

◆ DoRead()

void Polyhedron::DoRead ( TokenReader tr,
const std::string &  rLabel = "",
const Type pContext = 0 
)
protectedvirtual

Read from TokenReader, see Type::Read for public wrappers.

The method invokes TokenReader::ReadBegin() to seek the specified section, reads subsequent symbols, and calls matching TokenReader::ReadEnd(). If no section is specified, the section is assumed to start at the current position of the token stream. If the current position is no begin token, the section "Polyhedron" is read.

Parameters
trReference to TokenReader
rLabelLabel to read, defaults to current begin label or else "Polyhedron"
pContextWrite context to provide contextual information
Exceptions
Exception
  • IO errors (id 1)
  • token mismatch (id 50)

Reimplemented from faudes::Type.

Definition at line 762 of file hyb_parameter.cpp.

◆ DoSWrite()

void Polyhedron::DoSWrite ( TokenWriter tw) const
protectedvirtual

Write statistic info to TokenWriter, see Type::SWrite for public wrapper.

Parameters
twReference to TokenWriter
Exceptions
Exception
  • IO errors (id 2)

Reimplemented from faudes::Type.

Definition at line 753 of file hyb_parameter.cpp.

◆ DoWrite()

void Polyhedron::DoWrite ( TokenWriter tw,
const std::string &  rLabel = "",
const Type pContext = 0 
) const
protectedvirtual

Write to TokenWriter, see Type::Write for public wrappers.

Parameters
twReference to TokenWriter
rLabelLabel of the section to write, defaults to name of set or "Polyhedron"
pContextWrite context to provide contextual information (ignores)
Exceptions
Exception
  • IO errors (id 2)

Reimplemented from faudes::Type.

Definition at line 732 of file hyb_parameter.cpp.

◆ Name() [1/2]

virtual void faudes::Polyhedron::Name ( const std::string &  name)
inlinevirtual

Object name.

Parameters
nameSet to specifies name

Reimplemented from faudes::Type.

Definition at line 725 of file hyb_parameter.h.

◆ Name() [2/2]

virtual const std::string& faudes::Polyhedron::Name ( void  ) const
inlinevirtual

Object name.

Returns
name

Reimplemented from faudes::Type.

Definition at line 717 of file hyb_parameter.h.

◆ Size()

Idx Polyhedron::Size ( void  ) const

Get size.

Gets the number of inequalities (number of rows of A).

Returns
number of equations

Definition at line 667 of file hyb_parameter.cpp.

◆ UserData() [1/2]

void Polyhedron::UserData ( Type data) const

Set user data.

The polyhedron takes ownership of the provided memory. On write access on the defining parameters, the user data gets invalidated by means of "delete". The internal pointer is then set to NULL.

Definition at line 718 of file hyb_parameter.cpp.

◆ UserData() [2/2]

Type * Polyhedron::UserData ( void  ) const

Get user data.

Returns
Pointer to user data, or NULL if no valid data is available

Definition at line 725 of file hyb_parameter.cpp.

Member Data Documentation

◆ mA

Matrix faudes::Polyhedron::mA
protected

Polyhedron: data.

Definition at line 821 of file hyb_parameter.h.

◆ mB

Vector faudes::Polyhedron::mB
protected

Polyhedron: data.

Definition at line 824 of file hyb_parameter.h.

◆ mName

std::string faudes::Polyhedron::mName
protected

name

Definition at line 818 of file hyb_parameter.h.

◆ mpUserData

Type* faudes::Polyhedron::mpUserData
protected

User data.

Definition at line 827 of file hyb_parameter.h.


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

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen