Generated on Sat Feb 7 2015 02:01:25 for Gecode by doxygen 1.8.9.1
bool-base.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, 2011
8  *
9  * Last modified:
10  * $Date: 2011-08-11 11:59:30 +0200 (Thu, 11 Aug 2011) $ by $Author: schulte $
11  * $Revision: 12270 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 namespace Gecode { namespace Int { namespace NValues {
39 
40  template<class VY>
43  int status0, ViewArray<BoolView>& x, VY y0)
44  : Propagator(home), status(status0), c(home), y(y0) {
45  y.subscribe(home,*this,PC_INT_BND);
46  for (int i=x.size(); i--; ) {
47  assert(!x[i].assigned());
48  (void) new (home) ViewAdvisor<BoolView>(home, *this, c, x[i]);
49  }
50  }
51 
52  template<class VY>
55  : Propagator(home,share,p), status(p.status) {
56  c.update(home,share,p.c);
57  y.update(home,share,p.y);
58  }
59 
60  template<class VY>
61  PropCost
62  BoolBase<VY>::cost(const Space&, const ModEventDelta&) const {
64  }
65 
66  template<class VY>
69  ViewAdvisor<BoolView>& a(static_cast<ViewAdvisor<BoolView>&>(_a));
70  ExecStatus es;
71  if (status == (VS_ZERO | VS_ONE)) {
72  // Everything is already decided
73  es = ES_FIX;
74  } else {
75  if (a.view().zero())
76  status |= VS_ZERO;
77  else
78  status |= VS_ONE;
79  es = ES_NOFIX;
80  }
81  a.dispose(home,c);
82  if (c.empty())
83  es = ES_NOFIX;
84  return es;
85  }
86 
87  template<class VY>
88  forceinline size_t
90  c.dispose(home);
91  y.cancel(home,*this,PC_INT_BND);
92  (void) Propagator::dispose(home);
93  return sizeof(*this);
94  }
95 
96 }}}
97 
98 // STATISTICS: int-prop
void dispose(Space &home, Council< A > &c)
Delete advisor.
Definition: advisor.hpp:95
Base-class for propagators.
Definition: core.hpp:755
Base-class for advisors.
Definition: core.hpp:926
Propagation has computed fixpoint.
Definition: core.hpp:528
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
Definition: core.hpp:4058
Computation spaces.
Definition: core.hpp:1362
Advisor storing a single view
Definition: advisor.hpp:47
VY y
The view for counting the number of values.
Definition: nvalues.hh:310
Gecode::FloatVal c(-8, 8)
Single _a(2, 3)
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
Gecode::IntArgs i(4, 1, 2, 3, 4)
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition: bool-base.hpp:68
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
Definition: var-type.hpp:91
Number of values propagator for Boolean views base class.
Definition: nvalues.hh:299
View view(void) const
Access view.
Definition: advisor.hpp:84
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Generic domain change information to be supplied to advisors.
Definition: core.hpp:275
virtual size_t dispose(Space &home)
Delete actor and return its size.
Definition: core.hpp:2877
Propagation cost.
Definition: core.hpp:537
ExecStatus
Definition: core.hpp:523
bool assigned(View x, int v)
Whether x is assigned to value v.
Definition: single.hpp:47
#define forceinline
Definition: config.hpp:132
Propagation has not computed fixpoint.
Definition: core.hpp:526
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:1215
Gecode toplevel namespace
BoolBase(Home home, int status, ViewArray< BoolView > &x, VY y)
Constructor for posting.
Definition: bool-base.hpp:42
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: bool-base.hpp:89
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
Council< ViewAdvisor< BoolView > > c
The advisor council.
Definition: nvalues.hh:308
Home class for posting propagators
Definition: core.hpp:717
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low unary)
Definition: bool-base.hpp:62