Generated on Wed Nov 1 15:05:15 2006 for Gecode by doxygen 1.4.5

Gecode::Int::ScaleView< Val, UnsVal > Class Template Reference
[Integer views]

Inherits Gecode::DerivedViewBase< IntView >.

List of all members.


Detailed Description

template<class Val, class UnsVal>
class Gecode::Int::ScaleView< Val, UnsVal >

Scale integer view (template).

A scale integer view $s$ for an integer view $x$ and a non-negative integer $a$ provides operations such that $s$ behaves as $a\cdot x$ .

The precision of a scale integer view is defined by the value types Val and UnsVal. Val can be either int or double where UnsVal must be the unsigned variant of Val (that is, if Val is int, then UnsVal must be unsigned int; if Val is double, then UnsVal must be double as well). The range which is allowed for the two types is defined by the values in Gecode::Limits.

Note that scale integer views currently do not provide operations for updating domains by range iterators.

The template is not to be used directly (as it is very clumsy). Use the following instead:

Definition at line 569 of file view.icc.

Constructors and initialization

 ScaleView (void)
 Default constructor.
 ScaleView (int b, const IntView &y)
 Initialize as $b\cdot y$.
void init (int b, const IntView &y)
 Initialize as $b\cdot y$.
int scale (void) const
 Return scale factor of scale view.

Value access

Val min (void) const
 Return minimum of domain.
Val max (void) const
 Return maximum of domain.
Val med (void) const
 Return median of domain.
Val val (void) const
 Return assigned value (only if assigned).
UnsVal size (void) const
 Return size (cardinality) of domain.
UnsVal width (void) const
 Return width of domain (distance between maximum and minimum).
UnsVal regret_min (void) const
 Return regret of domain minimum (distance to next larger value).
UnsVal regret_max (void) const
 Return regret of domain maximum (distance to next smaller value).

Domain tests

bool range (void) const
 Test whether domain is a range.
bool assigned (void) const
 Test whether view is assigned.
bool in (Val n) const
 Test whether n is contained in domain.

Domain update by value

ModEvent lq (Space *home, Val n)
 Restrict domain values to be less or equal than n.
ModEvent le (Space *home, Val n)
 Restrict domain values to be less than n.
ModEvent gq (Space *home, Val n)
 Restrict domain values to be greater or equal than n.
ModEvent gr (Space *home, Val n)
 Restrict domain values to be greater than n.
ModEvent nq (Space *home, Val n)
 Restrict domain values to be different from n.
ModEvent eq (Space *home, Val n)
 Restrict domain values to be equal to n.

Dependencies

void subscribe (Space *home, Propagator *p, PropCond pc, bool process=true)
 Subscribe propagator p with propagation condition pc to variable.
void cancel (Space *home, Propagator *p, PropCond pc)
 Cancel subscription of propagator p with propagation condition pc to view.

Cloning

void update (Space *home, bool share, ScaleView< Val, UnsVal > &x)
 Update this view to be a clone of view x.

Propagator modification events

static ModEvent pme (const Propagator *p)
 Return modification event of propagator p for view.
static PropModEvent pme (ModEvent me)
 Translate modification event me to propagator modification event for view.

Support functions for division

int floor_div (double x) const
 Return $\lfloor x/a\rfloor$.
int ceil_div (double x) const
 Return $\lceil x/a\rceil$.
int exact_div (double x, bool &exact) const
 Return $x/a$ and set exact to true if x is multiple of a.
int floor_div (int) const
 Return $\lfloor x/a\rfloor$.
int ceil_div (int) const
 Return $\lceil x/a\rceil$.
int exact_div (int, bool &) const
 Return $x/a$ and set exact to true if x is multiple of a.

View comparison

bool same (const Int::ScaleView< Val, UnsVal > &x, const Int::ScaleView< Val, UnsVal > &y)
 Test whether views x and y are the same.
bool before (const Int::ScaleView< Val, UnsVal > &x, const Int::ScaleView< Val, UnsVal > &y)
 Test whether view x comes before y (arbitrary order).

Protected Attributes

int a
 Scale factor.

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &, const Gecode::Int::IntScaleView &)
 Print integer-precision scale integer view.
