dwave-preprocessing 0.6.7__cp313-cp313-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. dwave/__init__.py +16 -0
  2. dwave/preprocessing/__init__.py +42 -0
  3. dwave/preprocessing/composites/__init__.py +19 -0
  4. dwave/preprocessing/composites/clip.py +114 -0
  5. dwave/preprocessing/composites/connected_components.py +113 -0
  6. dwave/preprocessing/composites/fix_variables.py +153 -0
  7. dwave/preprocessing/composites/scale.py +144 -0
  8. dwave/preprocessing/composites/spin_reversal_transform.py +221 -0
  9. dwave/preprocessing/cyfix_variables.cp313-win_amd64.pyd +0 -0
  10. dwave/preprocessing/cyfix_variables.cpp +29498 -0
  11. dwave/preprocessing/cyfix_variables.pyx +58 -0
  12. dwave/preprocessing/include/dwave/exceptions.hpp +28 -0
  13. dwave/preprocessing/include/dwave/flags.hpp +63 -0
  14. dwave/preprocessing/include/dwave/presolve.hpp +91 -0
  15. dwave/preprocessing/include/dwave-preprocessing/fix_variables.hpp +119 -0
  16. dwave/preprocessing/include/dwave-preprocessing/helper_data_structures.hpp +152 -0
  17. dwave/preprocessing/include/dwave-preprocessing/helper_graph_algorithms.hpp +476 -0
  18. dwave/preprocessing/include/dwave-preprocessing/implication_network.hpp +690 -0
  19. dwave/preprocessing/include/dwave-preprocessing/mapping_policy.hpp +124 -0
  20. dwave/preprocessing/include/dwave-preprocessing/posiform_info.hpp +384 -0
  21. dwave/preprocessing/include/dwave-preprocessing/push_relabel.hpp +775 -0
  22. dwave/preprocessing/libcpp.pxd +59 -0
  23. dwave/preprocessing/lower_bounds.py +94 -0
  24. dwave/preprocessing/presolve/__init__.pxd +13 -0
  25. dwave/preprocessing/presolve/__init__.py +16 -0
  26. dwave/preprocessing/presolve/cypresolve.cp313-win_amd64.pyd +0 -0
  27. dwave/preprocessing/presolve/cypresolve.cpp +39255 -0
  28. dwave/preprocessing/presolve/cypresolve.pxd +45 -0
  29. dwave/preprocessing/presolve/cypresolve.pyi +50 -0
  30. dwave/preprocessing/presolve/cypresolve.pyx +340 -0
  31. dwave/preprocessing/presolve/exceptions.py +21 -0
  32. dwave/preprocessing/presolve/pypresolve.py +173 -0
  33. dwave/preprocessing/src/exceptions.cpp +21 -0
  34. dwave/preprocessing/src/presolve.cpp +105 -0
  35. dwave/preprocessing/src/presolveimpl.hpp +1060 -0
  36. dwave_preprocessing-0.6.7.dist-info/DELVEWHEEL +2 -0
  37. dwave_preprocessing-0.6.7.dist-info/LICENSE +203 -0
  38. dwave_preprocessing-0.6.7.dist-info/METADATA +114 -0
  39. dwave_preprocessing-0.6.7.dist-info/RECORD +42 -0
  40. dwave_preprocessing-0.6.7.dist-info/WHEEL +5 -0
  41. dwave_preprocessing-0.6.7.dist-info/top_level.txt +1 -0
  42. dwave_preprocessing.libs/msvcp140-c5f1b59771da57851103ca2011763553.dll +0 -0
