trace-view.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, 2016
*
* 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 Set {
class SetTraceView {
protected:
RangeList* _glb;
RangeList* _lub;
public:
SetTraceView(void);
SetTraceView(Space& home, SetView x);
RangeList* glb(void) const;
RangeList* lub(void) const;
void prune(Space& home, SetView y, const Delta& d);
void update(Space& home, SetTraceView x);
static unsigned long long int slack(SetView x);
};
forceinline
SetTraceView::SetTraceView(void) {}
forceinline
SetTraceView::SetTraceView(Space& home, SetView x) {
GlbRanges<SetView> glbi(x);
RangeList::copy(home,_glb,glbi);
LubRanges<SetView> lubi(x);
RangeList::copy(home,_lub,lubi);
}
forceinline RangeList*
SetTraceView::glb(void) const {
return _glb;
}
forceinline RangeList*
SetTraceView::lub(void) const {
return _lub;
}
forceinline void
SetTraceView::prune(Space& home, SetView x, const Delta&) {
GlbRanges<SetView> glbi(x);
RangeList::overwrite(home,_glb,glbi);
LubRanges<SetView> lubi(x);
RangeList::overwrite(home,_lub,lubi);
}
forceinline void
SetTraceView::update(Space& home, SetTraceView x) {
Iter::Ranges::RangeList glbi(x._glb);
RangeList::copy(home,_glb,glbi);
Iter::Ranges::RangeList lubi(x._lub);
RangeList::copy(home,_lub,lubi);
}
forceinline unsigned long long int
SetTraceView::slack(SetView x) {
return x.unknownSize();
}
}}
// STATISTICS: set-trace
Gecode::Delta
Generic domain change information to be supplied to advisors.
Definition core.hpp:204
Gecode::Iter::Ranges::RangeList
Range iterator for range lists
Definition ranges-rangelist.hpp:44
Gecode::RangeList
Lists of ranges (intervals).
Definition range-list.hpp:49
Gecode::RangeList::overwrite
static void overwrite(Space &home, RangeList *&r, Iter &i)
Overwrite rangelist r with ranges from range iterator i.
Definition range-list.hpp:228
Gecode::RangeList::copy
static void copy(Space &home, RangeList *&r, Iter &i)
Create rangelist r from range iterator i.
Definition range-list.hpp:215
Gecode::Set::GlbRanges
Range iterator for the greatest lower bound.
Definition var-imp.hpp:359
Gecode::Set::LubRanges
Range iterator for the least upper bound.
Definition var-imp.hpp:317
Gecode::Set::SetTraceView::update
void update(Space &home, SetTraceView x)
Update during cloning.
Definition trace-view.hpp:85
Gecode::Set::SetTraceView::_glb
RangeList * _glb
Copy of the greatest lower bound.
Definition trace-view.hpp:40
Gecode::Set::SetTraceView::slack
static unsigned long long int slack(SetView x)
Return slack for x.
Definition trace-view.hpp:93
Gecode::Set::SetTraceView::glb
RangeList * glb(void) const
Return range list for greatest lower bound.
Definition trace-view.hpp:70
Gecode::Set::SetTraceView::lub
RangeList * lub(void) const
Return range list for leat upper bound.
Definition trace-view.hpp:74
Gecode::Set::SetTraceView::_lub
RangeList * _lub
Copy of the least upper bound.
Definition trace-view.hpp:42
Gecode::Set::SetTraceView::prune
void prune(Space &home, SetView y, const Delta &d)
Update duplicated view from view y and delta d.
Definition trace-view.hpp:78
Gecode::Set::SetTraceView::SetTraceView
SetTraceView(void)
Default constructor (initializes with no view).
Definition trace-view.hpp:61
Gecode::Set::SetView
Set view for set variables
Definition view.hpp:56
Gecode::Set::SetView::unknownSize
unsigned int unknownSize(void) const
Return the number of unknown elements.
Definition set.hpp:70
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::Set
Finite integer sets.
Definition var-imp.hpp:137
Gecode
Gecode toplevel namespace
forceinline
#define forceinline
Definition config.hpp:187