|
213 | 213 | # Generating vetorized versions
|
214 | 214 | lazy(tr_contiguous_vals_minus, tr_contiguous_vals_minus_rev)
|
215 | 215 |
|
216 |
| -# Parametric layers |
| 216 | +""" |
| 217 | + make_transformations(param::Symbol) |
| 218 | +
|
| 219 | +Generates a dictionary of transformation functions based on the specified parameterization. |
| 220 | +This function facilitates the creation of parametric layers for constraint transformations, |
| 221 | +allowing for flexible and dynamic constraint manipulation according to the needs of different |
| 222 | +constraint programming models. |
| 223 | +
|
| 224 | +## Parameters |
| 225 | +- `param::Symbol`: Specifies the type of transformations to generate. It can be `:none` for |
| 226 | + basic transformations that do not depend on external parameters, or `:val` for transformations that operate with respect to a specific value parameter. |
| 227 | +
|
| 228 | +## Returns |
| 229 | +- `LittleDict{Symbol, Function}`: A dictionary mapping transformation names (`Symbol`) to |
| 230 | + their corresponding functions (`Function`). The functions encapsulate various types of |
| 231 | + transformations, such as counting, comparison, and contiguous value processing. |
| 232 | +
|
| 233 | +## Transformation Types |
| 234 | +- When `param` is `:none`, the following transformations are available: |
| 235 | + - `:identity`: No transformation is applied. |
| 236 | + - `:count_eq`, `:count_eq_left`, `:count_eq_right`: Count equalities under different conditions. |
| 237 | + - `:count_greater`, `:count_lesser`: Count values greater or lesser than a threshold. |
| 238 | + - `:count_g_left`, `:count_l_left`, `:count_g_right`, `:count_l_right`: Count values with greater or lesser comparisons from different directions. |
| 239 | + - `:contiguous_vals_minus`, `:contiguous_vals_minus_rev`: Process contiguous values with subtraction in normal and reverse order. |
| 240 | +
|
| 241 | +- When `param` is `:val`, the transformations relate to operations involving a parameter value: |
| 242 | + - `:count_eq_param`, `:count_l_param`, `:count_g_param`: Count equalities or comparisons against a parameter value. |
| 243 | + - `:count_bounding_param`: Count values bounding a parameter value. |
| 244 | + - `:val_minus_param`, `:param_minus_val`: Subtract a parameter value from values or vice versa. |
| 245 | +
|
| 246 | +The function delegates to a version that uses `Val(param)` for dispatch, ensuring compile-time selection of the appropriate transformation set. |
| 247 | +
|
| 248 | +## Examples |
| 249 | +```julia |
| 250 | +# Get basic transformations |
| 251 | +basic_transforms = make_transformations(:none) |
| 252 | +
|
| 253 | +# Apply an identity transformation |
| 254 | +identity_result = basic_transforms[:identity](data) |
| 255 | +
|
| 256 | +# Get value-based transformations |
| 257 | +val_transforms = make_transformations(:val) |
| 258 | +
|
| 259 | +# Apply a count equal to parameter transformation |
| 260 | +count_eq_param_result = val_transforms[:count_eq_param](data, param) |
| 261 | +``` |
| 262 | +""" |
217 | 263 | make_transformations(param::Symbol) = make_transformations(Val(param))
|
218 | 264 |
|
219 | 265 | function make_transformations(::Val{:none})
|
|
0 commit comments