std::ostream & operator<< (std::ostream &, const Gecode::Int::DoubleScaleView &)
 Print double-precision scale integer view.


Constructor & Destructor Documentation

template<class Val, class UnsVal>
Gecode::Int::ScaleView< Val, UnsVal >::ScaleView void   )  [inline]
 

Default constructor.

Definition at line 87 of file scale.icc.

template<class Val, class UnsVal>
Gecode::Int::ScaleView< Val, UnsVal >::ScaleView int  b,
const IntView y
[inline]
 

Initialize as $b\cdot y$.

Definition at line 91 of file scale.icc.


Member Function Documentation

template<class Val, class UnsVal>
int Gecode::Int::ScaleView< Val, UnsVal >::floor_div double  x  )  const [inline, protected]
 

Return $\lfloor x/a\rfloor$.

Definition at line 32 of file scale.icc.

template<class Val, class UnsVal>
int Gecode::Int::ScaleView< Val, UnsVal >::ceil_div double  x  )  const [inline, protected]
 

Return $\lceil x/a\rceil$.

Definition at line 38 of file scale.icc.

template<class Val, class UnsVal>
int Gecode::Int::ScaleView< Val, UnsVal >::exact_div double  x,
bool &  exact
const [inline, protected]
 

Return $x/a$ and set exact to true if x is multiple of a.

Definition at line 44 of file scale.icc.

template<class Val, class UnsVal>
int Gecode::Int::ScaleView< Val, UnsVal >::floor_div int   )  const [protected]
 

Return $\lfloor x/a\rfloor$.

template<class Val, class UnsVal>
int Gecode::Int::ScaleView< Val, UnsVal >::ceil_div int   )  const [protected]
 

Return $\lceil x/a\rceil$.

template<class Val, class UnsVal>
int Gecode::Int::ScaleView< Val, UnsVal >::exact_div int  ,
bool & 
const [protected]
 

Return $x/a$ and set exact to true if x is multiple of a.

template<class Val, class UnsVal>
void Gecode::Int::ScaleView< Val, UnsVal >::init int  b,
const IntView y
[inline]
 

Initialize as $b\cdot y$.

Definition at line 96 of file scale.icc.

template<class Val, class UnsVal>
int Gecode::Int::ScaleView< Val, UnsVal >::scale void   )  const [inline]
 

Return scale factor of scale view.

Definition at line 102 of file scale.icc.

template<class Val, class UnsVal>
Val Gecode::Int::ScaleView< Val, UnsVal >::min void   )  const [inline]
 

Return minimum of domain.

Definition at line 114 of file scale.icc.

template<class Val, class UnsVal>
Val Gecode::Int::ScaleView< Val, UnsVal >::max void   )  const [inline]
 

Return maximum of domain.

Definition at line 120 of file scale.icc.

template<class Val, class UnsVal>
Val Gecode::Int::ScaleView< Val, UnsVal >::med void   )  const [inline]
 

Return median of domain.

Definition at line 126 of file scale.icc.

template<class Val, class UnsVal>
Val Gecode::Int::ScaleView< Val, UnsVal >::val void   )  const [inline]
 

Return assigned value (only if assigned).

Definition at line 132 of file scale.icc.

template<class Val, class UnsVal>
UnsVal Gecode::Int::ScaleView< Val, UnsVal >::size void   )  const [inline]
 

Return size (cardinality) of domain.

Definition at line 138 of file scale.icc.

template<class Val, class UnsVal>
UnsVal Gecode::Int::ScaleView< Val, UnsVal >::width void   )  const [inline]
 

Return width of domain (distance between maximum and minimum).

Definition at line 144 of file scale.icc.

template<class Val, class UnsVal>
UnsVal Gecode::Int::ScaleView< Val, UnsVal >::regret_min void   )  const [inline]
 

Return regret of domain minimum (distance to next larger value).

Definition at line 150 of file scale.icc.

template<class Val, class UnsVal>
UnsVal Gecode::Int::ScaleView< Val, UnsVal >::regret_max void   )  const [inline]
 

Return regret of domain maximum (distance to next smaller value).

Definition at line 156 of file scale.icc.

template<class Val, class UnsVal>
bool Gecode::Int::ScaleView< Val, UnsVal >::range void   )  const [inline]
 

