int-noview.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2002
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
namespace Gecode {
namespace Int { namespace Linear {
class NoView : public ConstView<IntView> {
public:
NoView(void) {}
int min(void) const { return 0; }
int max(void) const { return 0; }
int med(void) const { return 0; }
int val(void) const { return 0; }
unsigned int size(void) const { return 1; }
unsigned int width(void) const { return 1; }
unsigned int regret_min(void) const { return 0; }
unsigned int regret_max(void) const { return 0; }
bool range(void) const { return true; }
bool assigned(void) const { return true; }
bool in(int n) const { (void) n; return false; }
bool in(long long int n) const { (void) n; return false; }
ModEvent lq(Space& home, int n) {
(void) home; (void) n;
return ME_INT_NONE;
}
ModEvent lq(Space& home, long long int n) {
(void) home; (void) n;
return ME_INT_NONE;
}
ModEvent le(Space& home, int n) {
(void) home; (void) n;
return ME_INT_NONE;
}
ModEvent le(Space& home, long long int n) {
(void) home; (void) n;
return ME_INT_NONE;
}
ModEvent gq(Space& home, int n) {
(void) home; (void) n;
return ME_INT_NONE;
}
ModEvent gq(Space& home, long long int n) {
(void) home; (void) n;
return ME_INT_NONE;
}
ModEvent gr(Space& home, int n) {
(void) home; (void) n;
return ME_INT_NONE;
}
ModEvent gr(Space& home, long long int n) {
(void) home; (void) n;
return ME_INT_NONE;
}
ModEvent nq(Space& home, int n) {
(void) home; (void) n;
return ME_INT_NONE;
}
ModEvent nq(Space& home, long long int n) {
(void) home; (void) n;
return ME_INT_NONE;
}
ModEvent eq(Space& home, int n) {
(void) home; (void) n;
return ME_INT_NONE;
}
ModEvent eq(Space& home, long long int n) {
(void) home; (void) n;
return ME_INT_NONE;
}
};
template<class Char, class Traits>
std::basic_ostream<Char,Traits>&
operator <<(std::basic_ostream<Char,Traits>& os, const NoView&) { return os; }
}}
template<>
class ViewArray<Int::Linear::NoView> {
public:
ViewArray(void) {}
ViewArray(Space& home, int m) { (void) home; (void) m; }
ViewArray(const ViewArray<Int::Linear::NoView>&) {}
ViewArray(Space&, const ViewArray<Int::Linear::NoView>&) {}
const ViewArray<Int::Linear::NoView>& operator =(const ViewArray<Int::Linear::NoView>&) { return *this; }
int size(void) const { return 0; }
void size(int n) { (void) n; }
Int::Linear::NoView operator [](int i) {
(void) i;
Int::Linear::NoView n;
return n;
}
const Int::Linear::NoView operator [](int i) const {
(void) i;
Int::Linear::NoView n;
return n;
}
void subscribe(Space&, Propagator& p, PropCond pc, bool process=true) {
(void) p; (void) pc; (void) process;
}
void cancel(Space& home, Propagator& p, PropCond pc) {
(void) home; (void) p; (void) pc;
}
void reschedule(Space& home, Propagator& p, PropCond pc) {
(void) home; (void) p; (void) pc;
}
void update(Space& home, ViewArray<Int::Linear::NoView>& a) {
(void) home; (void) a;
}
void move_fst(int i) { (void) i; }
void move_lst(int i) { (void) i; }
private:
static void* operator new(size_t);
static void operator delete(void*,size_t);
};
}
// STATISTICS: int-prop
Gecode::ConstView
Base-class for constant views.
Definition view.hpp:45
Gecode::Int::Linear::NoView
No view serves as filler for empty view arrays.
Definition int-noview.hpp:42
Gecode::Int::Linear::NoView::regret_min
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value).
Definition int-noview.hpp:66
Gecode::Int::Linear::NoView::med
int med(void) const
Return median of domain (greatest element not greater than the median).
Definition int-noview.hpp:57
Gecode::Int::Linear::NoView::le
ModEvent le(Space &home, long long int n)
Restrict domain values to be less than n.
Definition int-noview.hpp:102
Gecode::Int::Linear::NoView::lq
ModEvent lq(Space &home, long long int n)
Restrict domain values to be less or equal than n.
Definition int-noview.hpp:92
Gecode::Int::Linear::NoView::lq
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition int-noview.hpp:87
Gecode::Int::Linear::NoView::NoView
NoView(void)
Default constructor.
Definition int-noview.hpp:47
Gecode::Int::Linear::NoView::max
int max(void) const
Return maximum of domain.
Definition int-noview.hpp:55
Gecode::Int::Linear::NoView::min
int min(void) const
Return minimum of domain.
Definition int-noview.hpp:53
Gecode::Int::Linear::NoView::size
unsigned int size(void) const
Return size (cardinality) of domain.
Definition int-noview.hpp:62
Gecode::Int::Linear::NoView::val
int val(void) const
Return assigned value (only if assigned).
Definition int-noview.hpp:59
Gecode::Int::Linear::NoView::eq
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition int-noview.hpp:137
Gecode::Int::Linear::NoView::gq
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition int-noview.hpp:107
Gecode::Int::Linear::NoView::eq
ModEvent eq(Space &home, long long int n)
Restrict domain values to be equal to n.
Definition int-noview.hpp:142
Gecode::Int::Linear::NoView::gr
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
Definition int-noview.hpp:117
Gecode::Int::Linear::NoView::width
unsigned int width(void) const
Return width of domain (distance between maximum and minimum).
Definition int-noview.hpp:64
Gecode::Int::Linear::NoView::range
bool range(void) const
Test whether domain is a range.
Definition int-noview.hpp:74
Gecode::Int::Linear::NoView::gq
ModEvent gq(Space &home, long long int n)
Restrict domain values to be greater or equal than n.
Definition int-noview.hpp:112
Gecode::Int::Linear::NoView::assigned
bool assigned(void) const
Test whether view is assigned.
Definition int-noview.hpp:76
Gecode::Int::Linear::NoView::in
bool in(long long int n) const
Test whether n is contained in domain.
Definition int-noview.hpp:81
Gecode::Int::Linear::NoView::nq
ModEvent nq(Space &home, long long int n)
Restrict domain values to be different from n.
Definition int-noview.hpp:132
Gecode::Int::Linear::NoView::gr
ModEvent gr(Space &home, long long int n)
Restrict domain values to be greater than n.
Definition int-noview.hpp:122
Gecode::Int::Linear::NoView::regret_max
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value).
Definition int-noview.hpp:68
Gecode::Int::Linear::NoView::nq
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition int-noview.hpp:127
Gecode::Int::Linear::NoView::le
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
Definition int-noview.hpp:97
Gecode::Int::Linear::NoView::in
bool in(int n) const
Test whether n is contained in domain.
Definition int-noview.hpp:79
Gecode::Int::Linear::NoView::operator<<
std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const NoView &)
Print integer variable view.
Definition int-noview.hpp:155
Gecode::Propagator
Base-class for propagators.
Definition core.hpp:1064
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::ViewArray< Int::Linear::NoView >::size
void size(int n)
Decrease size of array (number of elements).
Definition int-noview.hpp:186
Gecode::ViewArray< Int::Linear::NoView >::ViewArray
ViewArray(void)
Default constructor (array of size 0).
Definition int-noview.hpp:170
Gecode::ViewArray< Int::Linear::NoView >::ViewArray
ViewArray(const ViewArray< Int::Linear::NoView > &)
Initialize.
Definition int-noview.hpp:174
Gecode::ViewArray< Int::Linear::NoView >::subscribe
void subscribe(Space &, Propagator &p, PropCond pc, bool process=true)
Subscribe propagator p with propagation condition pc to all views.
Definition int-noview.hpp:208
Gecode::ViewArray< Int::Linear::NoView >::move_fst
void move_fst(int i)
Move assigned view from position 0 to position i (shift elements to the left).
Definition int-noview.hpp:232
Gecode::ViewArray< Int::Linear::NoView >::update
void update(Space &home, ViewArray< Int::Linear::NoView > &a)
Update array to be a clone of array a.
Definition int-noview.hpp:224
Gecode::ViewArray< Int::Linear::NoView >::ViewArray
ViewArray(Space &, const ViewArray< Int::Linear::NoView > &)
Initialize.
Definition int-noview.hpp:176
Gecode::ViewArray< Int::Linear::NoView >::cancel
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to all views.
Definition int-noview.hpp:212
Gecode::ViewArray< Int::Linear::NoView >::size
int size(void) const
Return size of array (number of elements).
Definition int-noview.hpp:184
Gecode::ViewArray< Int::Linear::NoView >::ViewArray
ViewArray(Space &home, int m)
Allocate array with m variables.
Definition int-noview.hpp:172
Gecode::ViewArray< Int::Linear::NoView >::move_lst
void move_lst(int i)
Move assigned view from position size()-1 to position i (truncate array by one).
Definition int-noview.hpp:234
Gecode::ViewArray< Int::Linear::NoView >::reschedule
void reschedule(Space &home, Propagator &p, PropCond pc)
Schedule propagator p.
Definition int-noview.hpp:216
Gecode::ViewArray::operator[]
View & operator[](int i)
Return view at position i.
Definition array.hpp:1168
Gecode::ViewArray::operator=
const ViewArray< View > & operator=(const ViewArray< View > &a)
Initialize from view array a (share elements).
Definition array.hpp:1149
Gecode::Int::Linear
Linear propagators
Gecode::Int
Finite domain integers.
Gecode::Int::ME_INT_NONE
const Gecode::ModEvent ME_INT_NONE
Domain operation has not changed domain.
Definition var-type.hpp:54
Gecode
Gecode toplevel namespace
Gecode::PropCond
int PropCond
Type for propagation conditions.
Definition core.hpp:72
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition core.hpp:62