Gecode::Int::ScaleView< Val, UnsVal > Class Template Reference
[Integer views]
Inherits Gecode::DerivedViewBase< Gecode::Int::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 767 of file view.icc.
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 and set exact to true if x is multiple of a. | |
int | floor_div (int) const |
Return . | |
int | ceil_div (int) const |
Return . | |
int | exact_div (int, bool &) const |
Return and set exact to true if x is multiple of a. | |
Constructors and initialization | |
ScaleView (void) | |
Default constructor. | |
ScaleView (int b, const IntView &y) | |
Initialize as . | |
ScaleView (Space *home, const Reflection::VarMap &vars, Reflection::Arg *arg) | |
Initialize from specification. | |
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 view. | |
void | cancel (Space *home, Propagator *p, PropCond pc) |
Cancel subscription of propagator p with propagation condition pc to view. | |
void | subscribe (Space *home, Advisor *a) |
Subscribe advisor a to view. | |
void | cancel (Space *home, Advisor *a) |
Cancel subscription of advisor a. | |
Delta information for advisors | |
Val | min (const Delta *d) const |
Return minimum value just pruned. | |
Val | max (const Delta *d) const |
Return maximum value just pruned. | |
bool | any (const Delta *d) const |
Test whether arbitrary values got pruned. | |
static ModEvent | modevent (const Delta *d) |
Return modification event. | |
Cloning | |
void | update (Space *home, bool share, ScaleView< Val, UnsVal > &x) |
Update this view to be a clone of view x. | |
Reflection | |
Reflection::Arg * | spec (const Space *home, Reflection::VarMap &m) const |
Return specification for this view, using variable map m. | |
static Support::Symbol | type (void) |
Return specification for this view, using variable map m. | |
View-dependent propagator support | |
static void | schedule (Space *home, Propagator *p, ModEvent me) |
Schedule propagator p with modification event me. | |
static ModEvent | me (ModEventDelta med) |
Return modification event for view type in med. | |
static ModEventDelta | med (ModEvent me) |
Translate modification event me to modification event delta for view. | |
View comparison | |
template<class Val, class UnsVal> | |
bool | same (const Int::ScaleView< Val, UnsVal > &x, const Int::ScaleView< Val, UnsVal > &y) |
Test whether views x and y are the same. | |
template<class Val, class UnsVal> | |
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. |
Constructor & Destructor Documentation
Gecode::Int::ScaleView< Val, UnsVal >::ScaleView | ( | void | ) | [inline] |
Gecode::Int::ScaleView< Val, UnsVal >::ScaleView | ( | int | b, | |
const IntView & | y | |||
) | [inline] |
Gecode::Int::ScaleView< Val, UnsVal >::ScaleView | ( | Space * | home, | |
const Reflection::VarMap & | vars, | |||
Reflection::Arg * | arg | |||
) | [inline] |
Member Function Documentation
int Gecode::Int::ScaleView< Val, UnsVal >::floor_div | ( | double | x | ) | const [inline, protected] |
int Gecode::Int::ScaleView< Val, UnsVal >::ceil_div | ( | double | x | ) | const [inline, protected] |
int Gecode::Int::ScaleView< Val, UnsVal >::exact_div | ( | double | x, | |
bool & | exact | |||
) | const [inline, protected] |
int Gecode::Int::ScaleView< Val, UnsVal >::floor_div | ( | int | ) | const [protected] |
Return .
int Gecode::Int::ScaleView< Val, UnsVal >::ceil_div | ( | int | ) | const [protected] |
Return .
int Gecode::Int::ScaleView< Val, UnsVal >::exact_div | ( | int | , | |
bool & | ||||
) | const [protected] |
Return and set exact to true if x is multiple of a.
void Gecode::Int::ScaleView< Val, UnsVal >::init | ( | int | b, | |
const IntView & | y | |||
) | [inline] |
int Gecode::Int::ScaleView< Val, UnsVal >::scale | ( | void | ) | const [inline] |
Val Gecode::Int::ScaleView< Val, UnsVal >::min | ( | void | ) | const [inline] |
Val Gecode::Int::ScaleView< Val, UnsVal >::max | ( | void | ) | const [inline] |
Val Gecode::Int::ScaleView< Val, UnsVal >::med | ( | void | ) | const [inline] |
Val Gecode::Int::ScaleView< Val, UnsVal >::val | ( | void | ) | const [inline] |
UnsVal Gecode::Int::ScaleView< Val, UnsVal >::size | ( | void | ) | const [inline] |
UnsVal Gecode::Int::ScaleView< Val, UnsVal >::width | ( | void | ) | const [inline] |
UnsVal Gecode::Int::ScaleView< Val, UnsVal >::regret_min | ( | void | ) | const [inline] |
UnsVal Gecode::Int::ScaleView< Val, UnsVal >::regret_max | ( | void | ) | const [inline] |
bool Gecode::Int::ScaleView< Val, UnsVal >::range | ( | void | ) | const [inline] |
bool Gecode::Int::ScaleView< Val, UnsVal >::assigned | ( | void | ) | const [inline] |
bool Gecode::Int::ScaleView< Val, UnsVal >::in | ( | Val | n | ) | const [inline] |
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::lq | ( | Space * | home, | |
Val | n | |||
) | [inline] |
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::le | ( | Space * | home, | |
Val | n | |||
) | [inline] |
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::gq | ( | Space * | home, | |
Val | n | |||
) | [inline] |
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::gr | ( | Space * | home, | |
Val | n | |||
) | [inline] |
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::nq | ( | Space * | home, | |
Val | n | |||
) | [inline] |
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::eq | ( | Space * | home, | |
Val | n | |||
) | [inline] |
void Gecode::Int::ScaleView< Val, UnsVal >::schedule | ( | Space * | home, | |
Propagator * | p, | |||
ModEvent | me | |||
) | [inline, static] |
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::me | ( | ModEventDelta | med | ) | [inline, static] |
ModEventDelta Gecode::Int::ScaleView< Val, UnsVal >::med | ( | ModEvent | me | ) | [inline, static] |
void Gecode::Int::ScaleView< Val, UnsVal >::subscribe | ( | Space * | home, | |
Propagator * | p, | |||
PropCond | pc, | |||
bool | process = true | |||
) | [inline] |
void Gecode::Int::ScaleView< Val, UnsVal >::cancel | ( | Space * | home, | |
Propagator * | p, | |||
PropCond | pc | |||
) | [inline] |
void Gecode::Int::ScaleView< Val, UnsVal >::subscribe | ( | Space * | home, | |
Advisor * | a | |||
) | [inline] |
void Gecode::Int::ScaleView< Val, UnsVal >::cancel | ( | Space * | home, | |
Advisor * | a | |||
) | [inline] |
ModEvent Gecode::Int::ScaleView< Val, UnsVal >::modevent | ( | const Delta * | d | ) | [inline, static] |
Val Gecode::Int::ScaleView< Val, UnsVal >::min | ( | const Delta * | d | ) | const [inline] |
Val Gecode::Int::ScaleView< Val, UnsVal >::max | ( | const Delta * | d | ) | const [inline] |
bool Gecode::Int::ScaleView< Val, UnsVal >::any | ( | const Delta * | d | ) | const [inline] |
void Gecode::Int::ScaleView< Val, UnsVal >::update | ( | Space * | home, | |
bool | share, | |||
ScaleView< Val, UnsVal > & | x | |||
) | [inline] |
Reflection::Arg * Gecode::Int::ScaleView< Val, UnsVal >::spec | ( | const Space * | home, | |
Reflection::VarMap & | m | |||
) | const [inline] |
Support::Symbol Gecode::Int::ScaleView< Val, UnsVal >::type | ( | void | ) | [inline, static] |
Friends And Related Function Documentation
bool same | ( | const Int::ScaleView< Val, UnsVal > & | x, | |
const Int::ScaleView< Val, UnsVal > & | y | |||
) | [related] |
bool before | ( | const Int::ScaleView< Val, UnsVal > & | x, | |
const Int::ScaleView< Val, UnsVal > & | y | |||
) | [related] |
std::ostream & operator<< | ( | std::ostream & | , | |
const Gecode::Int::IntScaleView< Val, UnsVal > & | ||||
) | [related] |
Member Data Documentation
int Gecode::Int::ScaleView< Val, UnsVal >::a [protected] |
The documentation for this class was generated from the following files:
- gecode/int/view.icc (Revision: 7297)
- gecode/int/view/scale.icc (Revision: 6017)