|
4 | 4 | * Christian Schulte <schulte@gecode.dev> |
5 | 5 | * |
6 | 6 | * Contributing authors: |
| 7 | + * Fabio Tardivo <ftardivo@nmsu.edu> |
7 | 8 | * Stefano Gualandi <stefano.gualandi@gmail.com> |
8 | 9 | * |
9 | 10 | * Copyright: |
| 11 | + * Fabio Tardivo, 2024 |
10 | 12 | * Stefano Gualandi, 2013 |
11 | 13 | * Christian Schulte, 2010 |
12 | 14 | * |
@@ -127,11 +129,11 @@ namespace Gecode { namespace Int { namespace BinPacking { |
127 | 129 | int operator [](int i) const; |
128 | 130 | }; |
129 | 131 |
|
130 | | - /// Range of lambda values |
131 | | - struct LambdaRange {int min; int max;}; |
132 | | - |
133 | | - /// Integer Dynamic Array |
134 | | - using IntDynamicArray = Support::DynamicArray<int,Region>; |
| 132 | + /// Range of lambda values |
| 133 | + struct LambdaRange { |
| 134 | + int min; |
| 135 | + int max; |
| 136 | + }; |
135 | 137 |
|
136 | 138 | /** |
137 | 139 | * \brief Bin-packing propagator |
@@ -182,30 +184,39 @@ namespace Gecode { namespace Int { namespace BinPacking { |
182 | 184 | /// Destructor |
183 | 185 | virtual size_t dispose(Space& home); |
184 | 186 | /// Reductions |
185 | | - static int const nReductions = 3; |
186 | | - static void calcReductions(const ViewArray<Item>& bs, const ViewArray<OffsetView>& l, IntDynamicArray & weightsBaseReduction, int & capacityBaseReduction, IntDynamicArray & deltaReductions); |
| 187 | + static int const n_reductions = 3; |
| 188 | + static void calc_reductions(const ViewArray<Item>& bs, |
| 189 | + const ViewArray<OffsetView>& l, |
| 190 | + int* weights_base_reduction, |
| 191 | + int& capacity_base_reduction, |
| 192 | + int* delta_reductions); |
187 | 193 | /// Dual Feasible Functions |
188 | | - static int fCCM1(int w, int l, int c); |
189 | | - static int fMT(int w, int l, int c); |
190 | | - static int fBJ1(int w, int l, int c); |
191 | | - static int fVB2Base(int w, int l, int c); |
192 | | - static int fVB2(int w, int l, int c); |
193 | | - static int fFS1(int w, int l, int c); |
194 | | - static int fRAD2Base(int w, int l, int c); |
195 | | - static int fRAD2(int w, int l, int c); |
196 | | - static int const nLambdaSamples = 256; |
197 | | - static LambdaRange lCCM1(int c); |
198 | | - static LambdaRange lMT(int c); |
199 | | - static LambdaRange lBJ1(int c); |
200 | | - static LambdaRange lVB2(int c); |
201 | | - static LambdaRange lFS1(int c); |
202 | | - static LambdaRange lRAD2(int c); |
203 | | - static LambdaRange sanitizeLambdaRange(LambdaRange lambda, int nWeights, int maxWeight); |
| 194 | + static int f_ccm1(int w, int l, int c); |
| 195 | + static int f_mt(int w, int l, int c); |
| 196 | + static int f_bj1(int w, int l, int c); |
| 197 | + static int f_vb2_base(int w, int l, int c); |
| 198 | + static int f_vb2(int w, int l, int c); |
| 199 | + static int f_fs1(int w, int l, int c); |
| 200 | + static int f_rad2_base(int w, int l, int c); |
| 201 | + static int f_rad2(int w, int l, int c); |
| 202 | + static int const n_lambda_samples = 256; |
| 203 | + static LambdaRange l_ccm1(int c); |
| 204 | + static LambdaRange l_mt(int c); |
| 205 | + static LambdaRange l_bj1(int c); |
| 206 | + static LambdaRange l_vb2(int c); |
| 207 | + static LambdaRange l_fs1(int c); |
| 208 | + static LambdaRange l_rad2(int c); |
| 209 | + static LambdaRange sanitize_lambda_range(LambdaRange lambda, |
| 210 | + int n_weights, int max_weight); |
204 | 211 | /// Lower bound |
205 | 212 | template<int f(int,int,int)> |
206 | | - static int calcDffLowerboundSingleLambda(const IntDynamicArray & weights, int capacity, int lambda); |
| 213 | + static int calc_dff_lower_bound_single_lambda(const int* weights, |
| 214 | + int n_weights, |
| 215 | + int capacity, int lambda); |
207 | 216 | template<int f(int,int,int), LambdaRange l(int)> |
208 | | - static int calcDffLowerbound(const IntDynamicArray & weights, int capacity, int nNotZeroWeights, int maxWeight, bool sanitize = false); |
| 217 | + static int calc_dff_lower_bound(const int* weights, int n_weights, |
| 218 | + int capacity, int n_not_zero_weights, |
| 219 | + int max_weight, bool sanitize = false); |
209 | 220 | }; |
210 | 221 |
|
211 | 222 |
|
|
0 commit comments