Debian Codegraph @

libbrial/include/polybori/routines/pbori_routines_order.h

raw symbols SCIP
1 // -*- c++ -*-cxx . . $ `<file>/libbrial/include/polybori/routines/pbori_routines_order.h`/
2 //*****************************************************************************
3 /** @file pbori_routines_order.h
4 *
5 * @author Alexander Dreyer
6 * @date 2006-08-23
7 *
8 * This file includes files, which defines ordering-related function templates.
9 *
10 * @par Copyright:
11 * (c) 2006 by The PolyBoRi Team
12 *
13 **/
14 //*****************************************************************************
15
16 #ifndef polybori_routines_pbori_routines_order_h_
17 #define polybori_routines_pbori_routines_order_h_cxx . . $ `libbrial/include/polybori/routines/pbori_routines_order.h:17:9`!
18
19 // include basic definitions
20 #include <polybori/pbori_defs.h>cxx . . $ `<file>/libbrial/include/polybori/pbori_defs.h`/
21 #include "pbori_algo.h"cxx . . $ `<file>/libbrial/include/polybori/routines/pbori_algo.h`/
22 #include <polybori/common/traits.h>cxx . . $ `<file>/libbrial/include/polybori/common/traits.h`/
23
24
25 BEGIN_NAMESPACE_PBORIcxx . . $ `libbrial/include/polybori/pbori_defs.h:74:11`!
26
27 template <class FirstIterator, class SecondIterator, class BinaryPredicate>
28 CTypescxx . . $ polybori/CTypes#::comp_typecxx . . $ polybori/CAuxTypes#comp_type#
29 lex_compare_3waycxx . . $ polybori/lex_compare_3way(a55274d5e569378d).(FirstIterator start, FirstIterator finish,
30 SecondIterator rhs_start, SecondIterator rhs_finish,
31 BinaryPredicate idx_comp) {
32
33 while ( (start !=cxx . . $ polybori/`operator!=`(166981e292dfc570). finish) && (rhs_start !=cxx . . $ polybori/`operator!=`(166981e292dfc570). rhs_finish) &&
34 (*start ==cxx . . $ polybori/`operator==`(166981e292dfc570). *rhs_start) ) {
35 ++start; ++rhs_start;
36 }
37
38 if (start ==cxx . . $ polybori/`operator==`(166981e292dfc570). finish) {
39 if (rhs_start ==cxx . . $ polybori/`operator==`(166981e292dfc570). rhs_finish)
40 return CTypescxx . . $ polybori/CTypes#::equalitycxx . . $ polybori/CCompareEnums#equality.;
41
42 return CTypescxx . . $ polybori/CTypes#::less_thancxx . . $ polybori/CCompareEnums#less_than.;
43 }
44
45 if (rhs_start ==cxx . . $ polybori/`operator==`(166981e292dfc570). rhs_finish)
46 return CTypescxx . . $ polybori/CTypes#::greater_thancxx . . $ polybori/CCompareEnums#greater_than.;
47
48 return (idx_comp(*start, *rhs_start)?
49 CTypescxx . . $ polybori/CTypes#::greater_thancxx . . $ polybori/CCompareEnums#greater_than.: CTypescxx . . $ polybori/CTypes#::less_thancxx . . $ polybori/CCompareEnums#less_than.);
50 }
51
52
53 /// defines lexicographic comparison
54 template <class LhsType, class RhsType, class BinaryPredicate>
55 CTypescxx . . $ polybori/CTypes#::comp_typecxx . . $ polybori/CAuxTypes#comp_type#
56 lex_comparecxx . . $ polybori/lex_compare(8cc829b54f776973).(const LhsType& lhs, const RhsType& rhs,
57 BinaryPredicate idx_comp, valid_tagcxx . . $ polybori/valid_tag# has_easy_equality_test) {
58
59 if (lhs ==cxx . . $ polybori/`operator==`(166981e292dfc570). rhs)
60 return CTypescxx . . $ polybori/CTypes#::equalitycxx . . $ polybori/CCompareEnums#equality.;
61
62 return lex_compare_3waycxx . . $ polybori/lex_compare_3way(a55274d5e569378d).(lhs.begin(), lhs.end(),
63 rhs.begin(), rhs.end(), idx_comp);
64 //typedef lex_compare_predicate<LhsType, RhsType, BinaryPredicate> comp_type;
65 //return generic_compare_3way(lhs, rhs, comp_type(idx_comp));
66 }
67
68
69 /// defines lexicographic comparison
70 template <class LhsType, class RhsType, class BinaryPredicate>
71 CTypescxx . . $ polybori/CTypes#::comp_typecxx . . $ polybori/CAuxTypes#comp_type#
72 lex_comparecxx . . $ polybori/lex_compare(cc3c8b618791f764).(const LhsType& lhs, const RhsType& rhs,
73 BinaryPredicate idx_comp, invalid_tagcxx . . $ polybori/invalid_tag# has_no_easy_equality_test) {
74
75 return lex_compare_3waycxx . . $ polybori/lex_compare_3way(a55274d5e569378d).(lhs.begin(), lhs.end(),
76 rhs.begin(), rhs.end(), idx_comp);
77 }
78
79 /// defines lexicographic comparison
80 template <class LhsType, class RhsType, class BinaryPredicate>
81 CTypescxx . . $ polybori/CTypes#::comp_typecxx . . $ polybori/CAuxTypes#comp_type#
82 lex_comparecxx . . $ polybori/lex_compare(4bcfbf9e66198384).(const LhsType& lhs, const RhsType& rhs, BinaryPredicate idx_comp) {
83
84 typedef typename pbori_binary_traitscxx . . $ polybori/pbori_binary_traits#<LhsType, RhsType>::easy_equality_property
85 equality_propertycxx . . $ polybori/lex_compare(4bcfbf9e66198384).equality_property#;
86
87 return lex_comparecxx . . $ polybori/lex_compare(4bcfbf9e66198384).(lhs, rhs, idx_comp, equality_propertycxx . . $ polybori/lex_compare(4bcfbf9e66198384).equality_property#());
88 }
89
90 /// defines degree-lexicographic comparison
91 template<class LhsType, class RhsType, class BinaryPredicate>
92 CTypescxx . . $ polybori/CTypes#::comp_typecxx . . $ polybori/CAuxTypes#comp_type#
93 deg_lex_comparecxx . . $ polybori/deg_lex_compare(4bcfbf9e66198384).(const LhsType& lhs, const RhsType& rhs,
94 BinaryPredicate idx_comp) {
95
96 typedef typename LhsType::size_type size_typecxx . . $ polybori/deg_lex_compare(4bcfbf9e66198384).size_type#;
97 CTypescxx . . $ polybori/CTypes#::comp_typecxx . . $ polybori/CAuxTypes#comp_type# result = generic_compare_3waycxx . . $ polybori/generic_compare_3way(4bcfbf9e66198384).( lhs.size(), rhs.size(),
98 stdcxx . . $ std/::greatercxx . . $ std/greater#<size_typecxx . . $ polybori/deg_lex_compare(4bcfbf9e66198384).size_type#>() );
99
100 return (result == CTypescxx . . $ polybori/CTypes#::equalitycxx . . $ polybori/CCompareEnums#equality.? lex_comparecxx . . $ polybori/lex_compare(4bcfbf9e66198384).(lhs, rhs, idx_comp): result);
101 }
102
103
104 template <class OrderType, class Iterator>
105 class generic_iterationcxx . . $ polybori/generic_iteration#;
106
107 template<class DummyType>
108 class dummy_data_typecxx . . $ polybori/dummy_data_type# {
109 public:
110 dummy_data_typecxx . . $ polybori/dummy_data_type#`dummy_data_type<DummyType>`(77d9f17553126ecb).(const DummyType&) {}
111 dummy_data_typecxx . . $ polybori/dummy_data_type#`dummy_data_type<DummyType>`(8e935d9c2e576e3a).(DummyType&) {}
112 dummy_data_typecxx . . $ polybori/dummy_data_type#`dummy_data_type<DummyType>`(49f6e7a06ebc5aa8).() {}
113 };
114
115 //////////////////////
116 template <class StackType, class Iterator>
117 void dummy_appendcxx . . $ polybori/dummy_append(b3fe0328b6ef2113).(StackType& stack, Iterator start, Iterator finish) {
118
119 while (start !=cxx . . $ polybori/`operator!=`(166981e292dfc570). finish) {
120 stack.push(*start);
121 ++start;
122 }
123 }
124
125 template<class NaviType, class DescendingProperty = valid_tagcxx . . $ polybori/valid_tag#>
126 class bounded_restricted_termcxx . . $ polybori/bounded_restricted_term# {
127 public:
128 typedef NaviType navigatorcxx . . $ polybori/bounded_restricted_term#navigator#;
129 typedef DescendingProperty descending_propertycxx . . $ polybori/bounded_restricted_term#descending_property#;
130 typedef bounded_restricted_termcxx . . $ polybori/bounded_restricted_term#<navigatorcxx . . $ polybori/bounded_restricted_term#navigator#, descending_propertycxx . . $ polybori/bounded_restricted_term#descending_property#> selfcxx . . $ polybori/bounded_restricted_term#self#;
131 typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<navigatorcxx . . $ polybori/bounded_restricted_term#navigator#> stack_typecxx . . $ polybori/bounded_restricted_term#stack_type#;
132 typedef unsigned size_typecxx . . $ polybori/bounded_restricted_term#size_type#;
133 typedef unsigned idx_typecxx . . $ polybori/bounded_restricted_term#idx_type#;
134
135 bounded_restricted_termcxx . . $ polybori/bounded_restricted_term#`bounded_restricted_term<NaviType, DescendingProperty>`(49f6e7a06ebc5aa8). ():
136 m_stackcxx . . $ polybori/bounded_restricted_term#m_stack.(), m_max_idxcxx . . $ polybori/bounded_restricted_term#m_max_idx.(0), m_upperboundcxx . . $ polybori/bounded_restricted_term#m_upperbound.(0), m_nextcxx . . $ polybori/bounded_restricted_term#m_next.() {}
137
138 is_same_typecxx . . $ polybori/is_same_type#<descending_propertycxx . . $ polybori/bounded_restricted_term#descending_property#, valid_tagcxx . . $ polybori/valid_tag#> descendingVariablescxx . . $ polybori/bounded_restricted_term#descendingVariables.;
139
140 bounded_restricted_termcxx . . $ polybori/bounded_restricted_term#`bounded_restricted_term<NaviType, DescendingProperty>`(67c82c888415af64). (navigatorcxx . . $ polybori/bounded_restricted_term#navigator# navi, size_typecxx . . $ polybori/bounded_restricted_term#size_type# upperbound,
141 idx_typecxx . . $ polybori/bounded_restricted_term#idx_type# max_idx):
142 m_stackcxx . . $ polybori/bounded_restricted_term#m_stack.(), m_upperboundcxx . . $ polybori/bounded_restricted_term#m_upperbound.(upperbound), m_max_idxcxx . . $ polybori/bounded_restricted_term#m_max_idx.(max_idx), m_nextcxx . . $ polybori/bounded_restricted_term#m_next.(navi) {
143
144 m_stackcxx . . $ polybori/bounded_restricted_term#m_stack..reservecxx . . $ std/vector#reserve(2c44cd906ae4e829).(upperbound);
145
146 followThencxx . . $ polybori/bounded_restricted_term#followThen(49f6e7a06ebc5aa8).();
147
148 while (!is_path_endcxx . . $ polybori/bounded_restricted_term#is_path_end(c9857a73d68e59ba).() && !emptycxx . . $ polybori/bounded_restricted_term#empty(50ce9a9e25b4a850).() )
149 incrementcxx . . $ polybori/bounded_restricted_term#increment(49f6e7a06ebc5aa8).();
150 }
151
152 size_typecxx . . $ polybori/bounded_restricted_term#size_type# operatorcxx . . $ polybori/bounded_restricted_term#`operator*`(ddd8539a2fcdd4ce).*() const {
153 return m_stackcxx . . $ polybori/bounded_restricted_term#m_stack..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).();
154 }
155
156 const navigatorcxx . . $ polybori/bounded_restricted_term#navigator#& nextcxx . . $ polybori/bounded_restricted_term#next(ea465e50d690edfe).() const {
157 return m_nextcxx . . $ polybori/bounded_restricted_term#m_next.;
158 }
159
160 typename stack_typecxx . . $ polybori/bounded_restricted_term#stack_type#::const_iterator begincxx . . $ polybori/bounded_restricted_term#begin(7fbc76ecd1fff2b4).() const {
161 return m_stackcxx . . $ polybori/bounded_restricted_term#m_stack..begincxx . . $ std/vector#begin(55a6de06420d4903).();
162 }
163
164 typename stack_typecxx . . $ polybori/bounded_restricted_term#stack_type#::const_iterator endcxx . . $ polybori/bounded_restricted_term#end(7fbc76ecd1fff2b4).() const {
165 return m_stackcxx . . $ polybori/bounded_restricted_term#m_stack..endcxx . . $ std/vector#end(55a6de06420d4903).();
166 }
167
168 selfcxx . . $ polybori/bounded_restricted_term#self#& operatorcxx . . $ polybori/bounded_restricted_term#operator++(e7434256f81af354).++() {
169 PBORI_ASSERTcxx . . $ `libbrial/include/polybori/pbori_defs.h:118:9`!(!empty());
170
171 // if upperbound was already found we're done
172 // (should be optimized away for ascending variables)
173 if (descendingVariablescxx . . $ polybori/bounded_restricted_term#descendingVariables.() && (m_stackcxx . . $ polybori/bounded_restricted_term#m_stack..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() ==cxx . . $ polybori/`operator==`(166981e292dfc570). m_upperboundcxx . . $ polybori/bounded_restricted_term#m_upperbound.) )
174 return *this = selfcxx . . $ polybori/bounded_restricted_term#self#();
175
176 do {
177 incrementcxx . . $ polybori/bounded_restricted_term#increment(49f6e7a06ebc5aa8).();
178 } while (!emptycxx . . $ polybori/bounded_restricted_term#empty(50ce9a9e25b4a850).() && !is_path_endcxx . . $ polybori/bounded_restricted_term#is_path_end(c9857a73d68e59ba).());
179
180 return *this;
181 }
182
183 void printcxx . . $ polybori/bounded_restricted_term#print(83f5f38750778ac8).() const {
184
185 typename stack_typecxx . . $ polybori/bounded_restricted_term#stack_type#::const_iterator start(m_stackcxx . . $ polybori/bounded_restricted_term#m_stack..begincxx . . $ std/vector#begin(55a6de06420d4903).()),
186 finish(m_stackcxx . . $ polybori/bounded_restricted_term#m_stack..endcxx . . $ std/vector#end(55a6de06420d4903).());
187
188 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24).'(';
189 while (start !=cxx . . $ polybori/`operator!=`(166981e292dfc570). finish) {
190 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ polybori/`operator<<`(53ec9733780b352e). *(*start) <<cxx . . $ polybori/`operator<<`(53ec9733780b352e). ", " ;
191 ++start;
192 }
193 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24).')';
194
195 }
196
197 bool operatorcxx . . $ polybori/bounded_restricted_term#`operator==`(e86e147b24519e81).==(const selfcxx . . $ polybori/bounded_restricted_term#self#& rhs) const {
198 if (rhs.emptycxx . . $ polybori/bounded_restricted_term#empty(50ce9a9e25b4a850).())
199 return emptycxx . . $ polybori/bounded_restricted_term#empty(50ce9a9e25b4a850).();
200 if (emptycxx . . $ polybori/bounded_restricted_term#empty(50ce9a9e25b4a850).())
201 return rhs.emptycxx . . $ polybori/bounded_restricted_term#empty(50ce9a9e25b4a850).();
202
203 else (m_stackcxx . . $ polybori/bounded_restricted_term#m_stack. ==cxx . . $ polybori/`operator==`(166981e292dfc570). rhs.m_stackcxx . . $ polybori/bounded_restricted_term#m_stack.);
204 }
205 bool operatorcxx . . $ polybori/bounded_restricted_term#`operator!=`(e86e147b24519e81).!=(const selfcxx . . $ polybori/bounded_restricted_term#self#& rhs) const {
206 return !(*this ==cxx . . $ polybori/`operator==`(166981e292dfc570). rhs);
207 }
208 protected:
209
210 void followThencxx . . $ polybori/bounded_restricted_term#followThen(49f6e7a06ebc5aa8).() {
211 while (within_degreecxx . . $ polybori/bounded_restricted_term#within_degree(50ce9a9e25b4a850).() && !at_endcxx . . $ polybori/bounded_restricted_term#at_end(50ce9a9e25b4a850).())
212 nextThencxx . . $ polybori/bounded_restricted_term#nextThen(49f6e7a06ebc5aa8).();
213 }
214
215 void incrementcxx . . $ polybori/bounded_restricted_term#increment(49f6e7a06ebc5aa8).() {
216 PBORI_ASSERTcxx . . $ `libbrial/include/polybori/pbori_defs.h:118:9`!(!empty());
217
218 m_nextcxx . . $ polybori/bounded_restricted_term#m_next. = topcxx . . $ polybori/bounded_restricted_term#top(8f5363d873dd4781).();
219 m_nextcxx . . $ polybori/bounded_restricted_term#m_next..incrementElse();
220 m_stackcxx . . $ polybori/bounded_restricted_term#m_stack..pop_backcxx . . $ std/vector#pop_back(ced63f7c635d850d).();
221
222 followThencxx . . $ polybori/bounded_restricted_term#followThen(49f6e7a06ebc5aa8).();
223
224 }
225
226 bool emptycxx . . $ polybori/bounded_restricted_term#empty(50ce9a9e25b4a850).() const{
227 return m_stackcxx . . $ polybori/bounded_restricted_term#m_stack..emptycxx . . $ std/vector#empty(3482b152b9333168).();
228 }
229
230 navigatorcxx . . $ polybori/bounded_restricted_term#navigator# topcxx . . $ polybori/bounded_restricted_term#top(8f5363d873dd4781).() const{
231 return m_stackcxx . . $ polybori/bounded_restricted_term#m_stack..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).();
232 }
233
234 bool is_path_endcxx . . $ polybori/bounded_restricted_term#is_path_end(c9857a73d68e59ba).() {
235
236 path_endcxx . . $ polybori/bounded_restricted_term#path_end(49f6e7a06ebc5aa8).();
237 return (!m_nextcxx . . $ polybori/bounded_restricted_term#m_next..isConstant() && (*m_nextcxx . . $ polybori/bounded_restricted_term#m_next. >= m_max_idxcxx . . $ polybori/bounded_restricted_term#m_max_idx.)) ||
238 m_nextcxx . . $ polybori/bounded_restricted_term#m_next..terminalValue();
239 }
240
241 void path_endcxx . . $ polybori/bounded_restricted_term#path_end(49f6e7a06ebc5aa8).() {
242 while (!at_endcxx . . $ polybori/bounded_restricted_term#at_end(50ce9a9e25b4a850).()) {
243 m_nextcxx . . $ polybori/bounded_restricted_term#m_next..incrementElse();
244 }
245 }
246
247 void nextThencxx . . $ polybori/bounded_restricted_term#nextThen(49f6e7a06ebc5aa8).() {
248 PBORI_ASSERTcxx . . $ `libbrial/include/polybori/pbori_defs.h:118:9`!(!m_next.isConstant());
249 m_stackcxx . . $ polybori/bounded_restricted_term#m_stack..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(m_nextcxx . . $ polybori/bounded_restricted_term#m_next.);
250 m_nextcxx . . $ polybori/bounded_restricted_term#m_next..incrementThen();
251 }
252
253
254
255 bool within_degreecxx . . $ polybori/bounded_restricted_term#within_degree(50ce9a9e25b4a850).() const {
256
257 return (*(*this) < m_upperboundcxx . . $ polybori/bounded_restricted_term#m_upperbound.);
258 }
259
260 bool at_endcxx . . $ polybori/bounded_restricted_term#at_end(50ce9a9e25b4a850).() const {
261
262 return m_nextcxx . . $ polybori/bounded_restricted_term#m_next..isConstant() || (*m_nextcxx . . $ polybori/bounded_restricted_term#m_next. >= m_max_idxcxx . . $ polybori/bounded_restricted_term#m_max_idx.);
263 }
264
265 private:
266 stack_typecxx . . $ polybori/bounded_restricted_term#stack_type# m_stackcxx . . $ polybori/bounded_restricted_term#m_stack.;
267 idx_typecxx . . $ polybori/bounded_restricted_term#idx_type# m_max_idxcxx . . $ polybori/bounded_restricted_term#m_max_idx.;
268 size_typecxx . . $ polybori/bounded_restricted_term#size_type# m_upperboundcxx . . $ polybori/bounded_restricted_term#m_upperbound.;
269 navigatorcxx . . $ polybori/bounded_restricted_term#navigator# m_nextcxx . . $ polybori/bounded_restricted_term#m_next.;
270 };
271
272
273
274 /// Function templates for determining the degree of a decision diagram
275 /// with the help of cache (e. g. CDegreeCache)
276 template <class DegreeCacher, class NaviType, class IdxType>
277 typename NaviType::deg_type
278 dd_cached_block_degreecxx . . $ polybori/dd_cached_block_degree(9c049ea02f5d7a9).(const DegreeCacher& cache, NaviType navi,
279 IdxType nextBlock) {
280
281 typedef typename NaviType::deg_type deg_typecxx . . $ polybori/dd_cached_block_degree(9c049ea02f5d7a9).deg_type#;
282
283 if( navi.isConstant() || (*navi >= nextBlock) ) // end of block reached
284 return 0;
285
286 // Look whether result was cached before
287 typename DegreeCacher::node_type result = cache.find(navi, nextBlock);
288 if (result.isValid())
289 return *result;
290
291 // Get degree of then branch (contains at least one valid path)...
292 deg_typecxx . . $ polybori/dd_cached_block_degree(9c049ea02f5d7a9).deg_type# deg = dd_cached_block_degreecxx . . $ polybori/dd_cached_block_degree(9c049ea02f5d7a9).(cache, navi.thenBranch(), nextBlock) + 1;
293
294 // ... combine with degree of else branch
295 deg = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(deg, dd_cached_block_degreecxx . . $ polybori/dd_cached_block_degree(9c049ea02f5d7a9).(cache, navi.elseBranch(), nextBlock) );
296
297 // Write result to cache
298 cache.insert(navi, nextBlock, deg);
299
300 return deg;
301 }
302
303
304 template<class DegCacheMgr, class NaviType, class IdxType, class SizeType>
305 bool max_block_degree_on_thencxx . . $ polybori/max_block_degree_on_then(be1cee913bb6d5ca).(const DegCacheMgr& deg_mgr, NaviType navi,
306 IdxType next_block,
307 SizeType degree, valid_tagcxx . . $ polybori/valid_tag# is_descending) {
308 navi.incrementThen();
309 return ((dd_cached_block_degreecxx . . $ polybori/dd_cached_block_degree(9c049ea02f5d7a9).(deg_mgr, navi, next_block/*,degree - 1*/) + 1) ==cxx . . $ polybori/`operator==`(166981e292dfc570). degree);
310 }
311
312 template<class DegCacheMgr, class NaviType, class IdxType, class SizeType>
313 bool max_block_degree_on_thencxx . . $ polybori/max_block_degree_on_then(f362355f226c103f).(const DegCacheMgr& deg_mgr, NaviType navi,
314 IdxType next_block,
315 SizeType degree, invalid_tagcxx . . $ polybori/invalid_tag# non_descending) {
316 navi.incrementElse();
317 return (dd_cached_block_degreecxx . . $ polybori/dd_cached_block_degree(9c049ea02f5d7a9).(deg_mgr, navi, next_block/*, degree*/) !=cxx . . $ polybori/`operator!=`(166981e292dfc570). degree);
318 }
319
320
321 // with degree bound
322 template <class CacheType, class DegCacheMgr, class NaviType,
323 class TermType, class Iterator, class SizeType, class DescendingProperty>
324 TermType
325 dd_block_degree_leadcxx . . $ polybori/dd_block_degree_lead(8ce3efee8ff6db05).(const CacheType& cache_mgr,
326 const DegCacheMgr& deg_mgr,
327 NaviType navi, Iterator block_iter,
328 TermType init, SizeType degree,
329 DescendingProperty prop) {
330
331 if (navi.isConstant())
332 return cache_mgr.generate(navi);
333
334 while( (*navi >= *block_iter) && (*block_iter !=cxx . . $ polybori/`operator!=`(166981e292dfc570). CUDD_MAXINDEXcxx . . $ `cudd/cudd.h:134:9`!)) {
335 ++block_iter;
336 degree = dd_cached_block_degreecxx . . $ polybori/dd_cached_block_degree(9c049ea02f5d7a9).(deg_mgr, navi, *block_iter);
337 }
338
339
340 // Check cache for previous results - Wrong in general, bounds may have changed!
341 // NaviType cached = cache_mgr.find(navi);
342 // if (cached.isValid())
343 // return cache_mgr.generate(cached);
344
345 // Go to next branch
346 if ( max_block_degree_on_thencxx . . $ polybori/max_block_degree_on_then(f362355f226c103f).(deg_mgr, navi, *block_iter, degree, prop) ) {
347 init = dd_block_degree_leadcxx . . $ polybori/dd_block_degree_lead(8ce3efee8ff6db05).(cache_mgr, deg_mgr, navi.thenBranch(),
348 block_iter,
349 init, degree - 1, prop).change(*navi);
350 }
351 else {
352 init = dd_block_degree_leadcxx . . $ polybori/dd_block_degree_lead(8ce3efee8ff6db05).(cache_mgr, deg_mgr, navi.elseBranch(),
353 block_iter,
354 init, degree, prop);
355 }
356
357 NaviType resultNavi(init.navigation());
358 // cache_mgr.insert(navi, resultNavi);
359 deg_mgr.insert(resultNavi, *block_iter, degree);
360
361 return init;
362 }
363
364
365 template <class CacheType, class DegCacheMgr, class NaviType, class Iterator,
366 class TermType, class DescendingProperty>
367 TermType
368 dd_block_degree_leadcxx . . $ polybori/dd_block_degree_lead(b28ff7c2cca8ab0).(const CacheType& cache_mgr, const DegCacheMgr& deg_mgr,
369 NaviType navi, Iterator block_iter, TermType init,
370 DescendingProperty prop){
371
372 if (navi.isConstant())
373 return cache_mgr.generate(navi);
374
375 return dd_block_degree_leadcxx . . $ polybori/dd_block_degree_lead(b28ff7c2cca8ab0).(cache_mgr, deg_mgr, navi,block_iter, init,
376 dd_cached_block_degreecxx . . $ polybori/dd_cached_block_degree(9c049ea02f5d7a9).(deg_mgr, navi,
377 *block_iter), prop);
378 }
379
380
381 template <class FirstIterator, class SecondIterator, class IdxType,
382 class BinaryPredicate>
383 CTypescxx . . $ polybori/CTypes#::comp_typecxx . . $ polybori/CAuxTypes#comp_type#
384 restricted_lex_compare_3waycxx . . $ polybori/restricted_lex_compare_3way(a50f89f581045d36).(FirstIterator start, FirstIterator finish,
385 SecondIterator rhs_start, SecondIterator rhs_finish,
386 IdxType max_index,
387 BinaryPredicate idx_comp) {
388
389 while ( (start !=cxx . . $ polybori/`operator!=`(166981e292dfc570). finish) && (*start < max_index) && (rhs_start !=cxx . . $ polybori/`operator!=`(166981e292dfc570). rhs_finish)
390 && (*rhs_start < max_index) && (*start ==cxx . . $ polybori/`operator==`(166981e292dfc570). *rhs_start) ) {
391 ++start; ++rhs_start;
392 }
393
394 if ( (start ==cxx . . $ polybori/`operator==`(166981e292dfc570). finish) || (*start >= max_index) ) {
395 if ( (rhs_start ==cxx . . $ polybori/`operator==`(166981e292dfc570). rhs_finish) || (*rhs_start >= max_index) )
396 return CTypescxx . . $ polybori/CTypes#::equalitycxx . . $ polybori/CCompareEnums#equality.;
397
398 return CTypescxx . . $ polybori/CTypes#::less_thancxx . . $ polybori/CCompareEnums#less_than.;
399 }
400
401 if ( (rhs_start ==cxx . . $ polybori/`operator==`(166981e292dfc570). rhs_finish) || (*rhs_start >= max_index) )
402 return CTypescxx . . $ polybori/CTypes#::greater_thancxx . . $ polybori/CCompareEnums#greater_than.;
403
404 return (idx_comp(*start, *rhs_start)?
405 CTypescxx . . $ polybori/CTypes#::greater_thancxx . . $ polybori/CCompareEnums#greater_than.: CTypescxx . . $ polybori/CTypes#::less_thancxx . . $ polybori/CCompareEnums#less_than.);
406 }
407
408
409
410
411 template<class LhsIterator, class RhsIterator, class Iterator,
412 class BinaryPredicate>
413 CTypescxx . . $ polybori/CTypes#::comp_typecxx . . $ polybori/CAuxTypes#comp_type#
414 block_dlex_comparecxx . . $ polybori/block_dlex_compare(7cedabb33b7e6856).(LhsIterator lhsStart, LhsIterator lhsFinish,
415 RhsIterator rhsStart, RhsIterator rhsFinish,
416 Iterator start, Iterator finish,
417 BinaryPredicate idx_comp) {
418
419 // unsigned lhsdeg = 0, rhsdeg = 0;
420
421
422 CTypescxx . . $ polybori/CTypes#::comp_typecxx . . $ polybori/CAuxTypes#comp_type# result = CTypescxx . . $ polybori/CTypes#::equalitycxx . . $ polybori/CCompareEnums#equality.;
423
424 while ( (start !=cxx . . $ polybori/`operator!=`(166981e292dfc570). finish) && (result == CTypescxx . . $ polybori/CTypes#::equalitycxx . . $ polybori/CCompareEnums#equality.) ) {
425 CTypescxx . . $ polybori/CTypes#::deg_typecxx . . $ polybori/CAuxTypes#deg_type# lhsdeg = 0, rhsdeg = 0;
426 LhsIterator oldLhs(lhsStart); // maybe one can save this and do both
427 RhsIterator oldRhs(rhsStart); // comparisons at once.
428
429 // maybe one can save
430 while( (lhsStart !=cxx . . $ polybori/`operator!=`(166981e292dfc570). lhsFinish) && (*lhsStart < *start) ) {
431 ++lhsStart; ++lhsdeg;
432 }
433 while( (rhsStart !=cxx . . $ polybori/`operator!=`(166981e292dfc570). rhsFinish) && (*rhsStart < *start) ) {
434 ++rhsStart; ++rhsdeg;
435 }
436 result = generic_compare_3waycxx . . $ polybori/generic_compare_3way(4bcfbf9e66198384).(lhsdeg, rhsdeg,
437 stdcxx . . $ std/::greatercxx . . $ std/greater#<unsigned>() );
438
439 if (result == CTypescxx . . $ polybori/CTypes#::equalitycxx . . $ polybori/CCompareEnums#equality.) {
440 result = restricted_lex_compare_3waycxx . . $ polybori/restricted_lex_compare_3way(a50f89f581045d36).(oldLhs, lhsFinish,
441 oldRhs, rhsFinish, *start, idx_comp);
442 }
443
444 ++start;
445 }
446
447 return result;
448 }
449
450
451 ///@note: no necessary for block_dlex, only for block_dp_asc
452 template <class IdxType, class Iterator, class BinaryPredicate>
453 CTypescxx . . $ polybori/CTypes#::comp_typecxx . . $ polybori/CAuxTypes#comp_type#
454 block_deg_lex_idx_comparecxx . . $ polybori/block_deg_lex_idx_compare(a55274d5e569378d).(IdxType lhs, IdxType rhs,
455 Iterator start, Iterator finish,
456 BinaryPredicate idx_comp) {
457
458 if (lhs ==cxx . . $ polybori/`operator==`(166981e292dfc570). rhs)
459 return CTypescxx . . $ polybori/CTypes#::equalitycxx . . $ polybori/CCompareEnums#equality.;
460
461 Iterator lhsend = stdcxx . . $ std/::find_ifcxx . . $ std/find_if(f0a0a4f94ee5cb00).(start, finish,
462 stdcxx . . $ std/::bindcxx . . $ std/bind(872fd79d47452673).(stdcxx . . $ std/::greatercxx . . $ std/greater#<IdxType>(), stdcxx . . $ std/::placeholderscxx . . $ std/placeholders/::_1cxx . . $ std/placeholders/_1., lhs));
463
464
465 Iterator rhsend = stdcxx . . $ std/::find_ifcxx . . $ std/find_if(f0a0a4f94ee5cb00).(start, finish,
466 stdcxx . . $ std/::bindcxx . . $ std/bind(872fd79d47452673).(stdcxx . . $ std/::greatercxx . . $ std/greater#<IdxType>(), stdcxx . . $ std/::placeholderscxx . . $ std/placeholders/::_1cxx . . $ std/placeholders/_1., rhs));
467
468 CTypescxx . . $ polybori/CTypes#::comp_typecxx . . $ polybori/CAuxTypes#comp_type# result = CTypescxx . . $ polybori/CTypes#::equalitycxx . . $ polybori/CCompareEnums#equality.;
469
470 if PBORI_UNLIKELYcxx . . $ `libbrial/include/polybori/pbori_defs.h:52:9`!( (rhsend == finish) && (lhsend != finish) )
471 result = CTypescxx . . $ polybori/CTypes#::less_thancxx . . $ polybori/CCompareEnums#less_than.;
472 else if PBORI_UNLIKELYcxx . . $ `libbrial/include/polybori/pbori_defs.h:52:9`!(lhsend == finish)
473 result = CTypescxx . . $ polybori/CTypes#::greater_thancxx . . $ polybori/CCompareEnums#greater_than.;
474 else {
475 PBORI_ASSERTcxx . . $ `libbrial/include/polybori/pbori_defs.h:118:9`!((lhsend != finish) && (rhsend != finish));
476 result = generic_compare_3waycxx . . $ polybori/generic_compare_3way(4bcfbf9e66198384).( *lhsend, *rhsend, stdcxx . . $ std/::lesscxx . . $ std/less#<IdxType>() );
477 }
478
479 return ( result == CTypescxx . . $ polybori/CTypes#::equalitycxx . . $ polybori/CCompareEnums#equality.?
480 generic_compare_3waycxx . . $ polybori/generic_compare_3way(4bcfbf9e66198384).(lhs, rhs, idx_comp): result );
481 }
482
483 END_NAMESPACE_PBORIcxx . . $ `libbrial/include/polybori/pbori_defs.h:77:11`!
484
485 #endif