@@ -0,0 +1,58 @@
1
+ # distutils: language = c++
2
+ # cython: language_level=3
3
+ #
4
+ # Copyright 2021 D-Wave Systems Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ from cython.operator cimport dereference as deref
19
+
20
+ from libcpp.utility cimport pair
21
+ from libcpp.vector cimport vector
22
+
23
+ import dimod
24
+ import numpy as np
25
+
26
+ from dimod.libcpp cimport BinaryQuadraticModel as cppBinaryQuadraticModel
27
+ from dimod.binary.cybqm cimport cyBQM_float64
28
+
29
+
30
+ cdef extern from "include/dwave-preprocessing/fix_variables.hpp" namespace "fix_variables_":
31
+ pair[double, vector[pair[int, int]]] fixQuboVariables[V, B](cppBinaryQuadraticModel[B, V]& refBQM,
32
+ bint strict,
33
+ double offset) except +
34
+
35
+ def fix_variables_wrapper(bqm, strict):
36
+ """Cython wrapper for fix_variables().
37
+
38
+ Args:
39
+ bqm (:class:`.BinaryQuadraticModel`):
40
+ A binary quadratic model with binary-valued variables, indexed
41
+ linearly from zero.
42
+
43
+ strict (bool):
44
+ If True, only fixes variables for which assignments are true for all
45
+ minimizing points (strong persistency). If False, also fixes variables
46
+ for which the assignments are true for some but not all minimizing
47
+ points (weak persistency).
48
+ """
49
+ bqm = dimod.as_bqm(bqm, dtype=np.float64)
50
+
51
+ if bqm.vartype is not dimod.BINARY:
52
+ raise ValueError("bqm must be BINARY")
53
+ if not all(v in bqm.linear for v in range(len(bqm))):
54
+ raise ValueError("bqm must be linearly indexed")
55
+
56
+ cdef cyBQM_float64 cybqm = bqm.data
57
+ lower_bound, fixed = fixQuboVariables(deref(cybqm.cppbqm), bool(strict), bqm.offset)
58
+ return lower_bound, {int(v): int(val) for v, val in fixed}
@@ -0,0 +1,28 @@
1
+ // Copyright 2023 D-Wave Systems Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ #pragma once
16
+
17
+ #include <stdexcept>
18
+ #include <string>
19
+
20
+ namespace dwave::presolve {
21
+
22
+ /// Error for models that are ill-constructed or otherwise not valid models.
23
+ /// This is disctinct from infeasibility.
24
+ struct InvalidModelError : public std::runtime_error {
25
+ explicit InvalidModelError(const std::string& msg);
26
+ };
27
+
28
+ } // namespace dwave::presolve
@@ -0,0 +1,63 @@
1
+ // Copyright 2023 D-Wave Systems Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ #pragma once
16
+
17
+ #include <cstdint>
18
+
19
+ namespace dwave::presolve {
20
+
21
+ enum Feasibility {
22
+ Infeasible, //< The model is known to be infeasible
23
+ Feasible, //< The model is known to be feasible
24
+ Unknown, //< It is not known if the model is feasible or not
25
+ };
26
+
27
+ enum TechniqueFlags : std::uint64_t {
28
+ None = 0,
29
+
30
+ /// Remove redundant constraints.
31
+ /// See Achterberg et al., section 3.1.
32
+ RemoveRedundantConstraints = 1 << 0,
33
+
34
+ /// Remove small biases from the objective and constraints.
35
+ /// See Achterberg et al., section 3.1.
36
+ RemoveSmallBiases = 1 << 1,
37
+
38
+ /// Use constraints to tighten the bounds on variables.
39
+ /// See Achterberg et al., section 3.2.
40
+ DomainPropagation = 1 << 2,
41
+
42
+ /// All techniques.
43
+ All = 0xffffffffffffffffu,
44
+
45
+ /// Currently equivalent to All, though this may change in the future.
46
+ Default = All,
47
+ };
48
+
49
+ // Developer note: There are other ways to make Flag classes using bitsets etc.
50
+ // However, this way is simple, gives us enough techniques for the foreseeable future,
51
+ // and is easy to mirror in Cython/Python (using Python's enum.IntFlag).
52
+
53
+ inline TechniqueFlags operator|(TechniqueFlags lhs, TechniqueFlags rhs) {
54
+ return static_cast<TechniqueFlags>(static_cast<std::underlying_type_t<TechniqueFlags>>(lhs) |
55
+ static_cast<std::underlying_type_t<TechniqueFlags>>(rhs));
56
+ }
57
+
58
+ inline TechniqueFlags operator&(TechniqueFlags lhs, TechniqueFlags rhs) {
59
+ return static_cast<TechniqueFlags>(static_cast<std::underlying_type_t<TechniqueFlags>>(lhs) &
60
+ static_cast<std::underlying_type_t<TechniqueFlags>>(rhs));
61
+ }
62
+
63
+ } // namespace dwave::presolve
@@ -0,0 +1,91 @@
1
+ // Copyright 2023 D-Wave Systems Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ #pragma once
16
+
17
+ #ifndef _WIN32
18
+ // MSVC does not support std::experimental
19
+ #include <experimental/propagate_const>
20
+ #endif
21
+
22
+ #include <chrono>
23
+ #include <memory>
24
+ #include <utility>
25
+ #include <vector>
26
+
27
+ #include "dimod/constrained_quadratic_model.h"
28
+ #include "dwave/flags.hpp"
29
+
30
+ namespace dwave::presolve {
31
+
32
+ template <class Bias, class Index = int, class Assignment = Bias>
33
+ class Presolver {
34
+ public:
35
+ using model_type = dimod::ConstrainedQuadraticModel<Bias, Index>;
36
+
37
+ using bias_type = Bias;
38
+ using index_type = Index;
39
+ using size_type = typename model_type::size_type;
40
+
41
+ using assignment_type = Assignment;
42
+
43
+ Presolver();
44
+ ~Presolver();
45
+
46
+ /// Construct a presolver from a constrained quadratic model.
47
+ explicit Presolver(model_type model);
48
+
49
+ /// Add presolve techniques to be run. This will not affect existing loaded techniques.
50
+ TechniqueFlags add_techniques(TechniqueFlags techniques);
51
+
52
+ /// Apply any loaded presolve techniques. Acts on the model() in-place.
53
+ bool apply();
54
+
55
+ /// Detach the constrained quadratic model and return it.
56
+ /// This clears the model from the presolver.
57
+ model_type detach_model();
58
+
59
+ const Feasibility& feasibility() const;
60
+
61
+ /// Return a const reference to the held constrained quadratic model.
62
+ const model_type& model() const;
63
+
64
+ /// Normalize the model.
65
+ bool normalize();
66
+
67
+ /// Presolve a normalized model.
68
+ bool presolve();
69
+ bool presolve(std::chrono::duration<double> time_limit);
70
+
71
+ /// Return a sample of the original CQM from a sample of the reduced CQM.
72
+ std::vector<assignment_type> restore(std::vector<assignment_type> reduced) const;
73
+
74
+ /// Set the presolve techniques to be run.
75
+ TechniqueFlags set_techniques(TechniqueFlags techniques);
76
+
77
+ /// Return the currently-loaded presolve techniques.
78
+ TechniqueFlags techniques() const;
79
+
80
+ protected:
81
+ class PresolverImpl_;
82
+
83
+ #ifndef _WIN32
84
+ std::experimental::propagate_const<std::unique_ptr<PresolverImpl_>> impl_;
85
+ #else
86
+ // MSVC does not support std::experimental
87
+ std::unique_ptr<PresolverImpl_> impl_;
88
+ #endif
89
+ };
90
+
91
+ } // namespace dwave::presolve
@@ -0,0 +1,119 @@
1
+ // Copyright 2021 D-Wave Systems Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ #include "dimod/binary_quadratic_model.h"
16
+ #include "implication_network.hpp"
17
+ #include "posiform_info.hpp"
18
+
19
+ namespace fix_variables_ {
20
+
21
+ typedef long long int capacity_type;
22
+
23
+ class compClass {
24
+ public:
25
+ bool operator()(const std::pair<int, int> &a, const std::pair<int, int> &b) {
26
+ if (a.second != b.second)
27
+ return !(a.second < b.second);
28
+ else
29
+ return a.first < b.first;
30
+ }
31
+ };
32
+
33
+ /**
34
+ * Fixes the QUBO variables.
35
+ *
36
+ * @param posiform_info Object containing information needed to recreate a
37
+ * posiform corresponding to QUBO.
38
+ * @param num_bqm_variables Number of variables in the original QUBO.
39
+ * @param strict When true, only the variables corresponding to strong persistencies
40
+ * are fixed. When false, the function tries to fix all the variables
41
+ * corresponding to strong and weak persistencies. Also when false, variables
42
+ * that do not contribute any coefficient to the posiform are set to 1. This
43
+ * may happen if their bias in the original QUBO was 0 or if they were flushed
44
+ * to zero when converted to the posiform.
45
+ * @param fixed_variables Variables to fix.
46
+ */
47
+ template <class PosiformInfo>
48
+ capacity_type fixQuboVariables(PosiformInfo &posiform_info, int num_bqm_variables,
49
+ bool strict,
50
+ std::vector<std::pair<int, int>> &fixed_variables) {
51
+ ImplicationNetwork<capacity_type> implication_network(posiform_info);
52
+ fixed_variables.reserve(num_bqm_variables);
53
+
54
+ // Fix the variables with respect to the posiform.
55
+ std::vector<std::pair<int, int>> fixed_variables_posiform;
56
+ capacity_type max_flow = implication_network.fixVariables(fixed_variables_posiform, strict);
57
+
58
+ // There may not be 1 to 1 mapping from bqm variables to posiform variables,
59
+ // so we convert the posiform variables back to bqm variables.
60
+ for (std::size_t i = 0; i < fixed_variables_posiform.size(); i++) {
61
+ int bqm_variable = posiform_info.mapVariablePosiformToQubo(
62
+ fixed_variables_posiform[i].first);
63
+ fixed_variables.push_back(
64
+ {bqm_variable, fixed_variables_posiform[i].second});
65
+ }
66
+
67
+ // If not in strict mode, we want to set the variables which did not
68
+ // contribute to the posiform as they had zero bias. They can be set to either
69
+ // 1 or 0. We choose 1.
70
+ if (!strict) {
71
+ for (int bqm_variable = 0; bqm_variable < num_bqm_variables;
72
+ bqm_variable++) {
73
+ if (posiform_info.mapVariableQuboToPosiform(bqm_variable) < 0) {
74
+ fixed_variables.push_back({bqm_variable, 1});
75
+ }
76
+ }
77
+ }
78
+
79
+ std::sort(fixed_variables.begin(), fixed_variables.end(), compClass());
80
+ return max_flow;
81
+ }
82
+
83
+ /**
84
+ * Fixes the variables of an BinaryQuadraticModel.
85
+ *
86
+ * @param bqm BinaryQuadraticModel to find minimizing variable assignments for
87
+ * @param strict When true, only the variables corresponding to strong persistencies
88
+ * are fixed. When false, the function tries to fix all the variables
89
+ * corresponding to strong and weak persistencies. Also when false, variables
90
+ * that do not contribute any coefficient to the posiform are set to 1. This
91
+ * may happen if their bias in the original QUBO was 0 or if they were flushed
92
+ * to zero when converted to the posiform.
93
+ * @param offset The bqm's offset, used to calculate the lower bound. Defaults to 0.
94
+ */
95
+ template <class V, class B>
96
+ std::pair<double, std::vector<std::pair<int, int>>>
97
+ fixQuboVariables(dimod::BinaryQuadraticModel<B, V> &bqm, bool strict, double offset=0.0) {
98
+ int num_bqm_variables = bqm.num_variables();
99
+ PosiformInfo<dimod::BinaryQuadraticModel<B, V>, capacity_type> posiform_info(bqm);
100
+ std::vector<std::pair<int, int>> fixed_variables;
101
+ capacity_type max_flow = fixQuboVariables(posiform_info, num_bqm_variables, strict, fixed_variables);
102
+
103
+ // The max_flow added with the constant term of the posiform should be the lower
104
+ // bound of the posiform, which should be equal to the lower bound of the bqm.
105
+ // But while creating the implication network and assigning capacities to its
106
+ // edges, we did not divide the corresponding coefficients of the posiform by 2,
107
+ // thus when we convert the max flow to the minimum value of the posiform, we
108
+ // need to divide it by 2. The bqm offset also needs to be added since it was
109
+ // ignored in the posiform to reduce potential numerical errors.
110
+ // See bottom of page 5 after equation 5 of the following paper.
111
+ // Boros, Endre & Hammer, Peter & Tavares, Gabriel. (2006). Preprocessing of
112
+ // unconstrained quadratic binary optimization. RUTCOR Research Report.
113
+ double lower_bound = (posiform_info.getConstant() / posiform_info.getBiasConversionRatio())
114
+ + ((double)max_flow / (posiform_info.getBiasConversionRatio() * 2))
115
+ + offset;
116
+ return {lower_bound, fixed_variables};
117
+ }
118
+
119
+ } // namespace fix_variables_
@@ -0,0 +1,152 @@
1
+ /**
2
+ # MIT License
3
+ #
4
+ # Copyright (c) 2019 Jan Groschaft
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in all
14
+ # copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
23
+ */
24
+
25
+ #ifndef HELPER_DATA_STRUCTURES_HPP_INCLUDED
26
+ #define HELPER_DATA_STRUCTURES_HPP_INCLUDED
27
+
28
+ #include <vector>
29
+
30
+ // Queue with std::vector as internal container.
31
+ template <typename T> class vector_based_queue {
32
+ std::vector<T> _data;
33
+ std::size_t _back{0};
34
+ std::size_t _front{0};
35
+
36
+ public:
37
+ vector_based_queue() = default;
38
+
39
+ explicit vector_based_queue(std::size_t size) {
40
+ _front = 0;
41
+ _back = 0;
42
+ _data.resize(size);
43
+ }
44
+
45
+ void push(T val) noexcept { _data[_back++] = val; }
46
+
47
+ T pop() noexcept { return _data[_front++]; }
48
+
49
+ bool empty() const noexcept { return _front == _back; }
50
+
51
+ void reset() noexcept { _front = _back = 0; }
52
+
53
+ int size() noexcept { return _back - _front; }
54
+ };
55
+
56
+ // Stack with std::vector as internal container.
57
+ template <typename T> class vector_based_stack {
58
+ std::vector<T> _data;
59
+ std::size_t _size{0};
60
+
61
+ public:
62
+ vector_based_stack() = default;
63
+
64
+ explicit vector_based_stack(std::size_t size) {
65
+ _size = 0;
66
+ _data.resize(size);
67
+ }
68
+
69
+ void push(T val) noexcept { _data[_size++] = val; }
70
+
71
+ T pop() noexcept { return _data[--_size]; }
72
+
73
+ T top() noexcept { return _data[_size - 1]; }
74
+
75
+ bool empty() const noexcept { return _size == 0; }
76
+
77
+ void reset() noexcept { _size = 0; }
78
+
79
+ int size() noexcept { return _size; }
80
+ };
81
+
82
+ // Linked list that uses preallocated nodes.
83
+ template <typename node> class preallocated_linked_list {
84
+ node _head = node{}, _tail = node{};
85
+ std::size_t _size{0};
86
+
87
+ public:
88
+ preallocated_linked_list() {
89
+ _head.next = &_tail;
90
+ _tail.prev = &_head;
91
+ _size = 0;
92
+ }
93
+
94
+ node *pop() noexcept {
95
+ auto *ret = _head.next;
96
+ _head.next = _head.next->next;
97
+ _head.next->prev = &_head;
98
+ --_size;
99
+ return ret;
100
+ }
101
+
102
+ void push(node *n) noexcept {
103
+ n->next = &_tail;
104
+ n->prev = _tail.prev;
105
+ _tail.prev->next = n;
106
+ _tail.prev = n;
107
+ ++_size;
108
+ }
109
+
110
+ void push_front(node *n) noexcept {
111
+ n->next = _head.next;
112
+ n->prev = &_head;
113
+ _head.next->prev = n;
114
+ _head.next = n;
115
+ ++_size;
116
+ }
117
+
118
+ void erase(node *n) noexcept {
119
+ n->prev->next = n->next;
120
+ n->next->prev = n->prev;
121
+ --_size;
122
+ }
123
+
124
+ node *front() const noexcept { return _head.next; }
125
+
126
+ node *back() const noexcept { return _tail.prev; }
127
+
128
+ bool empty() const noexcept { return _size == 0; }
129
+
130
+ void clear() noexcept {
131
+ _head.next = &_tail;
132
+ _tail.prev = &_head;
133
+ _size = 0;
134
+ }
135
+
136
+ std::size_t size() const noexcept { return _size; }
137
+
138
+ void append_list(preallocated_linked_list &other) noexcept {
139
+ if (other.empty())
140
+ return;
141
+ auto other_head = other.front();
142
+ auto other_tail = other.back();
143
+ this->back()->next = other_head;
144
+ other_head->prev = this->back();
145
+ _tail.prev = other_tail;
146
+ other_tail->next = &_tail;
147
+ _size += other.size();
148
+ other.clear();
149
+ }
150
+ };
151
+
152
+ #endif