Generated on Sat Feb 7 2015 02:01:15 for Gecode by doxygen 1.8.9.1
val-commit.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, 2012
8  *
9  * Last modified:
10  * $Date: 2013-07-04 17:03:13 +0200 (Thu, 04 Jul 2013) $ by $Author: schulte $
11  * $Revision: 13801 $
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 Branch {
39 
40  template<class View>
43  : ValCommit<View,int>(home,vb) {}
44  template<class View>
47  : ValCommit<View,int>(home,shared,vc) {}
48  template<class View>
50  ValCommitEq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
51  return (a == 0) ? x.eq(home,n) : x.nq(home,n);
52  }
53  template<class View>
55  ValCommitEq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
56  if (a == 0)
57  return new (home) EqNGL<View>(home,x,n);
58  else
59  return NULL;
60  }
61  template<class View>
62  forceinline void
63  ValCommitEq<View>::print(const Space&, unsigned int a, View, int i,
64  int n, std::ostream& o) const {
65  o << "var[" << i << "] "
66  << ((a == 0) ? "=" : "!=") << " " << n;
67  }
68 
69  template<class View>
72  : ValCommit<View,int>(home,vb) {}
73  template<class View>
76  : ValCommit<View,int>(home,shared,vc) {}
77  template<class View>
79  ValCommitLq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
80  return (a == 0) ? x.lq(home,n) : x.gr(home,n);
81  }
82  template<class View>
84  ValCommitLq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
85  if (a == 0)
86  return new (home) LqNGL<View>(home,x,n);
87  else
88  return NULL;
89  }
90  template<class View>
91  forceinline void
92  ValCommitLq<View>::print(const Space&, unsigned int a, View, int i,
93  int n, std::ostream& o) const {
94  o << "var[" << i << "] "
95  << ((a == 0) ? "<=" : ">") << " " << n;
96  }
97 
98  template<class View>
101  : ValCommit<View,int>(home,vb) {}
102  template<class View>
105  : ValCommit<View,int>(home,shared,vc) {}
106  template<class View>
108  ValCommitGq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
109  return (a == 0) ? x.gq(home,n) : x.le(home,n);
110  }
111  template<class View>
113  ValCommitGq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
114  if (a == 0)
115  return new (home) GqNGL<View>(home,x,n);
116  else
117  return NULL;
118  }
119  template<class View>
120  forceinline void
121  ValCommitGq<View>::print(const Space&, unsigned int a, View, int i,
122  int n, std::ostream& o) const {
123  o << "var[" << i << "] "
124  << ((a == 0) ? ">=" : "<") << " " << n;
125  }
126 
127  template<class View>
130  : ValCommit<View,int>(home,vb) {}
131  template<class View>
134  : ValCommit<View,int>(home,shared,vc) {}
135  template<class View>
137  ValCommitGr<View>::commit(Space& home, unsigned int a, View x, int, int n) {
138  return (a == 0) ? x.gr(home,n) : x.lq(home,n);
139  }
140  template<class View>
142  ValCommitGr<View>::ngl(Space& home, unsigned int a, View x, int n) const {
143  if (a == 0)
144  return new (home) GqNGL<View>(home,x,n+1);
145  else
146  return NULL;
147  }
148  template<class View>
149  forceinline void
150  ValCommitGr<View>::print(const Space&, unsigned int a, View, int i,
151  int n, std::ostream& o) const {
152  o << "var[" << i << "] "
153  << ((a == 0) ? ">" : "<=") << " " << n;
154  }
155 
156 }}}
157 
158 // STATISTICS: int-branch
159 
No-good literal for less or equal.
Definition: branch.hh:457
ValCommitEq(Space &home, const ValBranch &vb)
Constructor for initialization.
Definition: val-commit.hpp:42
No-good literal for greater or equal.
Definition: branch.hh:475
int ModEvent
Type for modification events.
Definition: core.hpp:146
ModEvent commit(Space &home, unsigned int a, View x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition: val-commit.hpp:108
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:55
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:142
void print(const Space &home, unsigned int a, View x, int i, int n, std::ostream &o) const
Print on o the alternative with view x at position i and value n.
Definition: val-commit.hpp:63
Value commit class for less or equal.
Definition: branch.hh:538
Computation spaces.
Definition: core.hpp:1362
No-good literal for equality.
Definition: branch.hh:421
Value commit class for greater.
Definition: branch.hh:582
Base class for value commit.
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:84
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
void print(const Space &home, unsigned int a, View x, int i, int n, std::ostream &o) const
Print on o the alternative with view x at position i and value n.
Definition: val-commit.hpp:92
Value commit class for greater or equal.
Definition: branch.hh:560
void print(const Space &home, unsigned int a, View x, int i, int n, std::ostream &o) const
Print on o the alternative with view x at position i and value n.
Definition: val-commit.hpp:121
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:113
ValCommitLq(Space &home, const ValBranch &vb)
Constructor for initialization.
Definition: val-commit.hpp:71
Value commit class for equality.
Definition: branch.hh:516
Value branching information.
Definition: branch-val.hpp:44
ModEvent commit(Space &home, unsigned int a, View x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition: val-commit.hpp:137
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
ModEvent commit(Space &home, unsigned int a, View x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition: val-commit.hpp:50
#define forceinline
Definition: config.hpp:132
ValCommitGq(Space &home, const ValBranch &vb)
Constructor for initialization.
Definition: val-commit.hpp:100
bool shared(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether views share same variable.
Definition: view.hpp:662
Gecode toplevel namespace
void print(const Space &home, unsigned int a, View x, int i, int n, std::ostream &o) const
Print on o the alternative with view x at position i and value n.
Definition: val-commit.hpp:150
ModEvent commit(Space &home, unsigned int a, View x, int i, int n)
Commit view x at position i to value n for alternative a.
Definition: val-commit.hpp:79
ValCommitGr(Space &home, const ValBranch &vb)
Constructor for initialization.
Definition: val-commit.hpp:129
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
No-good literal recorded during search.
Definition: core.hpp:971