bounds Class Reference

A bounds object represents a pair of integer bounds. More...

#include <bounds.hh>

List of all members.

Public Types

enum  bound_type { strict, hint, infinite }
 

Both bounds have one of these types.

More...

Public Member Functions

 bounds ()
 Initialize bounds to infinity in both directions.
 bounds (int value)
 Initialize bounds to a strict equality.
 bounds (int lower, int upper)
 Initialize bounds to a strict range.
 bounds (int lower, bound_type lt, int upper, bound_type ut)
 Initialize bounds to given range and types.
int lower (bool want_limit, int inf)
 Return lower bound.
int upper (bool want_limit, int inf)
 Return upper bound.
double lower (bool want_limit=false, double inf=-std::numeric_limits< double >::infinity())
 Return lower bound as double.
double upper (bool want_limit=false, double inf=std::numeric_limits< double >::infinity())
 Return upper bound as double.
boundsoperator= (int value)
 Set to strict equality.

Public Attributes

int lower_value
 The value of the lower bound, unless the lower bound is of type infinite.
int upper_value
 The value of the upper bound, unless the upper bound is of type infinite.
bound_type lower_type
 The type of the lower bound.
bound_type upper_type
 The type of the upper bound.

Detailed Description

A bounds object represents a pair of integer bounds.

Each bound can have three types, as specified by the enum bounds::bound_type.

Definition at line 35 of file bounds.hh.


Member Enumeration Documentation

Both bounds have one of these types.

Enumerator:
strict 

The bound is a real constraint to be enforced.

This is a real bound that must be encoded in the output.

hint 

A hint for where working with unbounded values is difficult.

The bound given here will always be implied by a set of strict bounds. However as some output formats or solution finding programs may benefit from additional bounds being specified, whenever some loose bound is known, it should be stated as a hint.

infinite 

There is no bound at this side, only infinity.

The value of the bound is irrelevant in this case.

Definition at line 41 of file bounds.hh.


Constructor & Destructor Documentation

bounds::bounds ( int  value  )  [inline]

Initialize bounds to a strict equality.

Parameters:
value the value that will become lower and upper bound.

Definition at line 95 of file bounds.hh.

bounds::bounds ( int  lower,
int  upper 
) [inline]

Initialize bounds to a strict range.

Parameters:
lower the value of the lower bound.
upper the value of the upper bound.

Definition at line 103 of file bounds.hh.

bounds::bounds ( int  lower,
bound_type  lt,
int  upper,
bound_type  ut 
) [inline]

Initialize bounds to given range and types.

Parameters:
lower the value of the lower bound.
lt the type of the lower bound.
upper the value of the upper bound.
ut the type of the upper bound.

Definition at line 113 of file bounds.hh.


Member Function Documentation

double bounds::lower ( bool  want_limit = false,
double  inf = -std::numeric_limits<double>::infinity() 
) [inline]

Return lower bound as double.

Parameters:
want_limit whether a limit should be returned if it is only a hint.
inf the value to be used for infinity.
Returns:
the stored lower bound or the passed inf value.

Definition at line 152 of file bounds.hh.

References hint, lower_type, lower_value, and strict.

int bounds::lower ( bool  want_limit,
int  inf 
) [inline]

Return lower bound.

Parameters:
want_limit whether a limit should be returned if it is only a hint.
inf the value to be used for infinity.
Returns:
the stored lower bound or the passed inf value.

Definition at line 124 of file bounds.hh.

References hint, lower_type, lower_value, and strict.

bounds& bounds::operator= ( int  value  )  [inline]

Set to strict equality.

The lower and upper bound will be set to the specified value.

Parameters:
value the value that will be the new lower and upper bound.
Returns:
a reference to the left hand side of the assignment.

Definition at line 182 of file bounds.hh.

References lower_type, lower_value, strict, upper_type, and upper_value.

double bounds::upper ( bool  want_limit = false,
double  inf = std::numeric_limits<double>::infinity() 
) [inline]

Return upper bound as double.

Parameters:
want_limit whether a limit should be returned if it is only a hint.
inf the value to be used for infinity.
Returns:
the stored lower bound or the passed inf value.

Definition at line 167 of file bounds.hh.

References hint, strict, upper_type, and upper_value.

int bounds::upper ( bool  want_limit,
int  inf 
) [inline]

Return upper bound.

Parameters:
want_limit whether a limit should be returned if it is only a hint.
inf the value to be used for infinity.
Returns:
the stored lower bound or the passed inf value.

Definition at line 138 of file bounds.hh.

References hint, strict, upper_type, and upper_value.


Member Data Documentation

The type of the lower bound.

Definition at line 79 of file bounds.hh.

Referenced by lower(), and operator=().

The type of the upper bound.

Definition at line 82 of file bounds.hh.

Referenced by operator=(), and upper().


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

Generated on Fri Aug 21 08:15:08 2009 for mqn2mps by  doxygen 1.6.0