Generated on Fri Jan 28 2022 04:43:06 for Gecode by doxygen 1.8.13
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  * 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 
34 namespace Gecode { namespace Int { namespace Branch {
35 
36  template<class View>
39  : ValCommit<View,int>(home,vb) {}
40  template<class View>
43  : ValCommit<View,int>(home,vc) {}
44  template<class View>
46  ValCommitEq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
47  return (a == 0) ? x.eq(home,n) : x.nq(home,n);
48  }
49  template<class View>
51  ValCommitEq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
52  if (a == 0)
53  return new (home) EqNGL<View>(home,x,n);
54  else
55  return NULL;
56  }
57  template<class View>
58  forceinline void
59  ValCommitEq<View>::print(const Space&, unsigned int a, View, int i,
60  int n, std::ostream& o) const {
61  o << "var[" << i << "] "
62  << ((a == 0) ? "=" : "!=") << " " << n;
63  }
64 
65  template<class View>
68  : ValCommit<View,int>(home,vb) {}
69  template<class View>
72  : ValCommit<View,int>(home,vc) {}
73  template<class View>
75  ValCommitLq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
76  return (a == 0) ? x.lq(home,n) : x.gr(home,n);
77  }
78  template<class View>
80  ValCommitLq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
81  if (a == 0)
82  return new (home) LqNGL<View>(home,x,n);
83  else
84  return NULL;
85  }
86  template<class View>
87  forceinline void
88  ValCommitLq<View>::print(const Space&, unsigned int a, View, int i,
89  int n, std::ostream& o) const {
90  o << "var[" << i << "] "
91  << ((a == 0) ? "<=" : ">") << " " << n;
92  }
93 
94  template<class View>
97  : ValCommit<View,int>(home,vb) {}
98  template<class View>
101  : ValCommit<View,int>(home,vc) {}
102  template<class View>
104  ValCommitGq<View>::commit(Space& home, unsigned int a, View x, int, int n) {
105  return (a == 0) ? x.gq(home,n) : x.le(home,n);
106  }
107  template<class View>
109  ValCommitGq<View>::ngl(Space& home, unsigned int a, View x, int n) const {
110  if (a == 0)
111  return new (home) GqNGL<View>(home,x,n);
112  else
113  return NULL;
114  }
115  template<class View>
116  forceinline void
117  ValCommitGq<View>::print(const Space&, unsigned int a, View, int i,
118  int n, std::ostream& o) const {
119  o << "var[" << i << "] "
120  << ((a == 0) ? ">=" : "<") << " " << n;
121  }
122 
123  template<class View>
126  : ValCommit<View,int>(home,vb) {}
127  template<class View>
130  : ValCommit<View,int>(home,vc) {}
131  template<class View>
133  ValCommitGr<View>::commit(Space& home, unsigned int a, View x, int, int n) {
134  return (a == 0) ? x.gr(home,n) : x.lq(home,n);
135  }
136  template<class View>
138  ValCommitGr<View>::ngl(Space& home, unsigned int a, View x, int n) const {
139  if (a == 0)
140  return new (home) GqNGL<View>(home,x,n+1);
141  else
142  return NULL;
143  }
144  template<class View>
145  forceinline void
146  ValCommitGr<View>::print(const Space&, unsigned int a, View, int i,
147  int n, std::ostream& o) const {
148  o << "var[" << i << "] "
149  << ((a == 0) ? ">" : "<=") << " " << n;
150  }
151 
152 }}}
153 
154 // STATISTICS: int-branch
155 
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:146
No-good literal for less or equal.
Definition: branch.hh:447
ValCommitGr(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition: val-commit.hpp:125
No-good literal for greater or equal.
Definition: branch.hh:465
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:117
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:109
int ModEvent
Type for modification events.
Definition: core.hpp:62
ValCommitEq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition: val-commit.hpp:38
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:104
#define forceinline
Definition: config.hpp:185
Value commit class for less or equal.
Definition: branch.hh:529
Computation spaces.
Definition: core.hpp:1701
No-good literal for equality.
Definition: branch.hh:411
Value commit class for greater.
Definition: branch.hh:575
Base class for value commit.
Definition: val-commit.hpp:44
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
Gecode::IntArgs i({1, 2, 3, 4})
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:138
ValCommitGq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition: val-commit.hpp:96
Value commit class for greater or equal.
Definition: branch.hh:552
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:51
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:88
Value commit class for equality.
Definition: branch.hh:506
NGL * ngl(Space &home, unsigned int a, View x, int n) const
Create no-good literal for alternative a.
Definition: val-commit.hpp:80
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:59
Value branching information.
Definition: val.hpp:41
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:133
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:46
Post propagator for SetVar x
Definition: set.hh:767
Gecode toplevel namespace
ValCommitLq(Space &home, const ValBranch< Var > &vb)
Constructor for initialization.
Definition: val-commit.hpp:67
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:75
struct Gecode::@593::NNF::@62::@64 a
For atomic nodes.
No-good literal recorded during search.
Definition: core.hpp:1299