Gecode::Int::ScaleView< Val, UnsVal > Class Template Reference
[Integer views]
Inherits Gecode::DerivedViewBase< IntView >.
Detailed Description
template<class Val, class UnsVal>
class Gecode::Int::ScaleView< Val, UnsVal >
Scale integer view (template).
A scale integer view for an integer view
and a non-negative integer
provides operations such that
behaves as
.
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:
- IntScaleView for scale views with integer precision
- DoubleScaleView for scale views with double precision
Definition at line 569 of file view.icc.
Constructors and initialization | |
ScaleView (void) | |
Default constructor. | |
ScaleView (int b, const IntView &y) | |
Initialize as ![]() | |
void | init (int b, const IntView &y) |
Initialize as ![]() | |
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 ![]() | |
int | ceil_div (double x) const |
Return ![]() | |
int | exact_div (double x, bool &exact) const |
Return ![]() | |
int | floor_div (int) const |
Return ![]() | |
int | ceil_div (int) const |
Return ![]() | |
int | exact_div (int, bool &) const |
Return ![]() | |
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
|
Default constructor.
|
|
Initialize as
|
Member Function Documentation
|
Return
|
|
Return
|
|
Return
|
|
Return
|
|
Return
|
|
Return
|
|
Initialize as
|
|
Return scale factor of scale view.
|
|
Return minimum of domain.
|
|
Return maximum of domain.
|
|
Return median of domain.
|
|
Return assigned value (only if assigned).
|
|
Return size (cardinality) of domain.
|
|
Return width of domain (distance between maximum and minimum).
|
|
Return regret of domain minimum (distance to next larger value).
|
|
Return regret of domain maximum (distance to next smaller value).
|
|
Test whether domain is a range.
|
|
Test whether view is assigned.
|
|
Test whether n is contained in domain.
|
|
Restrict domain values to be less or equal than n.
|
|
Restrict domain values to be less than n.
|
|
Restrict domain values to be greater or equal than n.
|
|
Restrict domain values to be greater than n.
|
|
Restrict domain values to be different from n.
|
|
Restrict domain values to be equal to n.
|
|
Return modification event of propagator p for view.
|
|
Translate modification event me to propagator modification event for view.
|
|
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). |
|
Cancel subscription of propagator p with propagation condition pc to view.
|
|
Update this view to be a clone of view x.
|
Friends And Related Function Documentation
|
Test whether views x and y are the same.
|
|
Test whether view x comes before y (arbitrary order).
|
|
Print integer-precision scale integer view.
|
|
Print double-precision scale integer view.
|
Member Data Documentation
|
Scale factor.
|
The documentation for this class was generated from the following files:
- gecode/int/view.icc (Revision: 3559)
- gecode/int/view/scale.icc (Revision: 3559)