val-set.hh
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, 2011
*
* 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.
*
*/
#ifndef __GECODE_INT_VALSET_HH__
#define __GECODE_INT_VALSET_HH__
#include <gecode/int.hh>
namespace Gecode { namespace Int {
class ValSet {
protected:
RangeList* fst;
RangeList* lst;
int n;
public:
ValSet(void);
void add(Space& home, int v);
int size(void) const;
bool empty(void) const;
int min(void) const;
int max(void) const;
template<class View>
Iter::Ranges::CompareStatus compare(View x) const;
template<class View>
bool subset(View x) const;
void update(Space& home, ValSet& vs);
void flush(void);
void dispose(Space& home);
class Ranges {
const RangeList* c;
public:
Ranges(const ValSet& vs);
bool operator ()(void) const;
void operator ++(void);
int min(void) const;
int max(void) const;
unsigned int width(void) const;
};
};
}}
#include <gecode/int/val-set.hpp>
#endif
// STATISTICS: int-other
Gecode::Int::ValSet::Ranges::width
unsigned int width(void) const
Return width of range (distance between minimum and maximum).
Definition val-set.hpp:155
Gecode::Int::ValSet::Ranges::max
int max(void) const
Return largest value of range.
Definition val-set.hpp:150
Gecode::Int::ValSet::Ranges::operator()
bool operator()(void) const
Test whether iterator is still at a range or done.
Definition val-set.hpp:136
Gecode::Int::ValSet::Ranges::operator++
void operator++(void)
Move iterator to next range (if possible).
Definition val-set.hpp:141
Gecode::Int::ValSet::Ranges::Ranges
Ranges(const ValSet &vs)
Initialize.
Definition val-set.hpp:132
Gecode::Int::ValSet::Ranges::min
int min(void) const
Return smallest value of range.
Definition val-set.hpp:146
Gecode::Int::ValSet::size
int size(void) const
Return size (number of values).
Definition val-set.hpp:81
Gecode::Int::ValSet::fst
RangeList * fst
First element of range list.
Definition val-set.hh:47
Gecode::Int::ValSet::subset
bool subset(View x) const
Whether all values of x are included in the value set.
Definition val-set.hpp:171
Gecode::Int::ValSet::ValSet
ValSet(void)
Initialize.
Definition val-set.hpp:41
Gecode::Int::ValSet::empty
bool empty(void) const
Test whether set is empty.
Definition val-set.hpp:86
Gecode::Int::ValSet::max
int max(void) const
Return largest value (provided the set is not empty).
Definition val-set.hpp:96
Gecode::Int::ValSet::compare
Iter::Ranges::CompareStatus compare(View x) const
Compare view x with value set.
Definition val-set.hpp:161
Gecode::Int::ValSet::flush
void flush(void)
Flush entries.
Definition val-set.hpp:121
Gecode::Int::ValSet::dispose
void dispose(Space &home)
Dispose value set.
Definition val-set.hpp:126
Gecode::Int::ValSet::update
void update(Space &home, ValSet &vs)
Update value set during cloning.
Definition val-set.hpp:101
Gecode::Int::ValSet::n
int n
Number of stored values (integer precision is sufficient).
Definition val-set.hh:51
Gecode::Int::ValSet::lst
RangeList * lst
Last element of range list.
Definition val-set.hh:49
Gecode::Int::ValSet::min
int min(void) const
Return smallest value (provided the set is not empty).
Definition val-set.hpp:91
Gecode::Int::ValSet::add
void add(Space &home, int v)
Add value v to value set.
Definition val-set.hpp:45
Gecode::RangeList
Lists of ranges (intervals).
Definition range-list.hpp:49
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::View
int.hh
Gecode::Int
Finite domain integers.
Gecode::Iter::Ranges::CompareStatus
CompareStatus
Comapre two iterators with each other.
Definition ranges-operations.hpp:60
Gecode
Gecode toplevel namespace
val-set.hpp