Skip to content

Commit af603c0

Browse files
committed
Add make transformation doc
1 parent b08dbee commit af603c0

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

src/layers/transformation.jl

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,53 @@ end
212212
# Generating vetorized versions
213213
lazy(tr_contiguous_vals_minus, tr_contiguous_vals_minus_rev)
214214

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

218264
function make_transformations(::Val{:none})

0 commit comments

Comments
 (0)