Test whether domain is a range.

Definition at line 167 of file scale.icc.

template<class Val, class UnsVal>
bool Gecode::Int::ScaleView< Val, UnsVal >::assigned void   )  const [inline]
 

Test whether view is assigned.

Definition at line 173 of file scale.icc.

template<class Val, class UnsVal>
bool Gecode::Int::ScaleView< Val, UnsVal >::in Val  n  )  const [inline]
 

Test whether n is contained in domain.

Definition at line 179 of file scale.icc.

template<class Val, class UnsVal>
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::lq Space home,
Val  n
[inline]
 

Restrict domain values to be less or equal than n.

Definition at line 194 of file scale.icc.

template<class Val, class UnsVal>
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::le Space home,
Val  n
[inline]
 

Restrict domain values to be less than n.

Definition at line 200 of file scale.icc.

template<class Val, class UnsVal>
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::gq Space home,
Val  n
[inline]
 

Restrict domain values to be greater or equal than n.

Definition at line 206 of file scale.icc.

template<class Val, class UnsVal>
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::gr Space home,
Val  n
[inline]
 

Restrict domain values to be greater than n.

Definition at line 211 of file scale.icc.

template<class Val, class UnsVal>
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::nq Space home,
Val  n
[inline]
 

Restrict domain values to be different from n.

Definition at line 217 of file scale.icc.

template<class Val, class UnsVal>
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::eq Space home,
Val  n
[inline]
 

Restrict domain values to be equal to n.

Definition at line 225 of file scale.icc.

template<class Val, class UnsVal>
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::pme const Propagator p  )  [inline, static]
 

Return modification event of propagator p for view.

Definition at line 238 of file scale.icc.

template<class Val, class UnsVal>
PropModEvent Gecode::Int::ScaleView< Val, UnsVal >::pme ModEvent  me  )  [inline, static]
 

Translate modification event me to propagator modification event for view.

Definition at line 244 of file scale.icc.

template<class Val, class UnsVal>
void Gecode::Int::ScaleView< Val, UnsVal >::subscribe Space home,
Propagator p,
PropCond  pc,
bool  process = true
[inline]
 

Subscribe propagator p with propagation condition pc to variable.

In case process is false, the propagator is just subscribed but not processed for execution (this must be used when creating subscriptions during propagation).

Definition at line 256 of file scale.icc.

template<class Val, class UnsVal>
void Gecode::Int::ScaleView< Val, UnsVal >::cancel Space home,
Propagator p,
PropCond  pc
[inline]
 

Cancel subscription of propagator p with propagation condition pc to view.

Definition at line 262 of file scale.icc.

template<class Val, class UnsVal>
void Gecode::Int::ScaleView< Val, UnsVal >::update Space home,
bool  share,
ScaleView< Val, UnsVal > &  x
[inline]
 

Update this view to be a clone of view x.

Definition at line 273 of file scale.icc.


Friends And Related Function Documentation

template<class Val, class UnsVal>
bool same const Int::ScaleView< Val, UnsVal > &  x,
const Int::ScaleView< Val, UnsVal > &  y
[related]
 

Test whether views x and y are the same.

Definition at line 358 of file scale.icc.

template<class Val, class UnsVal>
bool before const Int::ScaleView< Val, UnsVal > &  x,
const Int::ScaleView< Val, UnsVal > &  y
[related]
 

Test whether view x comes before y (arbitrary order).

Definition at line 364 of file scale.icc.

template<class Val, class UnsVal>
std::ostream & operator<< std::ostream &  ,
const Gecode::Int::IntScaleView< Val, UnsVal > & 
[related]
 

Print integer-precision scale integer view.

Definition at line 87 of file print.cc.

template<class Val, class UnsVal>
std::ostream & operator<< std::ostream &  ,
const Gecode::Int::DoubleScaleView< Val, UnsVal > & 
[related]
 

Print double-precision scale integer view.

Definition at line 91 of file print.cc.


Member Data Documentation

template<class Val, class UnsVal>
int Gecode::Int::ScaleView< Val, UnsVal >::a [protected]
 

Scale factor.

Definition at line 572 of file view.icc.


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