Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0
int-trace-view.hpp
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Christian Schulte <schulte@gecode.org>
5 *
6 * Copyright:
7 * Christian Schulte, 2016
8 *
9 * This file is part of Gecode, the generic constraint
10 * development environment:
11 * http://www.gecode.org
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 *
32 */
33
34namespace Gecode { namespace Int {
35
38 protected:
41 public:
43 IntTraceView(void);
47 RangeList* ranges(void) const;
49 void prune(Space& home, IntView y, const Delta& d);
51 void update(Space& home, IntTraceView x);
53 static unsigned long long int slack(IntView x);
54 };
55
58
64
67 return dom;
68 }
69
70 forceinline void
72 if (y.range() && (dom->next() == NULL)) {
73 dom->min(y.min()); dom->max(y.max());
74 } else if (!y.any(d) && (y.max(d)+1 == y.min())) {
75 // The lower bound has been adjusted
76 if (y.min() > dom->max()) {
77 RangeList* p = dom;
78 RangeList* l = p->next();
79 while ((l != NULL) && (l->max() < y.min())) {
80 p=l; l=l->next();
81 }
82 dom->dispose(home,p);
83 dom = l;
84 }
85 dom->min(y.min());
86 } else if (!y.any(d) && (y.max()+1 == y.min(d))) {
87 // upper bound has been adjusted
88 if ((y.max() <= dom->max()) && (dom->next() == NULL)) {
89 dom->max(y.max());
90 } else {
91 RangeList* p = dom;
92 RangeList* l = p->next();
93 while ((l != NULL) && (l->min() <= y.max())) {
94 p=l; l=l->next();
95 }
96 p->max(y.max());
97 if (p->next() != NULL)
98 p->next()->dispose(home);
99 p->next(NULL);
100 }
101 } else {
102 // Just copy the domain
104 RangeList::overwrite(home,dom,yr);
105 }
106 }
107
108 forceinline void
113
114 forceinline unsigned long long int
116 return x.width()-1;
117 }
118
119
120}}
121
122// STATISTICS: int-trace
NNF * l
Left subtree.
int p
Number of positive literals for node type.
Generic domain change information to be supplied to advisors.
Definition core.hpp:204
Duplicate of an integer view.
RangeList * dom
Ranges capturing the variable domain.
static unsigned long long int slack(IntView x)
Return slack measure.
RangeList * ranges(void) const
Give access to ranges.
void prune(Space &home, IntView y, const Delta &d)
Update duplicated view from view y and modification delta d.
IntTraceView(void)
Default constructor (initializes with no view)
void update(Space &home, IntTraceView x)
Update during cloning.
Integer view for integer variables.
Definition view.hpp:129
Range iterator for integer views.
Definition view.hpp:54
Range iterator for range lists
Lists of ranges (intervals)
int max(void) const
Return maximum.
int min(void) const
Return minimum.
void dispose(Space &home, RangeList *l)
Free memory for all elements between this and l (inclusive)
RangeList * next(void) const
Return next element.
static void overwrite(Space &home, RangeList *&r, Iter &i)
Overwrite rangelist r with ranges from range iterator i.
static void copy(Space &home, RangeList *&r, Iter &i)
Create rangelist r from range iterator i.
Computation spaces.
Definition core.hpp:1742
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar y
Definition set.hh:767
Post propagator for SetVar x
Definition set.hh:767
#define forceinline
Definition config.hpp:187